Removes online/offline events
This commit is contained in:
parent
a2f2451ad9
commit
d02c1a7f11
4 changed files with 10 additions and 49 deletions
|
|
@ -665,26 +665,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.debouncedUpdate();
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/Online', function(event) {
|
||||
$log.debug('### Online event');
|
||||
if (self.isOffline) self.debouncedUpdate();
|
||||
self.isOffline = false;
|
||||
self.offLineSince = null;
|
||||
});
|
||||
|
||||
self.offLineSince = null;;
|
||||
$rootScope.$on('Local/Offline', function(event) {
|
||||
$log.debug('### Offline event');
|
||||
if (!self.offLineSince) self.offLineSince = Date.now();
|
||||
|
||||
if (Date.now() - self.offLineSince > 30000) {
|
||||
self.isOffline = true;
|
||||
$timeout(function() {
|
||||
$rootScope.$apply();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/BackupDone', function(event) {
|
||||
self.needsBackup = false;
|
||||
storageService.setBackupFlag(self.walletId, function(err) {
|
||||
|
|
|
|||
|
|
@ -46,18 +46,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
self.resetForm();
|
||||
});
|
||||
|
||||
var disableOnlineListener = $rootScope.$on('Local/Online', function() {
|
||||
// This is needed then the apps go to sleep
|
||||
self.bindTouchDown();
|
||||
});
|
||||
|
||||
var disableResumeListener = $rootScope.$on('Local/Resume', function() {
|
||||
// This is needed then the apps go to sleep
|
||||
self.bindTouchDown();
|
||||
});
|
||||
|
||||
|
||||
|
||||
var disableTabListener = $rootScope.$on('Local/TabChanged', function(e, tab) {
|
||||
// This will slow down switch, do not add things here!
|
||||
switch (tab) {
|
||||
|
|
@ -76,8 +64,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
disablePaymentUriListener();
|
||||
disableTabListener();
|
||||
disableFocusListener();
|
||||
disableResumeListener();
|
||||
disableOnlineListener();
|
||||
$rootScope.hideMenuBar = false;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -402,9 +402,6 @@ angular
|
|||
case 'resume':
|
||||
$rootScope.$emit('Local/Resume');
|
||||
break;
|
||||
case 'offline':
|
||||
$rootScope.$emit('Local/Offline');
|
||||
break;
|
||||
};
|
||||
$timeout(function() {
|
||||
$rootScope.$emit('Local/SetTab', 'walletHome', true);
|
||||
|
|
|
|||
|
|
@ -62,20 +62,18 @@ angular.module('copayApp.services')
|
|||
client.removeAllListeners();
|
||||
|
||||
|
||||
if (!nodeWebkit.isDefined() && !isCordova) {
|
||||
client.on('reconnect', function() {
|
||||
if (root.focusedClient.credentials.walletId == client.credentials.walletId) {
|
||||
$rootScope.$emit('Local/Online');
|
||||
}
|
||||
});
|
||||
client.on('reconnect', function() {
|
||||
if (root.focusedClient.credentials.walletId == client.credentials.walletId) {
|
||||
$log.debug('### Online');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
client.on('reconnecting', function() {
|
||||
if (root.focusedClient.credentials.walletId == client.credentials.walletId) {
|
||||
$rootScope.$emit('Local/Offline');
|
||||
}
|
||||
});
|
||||
}
|
||||
client.on('reconnecting', function() {
|
||||
if (root.focusedClient.credentials.walletId == client.credentials.walletId) {
|
||||
$log.debug('### Offline');
|
||||
}
|
||||
});
|
||||
|
||||
client.on('notification', function(n) {
|
||||
$log.debug('BWC Notification:', n);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue