From 718ae69576921d94465f9c99106c2f5e1a887414 Mon Sep 17 00:00:00 2001 From: Manuel Araoz Date: Tue, 17 Jun 2014 11:33:43 -0300 Subject: [PATCH 1/2] add notification saying backup was created --- js/services/backupService.js | 7 +++++-- js/services/notifications.js | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/js/services/backupService.js b/js/services/backupService.js index 982d3376a..5485a0e12 100644 --- a/js/services/backupService.js +++ b/js/services/backupService.js @@ -1,6 +1,8 @@ 'use strict'; -var BackupService = function() {}; +var BackupService = function($notification) { + this.notifications = $notification; +}; BackupService.prototype.getName = function(wallet) { return (wallet.name ? (wallet.name+'-') : '') + wallet.id; @@ -11,6 +13,7 @@ BackupService.prototype.download = function(wallet) { var timestamp = +(new Date()); var walletName = this.getName(wallet); var filename = walletName + '-' + timestamp + '-keybackup.json.aes'; + this.notifications.success('Backup created', 'Encrypted backup file saved.'); var blob = new Blob([ew], { type: 'text/plain;charset=utf-8' }); @@ -44,4 +47,4 @@ BackupService.prototype.sendEmail = function(email, wallet) { } }; -angular.module('copayApp.services').value('backupService', new BackupService()); +angular.module('copayApp.services').service('backupService', BackupService); diff --git a/js/services/notifications.js b/js/services/notifications.js index c37aee391..11804689d 100644 --- a/js/services/notifications.js +++ b/js/services/notifications.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('notifications', []). - factory('$notification', ['$timeout',function($timeout){ + factory('$notification', ['$timeout',function($timeout, $rootScope){ var notifications = JSON.parse(localStorage.getItem('$notifications')) || [], queue = []; @@ -197,7 +197,9 @@ angular.module('notifications', []). clear: function(){ notifications = []; this.save(); - } + }, + + init: function() {} }; }]). From 0afd80bbd9e2b9146c721f6f6fa7cd2d3f1576eb Mon Sep 17 00:00:00 2001 From: Manuel Araoz Date: Tue, 17 Jun 2014 16:44:09 -0300 Subject: [PATCH 2/2] fix matis comments --- js/services/notifications.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/js/services/notifications.js b/js/services/notifications.js index 11804689d..c37aee391 100644 --- a/js/services/notifications.js +++ b/js/services/notifications.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('notifications', []). - factory('$notification', ['$timeout',function($timeout, $rootScope){ + factory('$notification', ['$timeout',function($timeout){ var notifications = JSON.parse(localStorage.getItem('$notifications')) || [], queue = []; @@ -197,9 +197,7 @@ angular.module('notifications', []). clear: function(){ notifications = []; this.save(); - }, - - init: function() {} + } }; }]).