Merge pull request #1243 from torhve/removecordova
Remove all corodova stuff
This commit is contained in:
commit
c6d4613aea
|
@ -71,4 +71,4 @@ If you wish to submit code, we try to make the contribution process as simple as
|
|||
|
||||
We'd also like to ask you to join our IRC channel, #glowing-bear on libera, so we can discuss your ideas and changes.
|
||||
|
||||
If you're curious about the projects we're using, here's a list: [AngularJS](https://angularjs.org/), [Bootstrap](http://getbootstrap.com/), [Underscore](http://underscorejs.org/), [favico.js](http://lab.ejci.net/favico.js/), Emoji provided free by [Emoji One](http://emojione.com/), and [zlib.js](https://github.com/imaya/zlib.js). Technology-wise, [WebSockets](https://en.wikipedia.org/wiki/WebSocket) are the most important part, but we also use [local storage](https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage#localStorage), the [Notification Web API](https://developer.mozilla.org/en/docs/Web/API/notification), and last (but not least) [Apache Cordova](https://cordova.apache.org/) for our mobile app (currently unmaintained and unavailable).
|
||||
If you're curious about the projects we're using, here's a list: [AngularJS](https://angularjs.org/), [Bootstrap](http://getbootstrap.com/), [Underscore](http://underscorejs.org/), [favico.js](http://lab.ejci.net/favico.js/), Emoji provided free by [Emoji One](http://emojione.com/), and [zlib.js](https://github.com/imaya/zlib.js). Technology-wise, [WebSockets](https://en.wikipedia.org/wiki/WebSocket) are the most important part, but we also use [local storage](https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage#localStorage), the [Notification Web API](https://developer.mozilla.org/en/docs/Web/API/notification), and last (but not least) [Tauri](https://tauri.app/) for our standalone apps for different platforms.
|
||||
|
|
|
@ -306,8 +306,6 @@ npm install electron-packager
|
|||
npm run build-electron-{windows, darwin, linux}</pre>
|
||||
<h3>Chrome</h3>
|
||||
<p>To install Glowing Bear as an app in Chrome for Android, select <kbd>Menu - Add to home screen</kbd>. In the desktop version of Chrome, click <kbd>Menu - More tools - Create application shortcuts</kbd>.</p>
|
||||
<h3>Android App</h3>
|
||||
<p>We used to have an Android app, but discontinued it for lack of maintainers. You can still build it for yourself, see <a href="https://github.com/glowing-bear/glowing-bear-cordova">the app repository</a> for instructions. Sorry!</p>
|
||||
<h3>Firefox Browser</h3>
|
||||
<p>Firefox used to support apps, but this was removed from Firefox. There's nothing we can do about it. Sorry!</p>
|
||||
</div>
|
||||
|
|
|
@ -5,13 +5,6 @@ import * as _ from "underscore";
|
|||
|
||||
import { connectionFactory } from './connection';
|
||||
|
||||
// cordova splash screen
|
||||
document.addEventListener("deviceready", function () {
|
||||
if (navigator.splashscreen !== undefined) {
|
||||
navigator.splashscreen.hide();
|
||||
}
|
||||
}, false);
|
||||
|
||||
var weechat = angular.module('weechat', ['ngRoute', 'localStorage', 'weechatModels', 'bufferResume', 'plugins', 'IrcUtils', 'ngSanitize', 'ngWebsockets', 'ngTouch'], ['$compileProvider', function($compileProvider) {
|
||||
// hacky way to be able to find out if we're in debug mode
|
||||
weechat.compileProvider = $compileProvider;
|
||||
|
@ -59,7 +52,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
'onlyUnread': false,
|
||||
'hotlistsync': true,
|
||||
'orderbyserver': true,
|
||||
'useFavico': !utils.isCordova(),
|
||||
'useFavico': true,
|
||||
'soundnotification': true,
|
||||
'fontsize': '14px',
|
||||
'fontfamily': (utils.isMobileUi() ? 'sans-serif' : 'Inconsolata, Consolas, Monaco, Ubuntu Mono, monospace'),
|
||||
|
@ -118,10 +111,10 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
})();
|
||||
|
||||
// Show a TLS warning if GB was loaded over an unencrypted connection,
|
||||
// except for local instances (local files, testing, cordova, or electron)
|
||||
// except for local instances (local files, testing)
|
||||
$scope.show_tls_warning = (["https:", "file:"].indexOf(window.location.protocol) === -1) &&
|
||||
(["localhost", "127.0.0.1", "::1"].indexOf(window.location.hostname) === -1) &&
|
||||
!window.is_electron && !utils.isCordova();
|
||||
!window.is_electron;
|
||||
|
||||
$rootScope.isWindowFocused = function() {
|
||||
if (typeof $scope.documentHidden === "undefined") {
|
||||
|
@ -253,9 +246,8 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
}
|
||||
});
|
||||
|
||||
if (!utils.isCordova()) {
|
||||
$rootScope.favico = new Favico({animation: 'none'});
|
||||
}
|
||||
$rootScope.favico = new Favico({animation: 'none'});
|
||||
|
||||
$scope.notifications = notifications.unreadCount('notification');
|
||||
$scope.unread = notifications.unreadCount('unread');
|
||||
|
||||
|
@ -264,7 +256,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
$scope.notifications = notifications.unreadCount('notification');
|
||||
$scope.unread = notifications.unreadCount('unread');
|
||||
|
||||
if (!utils.isCordova() && settings.useFavico && $rootScope.favico) {
|
||||
if (settings.useFavico && $rootScope.favico) {
|
||||
notifications.updateFavico();
|
||||
}
|
||||
});
|
||||
|
@ -274,11 +266,8 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
$rootScope.pageTitle = '';
|
||||
$rootScope.notificationStatus = '';
|
||||
|
||||
// cancel outstanding notifications (incl cordova)
|
||||
// cancel outstanding notifications
|
||||
notifications.cancelAll();
|
||||
if (window.plugin !== undefined && window.plugin.notification !== undefined && window.plugin.notification.local !== undefined) {
|
||||
window.plugin.notification.local.cancelAll();
|
||||
}
|
||||
|
||||
models.reinitialize();
|
||||
$rootScope.$emit('notificationChanged');
|
||||
|
@ -436,10 +425,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
return;
|
||||
}
|
||||
|
||||
if (utils.isCordova()) {
|
||||
return; // cordova doesn't have a favicon
|
||||
}
|
||||
|
||||
if (useFavico) {
|
||||
notifications.updateFavico();
|
||||
} else {
|
||||
|
@ -453,8 +438,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
// This also fires when the page is loaded if enabled.
|
||||
// Note that this says MathJax but we switched to KaTeX
|
||||
settings.addCallback('enableMathjax', function(enabled) {
|
||||
// no latex math support for cordova right now
|
||||
if (!utils.isCordova() && enabled && !$rootScope.mathjax_init) {
|
||||
if (enabled && !$rootScope.mathjax_init) {
|
||||
// Load MathJax only once
|
||||
$rootScope.mathjax_init = true;
|
||||
|
||||
|
@ -1012,10 +996,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
if ($rootScope.connected) {
|
||||
$scope.disconnect();
|
||||
}
|
||||
|
||||
if (!utils.isCordova()) {
|
||||
$scope.favico.reset();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -34,21 +34,6 @@ weechat.factory('notifications', ['$rootScope', '$log', 'models', 'settings', 'u
|
|||
$log.info('Service Worker err:', err);
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('deviceready', function() {
|
||||
// Add cordova local notification click handler
|
||||
if (utils.isCordova() && window.cordova.plugins !== undefined && window.cordova.plugins.notification !== undefined &&
|
||||
window.cordova.plugins.notification.local !== undefined) {
|
||||
window.cordova.plugins.notification.local.on("click", function (notification) {
|
||||
// go to buffer
|
||||
var data = JSON.parse(notification.data);
|
||||
models.setActiveBuffer(data.buffer);
|
||||
window.focus();
|
||||
// clear this notification
|
||||
window.cordova.plugins.notification.local.clear(notification.id);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var showNotification = function(buffer, title, body) {
|
||||
|
@ -114,25 +99,7 @@ weechat.factory('notifications', ['$rootScope', '$log', 'models', 'settings', 'u
|
|||
notification.onclose = function() {
|
||||
delete notifications[this.id];
|
||||
};
|
||||
|
||||
} else if (utils.isCordova() && window.cordova.plugins !== undefined && window.cordova.plugins.notification !== undefined && window.cordova.plugins.notification.local !== undefined) {
|
||||
// Cordova local notification
|
||||
// Calculate notification id from buffer ID
|
||||
// Needs to be unique number, but we'll only ever have one per buffer
|
||||
var id = parseInt(buffer.id, 16);
|
||||
|
||||
// Cancel previous notification for buffer (if there was one)
|
||||
window.cordova.plugins.notification.local.clear(id);
|
||||
|
||||
// Send new notification
|
||||
window.cordova.plugins.notification.local.schedule({
|
||||
id: id,
|
||||
text: body,
|
||||
title: title,
|
||||
data: { buffer: buffer.id } // remember buffer id for when the notification is clicked
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -175,10 +142,6 @@ weechat.factory('notifications', ['$rootScope', '$log', 'models', 'settings', 'u
|
|||
};
|
||||
|
||||
var updateFavico = function() {
|
||||
if (utils.isCordova()) {
|
||||
return; // cordova doesn't have a favicon
|
||||
}
|
||||
|
||||
var notifications = unreadCount('notification');
|
||||
if (notifications > 0) {
|
||||
$rootScope.favico.badge(notifications, {
|
||||
|
@ -244,7 +207,7 @@ weechat.factory('notifications', ['$rootScope', '$log', 'models', 'settings', 'u
|
|||
|
||||
showNotification(buffer, title, body);
|
||||
|
||||
if (!utils.isCordova() && settings.soundnotification) {
|
||||
if (settings.soundnotification) {
|
||||
var audioFile = "assets/audio/sonar";
|
||||
var soundHTML = '<audio autoplay="autoplay"><source src="' + audioFile + '.ogg" type="audio/ogg" /><source src="' + audioFile + '.mp3" type="audio/mpeg" /></audio>';
|
||||
document.getElementById("soundNotification").innerHTML = soundHTML;
|
||||
|
|
|
@ -24,10 +24,6 @@ weechat.factory('utils', function() {
|
|||
return (document.body.clientWidth < mobile_cutoff);
|
||||
};
|
||||
|
||||
var isCordova = function() {
|
||||
return window.cordova !== undefined;
|
||||
};
|
||||
|
||||
const _isTauri = window.__TAURI__ !== undefined;
|
||||
var isTauri = function() {
|
||||
return _isTauri;
|
||||
|
@ -90,7 +86,6 @@ weechat.factory('utils', function() {
|
|||
changeClassStyle: changeClassStyle,
|
||||
getClassStyle: getClassStyle,
|
||||
isMobileUi: isMobileUi,
|
||||
isCordova: isCordova,
|
||||
isTauri: isTauri,
|
||||
inject_script: inject_script,
|
||||
inject_css: inject_css,
|
||||
|
|
Loading…
Reference in New Issue