handle network reconnection

This commit is contained in:
Matias Alejo Garcia 2015-04-13 14:58:07 -03:00
commit 9efa2dfe24
16 changed files with 125 additions and 66 deletions

View file

@ -60,6 +60,20 @@ angular.module('copayApp.services')
root.walletClients[credentials.walletId] = client;
client.removeAllListeners();
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('notification', function(n) {
$log.debug('BWC Notification:', n);
notificationService.newBWCNotification(n,