diff --git a/src/js/init.js b/src/js/init.js index a0070e3f7..b8b84f84e 100644 --- a/src/js/init.js +++ b/src/js/init.js @@ -26,12 +26,6 @@ angular.element(document).ready(function() { }, 100); }, false); - // We are not emitting here, since when the BWS socket reconnects, - // update will be triggered - document.addEventListener('offline', function() { - window.location = '#/cordova/offline'; - }, false); - // Back button event document.addEventListener('backbutton', function() { var loc = window.location; diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index d237bf47a..2ebf60e7a 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -1,6 +1,6 @@ 'use strict'; angular.module('copayApp.services') - .factory('profileService', function profileServiceFactory($rootScope, $location, $timeout, $filter, $log, lodash, storageService, bwcService, configService, notificationService, isChromeApp, isCordova, gettext) { + .factory('profileService', function profileServiceFactory($rootScope, $location, $timeout, $filter, $log, lodash, storageService, bwcService, configService, notificationService, isChromeApp, isCordova, gettext, nodeWebkit) { var root = {}; @@ -62,18 +62,20 @@ angular.module('copayApp.services') client.removeAllListeners(); - client.on('reconnect', function() { - if (root.focusedClient.credentials.walletId == client.credentials.walletId) { - $rootScope.$emit('Local/Online'); - } - }); + if (!nodeWebkit.isDefined() && !isCordova) { + client.on('reconnect', function() { + if (root.focusedClient.credentials.walletId == client.credentials.walletId) { + $rootScope.$emit('Local/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) { + $rootScope.$emit('Local/Offline'); + } + }); + } client.on('notification', function(n) { $log.debug('BWC Notification:', n);