Removes online/offline events

This commit is contained in:
Gustavo Maximiliano Cortez 2015-06-26 11:55:41 -03:00
commit d02c1a7f11
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
4 changed files with 10 additions and 49 deletions

View file

@ -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) {

View file

@ -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;
});

View file

@ -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);

View file

@ -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);