Change all references to "cordova" to "window.cordova"
This commit is contained in:
parent
d87f274c73
commit
677db01d1b
|
@ -241,7 +241,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
$scope.notifications = notifications.unreadCount('notification');
|
$scope.notifications = notifications.unreadCount('notification');
|
||||||
$scope.unread = notifications.unreadCount('unread');
|
$scope.unread = notifications.unreadCount('unread');
|
||||||
|
|
||||||
if (cordova === undefined && settings.useFavico && $rootScope.favico) {
|
if (window.cordova === undefined && settings.useFavico && $rootScope.favico) {
|
||||||
notifications.updateFavico();
|
notifications.updateFavico();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -381,7 +381,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cordova !== undefined) {
|
if (window.cordova !== undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
// This also fires when the page is loaded if enabled.
|
// This also fires when the page is loaded if enabled.
|
||||||
// Note that this says MathJax but we switched to KaTeX
|
// Note that this says MathJax but we switched to KaTeX
|
||||||
settings.addCallback('enableMathjax', function(enabled) {
|
settings.addCallback('enableMathjax', function(enabled) {
|
||||||
if (cordova === undefined && enabled && !$rootScope.mathjax_init) {
|
if (window.cordova === undefined && enabled && !$rootScope.mathjax_init) {
|
||||||
// Load MathJax only once
|
// Load MathJax only once
|
||||||
$rootScope.mathjax_init = true;
|
$rootScope.mathjax_init = true;
|
||||||
|
|
||||||
|
|
|
@ -37,15 +37,15 @@ weechat.factory('notifications', ['$rootScope', '$log', 'models', 'settings', fu
|
||||||
|
|
||||||
document.addEventListener('deviceready', function() {
|
document.addEventListener('deviceready', function() {
|
||||||
// Add cordova local notification click handler
|
// Add cordova local notification click handler
|
||||||
if (cordova !== null && cordova.plugins !== undefined && cordova.plugins.notification !== undefined &&
|
if (window.cordova !== null && window.cordova.plugins !== undefined && window.cordova.plugins.notification !== undefined &&
|
||||||
cordova.plugins.notification.local !== undefined) {
|
window.cordova.plugins.notification.local !== undefined) {
|
||||||
cordova.plugins.notification.local.on("click", function (notification) {
|
window.cordova.plugins.notification.local.on("click", function (notification) {
|
||||||
// go to buffer
|
// go to buffer
|
||||||
var data = JSON.parse(notification.data);
|
var data = JSON.parse(notification.data);
|
||||||
models.setActiveBuffer(data.buffer);
|
models.setActiveBuffer(data.buffer);
|
||||||
window.focus();
|
window.focus();
|
||||||
// clear this notification
|
// clear this notification
|
||||||
cordova.plugins.notification.local.clear(notification.id);
|
window.cordova.plugins.notification.local.clear(notification.id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -112,17 +112,17 @@ weechat.factory('notifications', ['$rootScope', '$log', 'models', 'settings', fu
|
||||||
delete notifications[this.id];
|
delete notifications[this.id];
|
||||||
};
|
};
|
||||||
|
|
||||||
} else if (cordova !== undefined && cordova.plugins !== undefined && cordova.plugins.notification !== undefined && cordova.plugins.notification.local !== undefined) {
|
} else if (window.cordova !== undefined && window.cordova.plugins !== undefined && window.cordova.plugins.notification !== undefined && window.cordova.plugins.notification.local !== undefined) {
|
||||||
// Cordova local notification
|
// Cordova local notification
|
||||||
// Calculate notification id from buffer ID
|
// Calculate notification id from buffer ID
|
||||||
// Needs to be unique number, but we'll only ever have one per buffer
|
// Needs to be unique number, but we'll only ever have one per buffer
|
||||||
var id = parseInt(buffer.id, 16);
|
var id = parseInt(buffer.id, 16);
|
||||||
|
|
||||||
// Cancel previous notification for buffer (if there was one)
|
// Cancel previous notification for buffer (if there was one)
|
||||||
cordova.plugins.notification.local.clear(id);
|
window.cordova.plugins.notification.local.clear(id);
|
||||||
|
|
||||||
// Send new notification
|
// Send new notification
|
||||||
cordova.plugins.notification.local.schedule({
|
window.cordova.plugins.notification.local.schedule({
|
||||||
id: id,
|
id: id,
|
||||||
text: body,
|
text: body,
|
||||||
title: title,
|
title: title,
|
||||||
|
@ -166,7 +166,7 @@ weechat.factory('notifications', ['$rootScope', '$log', 'models', 'settings', fu
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateFavico = function() {
|
var updateFavico = function() {
|
||||||
if (cordova !== undefined) {
|
if (window.cordova !== undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ weechat.factory('notifications', ['$rootScope', '$log', 'models', 'settings', fu
|
||||||
|
|
||||||
showNotification(buffer, title, body);
|
showNotification(buffer, title, body);
|
||||||
|
|
||||||
if (cordova === undefined && settings.soundnotification) {
|
if (window.cordova === undefined && settings.soundnotification) {
|
||||||
// TODO fill in a sound file
|
// TODO fill in a sound file
|
||||||
var audioFile = "assets/audio/sonar";
|
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>';
|
var soundHTML = '<audio autoplay="autoplay"><source src="' + audioFile + '.ogg" type="audio/ogg" /><source src="' + audioFile + '.mp3" type="audio/mpeg" /></audio>';
|
||||||
|
|
Loading…
Reference in New Issue