adding backup flag on localstorage

This commit is contained in:
Gabriel Bazán 2016-08-30 16:37:05 -03:00
commit 6eb87704ba
2 changed files with 11 additions and 5 deletions

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('backupController', angular.module('copayApp.controllers').controller('backupController',
function($rootScope, $scope, $timeout, $log, $state, $stateParams, $ionicPopup, $ionicNavBarDelegate, uxLanguage, lodash, fingerprintService, platformInfo, configService, profileService, bwcService, walletService, ongoingProcess) { function($rootScope, $scope, $timeout, $log, $state, $stateParams, $ionicPopup, $ionicNavBarDelegate, uxLanguage, lodash, fingerprintService, platformInfo, configService, profileService, bwcService, walletService, ongoingProcess, storageService) {
var wallet = profileService.getWallet($stateParams.walletId); var wallet = profileService.getWallet($stateParams.walletId);
$ionicNavBarDelegate.title(wallet.credentials.walletName); $ionicNavBarDelegate.title(wallet.credentials.walletName);
$scope.n = wallet.n; $scope.n = wallet.n;
@ -136,8 +136,11 @@ angular.module('copayApp.controllers').controller('backupController',
} }
} }
$rootScope.$emit('Local/BackupDone'); $log.debug('Backup done');
return cb(); storageService.setBackupFlag(wallet.credentials.walletId, function(err) {
$log.debug('Backup stored');
return cb();
});
}, 1); }, 1);
}; };

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('createController', angular.module('copayApp.controllers').controller('createController',
function($scope, $rootScope, $timeout, $log, lodash, $state, profileService, configService, gettext, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService) { function($scope, $rootScope, $timeout, $log, lodash, $state, profileService, configService, gettext, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, storageService) {
var isChromeApp = platformInfo.isChromeApp; var isChromeApp = platformInfo.isChromeApp;
var isCordova = platformInfo.isCordova; var isCordova = platformInfo.isCordova;
@ -184,7 +184,10 @@ angular.module('copayApp.controllers').controller('createController',
if (self.seedSourceId == 'set') { if (self.seedSourceId == 'set') {
$timeout(function() { $timeout(function() {
$rootScope.$emit('Local/BackupDone'); $log.debug('Backup done');
storageService.setBackupFlag(wallet.credentials.walletId, function(err) {
$log.debug('Backup stored');
});
}, 1); }, 1);
} }
$state.go('tabs.home') $state.go('tabs.home')