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';
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);
$ionicNavBarDelegate.title(wallet.credentials.walletName);
$scope.n = wallet.n;
@ -136,8 +136,11 @@ angular.module('copayApp.controllers').controller('backupController',
}
}
$rootScope.$emit('Local/BackupDone');
return cb();
$log.debug('Backup done');
storageService.setBackupFlag(wallet.credentials.walletId, function(err) {
$log.debug('Backup stored');
return cb();
});
}, 1);
};

View file

@ -1,7 +1,7 @@
'use strict';
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 isCordova = platformInfo.isCordova;
@ -184,7 +184,10 @@ angular.module('copayApp.controllers').controller('createController',
if (self.seedSourceId == 'set') {
$timeout(function() {
$rootScope.$emit('Local/BackupDone');
$log.debug('Backup done');
storageService.setBackupFlag(wallet.credentials.walletId, function(err) {
$log.debug('Backup stored');
});
}, 1);
}
$state.go('tabs.home')