refactor backup flag process
This commit is contained in:
parent
9f42ae3891
commit
a9c4762ef7
9 changed files with 77 additions and 90 deletions
|
|
@ -136,11 +136,8 @@ angular.module('copayApp.controllers').controller('backupController',
|
|||
}
|
||||
}
|
||||
|
||||
$log.debug('Backup done');
|
||||
storageService.setBackupFlag(wallet.credentials.walletId, function(err) {
|
||||
$log.debug('Backup stored');
|
||||
return cb();
|
||||
});
|
||||
profileService.setBackupFlag(walletClient.credentials.walletId);
|
||||
return cb();
|
||||
}, 1);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -183,12 +183,7 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
|
||||
|
||||
if (self.seedSourceId == 'set') {
|
||||
$timeout(function() {
|
||||
$log.debug('Backup done');
|
||||
storageService.setBackupFlag(wallet.credentials.walletId, function(err) {
|
||||
$log.debug('Backup stored');
|
||||
});
|
||||
}, 1);
|
||||
profileService.setBackupFlag(client.credentials.walletId);
|
||||
}
|
||||
$state.go('tabs.home')
|
||||
});
|
||||
|
|
|
|||
|
|
@ -109,12 +109,12 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
$log.debug('Remote preferences saved for:' + client.credentials.walletId)
|
||||
});
|
||||
|
||||
$rootScope.$emit('Local/WalletImported', client.credentials.walletId);
|
||||
if ($stateParams.fromOnboarding)
|
||||
profileService.setBackupFlag(client.credentials.walletId);
|
||||
if ($stateParams.fromOnboarding) {
|
||||
profileService.setDisclaimerAccepted(function(err) {
|
||||
if (err) $log.error(err);
|
||||
});
|
||||
|
||||
}
|
||||
$state.go('tabs.home');
|
||||
});
|
||||
}, 100);
|
||||
|
|
@ -141,12 +141,12 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
$log.debug('Remote preferences saved for:' + client.credentials.walletId)
|
||||
});
|
||||
|
||||
$rootScope.$emit('Local/WalletImported', client.credentials.walletId);
|
||||
if ($stateParams.fromOnboarding)
|
||||
profileService.setBackupFlag(client.credentials.walletId);
|
||||
if ($stateParams.fromOnboarding) {
|
||||
profileService.setDisclaimerAccepted(function(err) {
|
||||
if (err) $log.error(err);
|
||||
});
|
||||
|
||||
}
|
||||
$state.go('tabs.home');
|
||||
});
|
||||
}, 100);
|
||||
|
|
@ -166,12 +166,13 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
$scope.$apply();
|
||||
});
|
||||
}
|
||||
$rootScope.$emit('Local/WalletImported', walletId);
|
||||
if ($stateParams.fromOnboarding)
|
||||
|
||||
profileService.setBackupFlag(walletId);
|
||||
if ($stateParams.fromOnboarding) {
|
||||
profileService.setDisclaimerAccepted(function(err) {
|
||||
if (err) $log.error(err);
|
||||
});
|
||||
|
||||
}
|
||||
$state.go('tabs.home');
|
||||
});
|
||||
}, 100);
|
||||
|
|
@ -200,12 +201,12 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
$log.debug('Remote preferences saved for:' + client.credentials.walletId)
|
||||
});
|
||||
|
||||
$rootScope.$emit('Local/WalletImported', client.credentials.walletId);
|
||||
if ($stateParams.fromOnboarding)
|
||||
profileService.setBackupFlag(client.credentials.walletId);
|
||||
if ($stateParams.fromOnboarding) {
|
||||
profileService.setDisclaimerAccepted(function(err) {
|
||||
if (err) $log.error(err);
|
||||
});
|
||||
|
||||
}
|
||||
$state.go('tabs.home');
|
||||
});
|
||||
}, 100);
|
||||
|
|
@ -339,12 +340,13 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
walletService.updateRemotePreferences(wallet, {}, function() {
|
||||
$log.debug('Remote preferences saved for:' + wallet.walletId)
|
||||
});
|
||||
$rootScope.$emit('Local/WalletImported', wallet.walletId);
|
||||
if ($stateParams.fromOnboarding)
|
||||
|
||||
profileService.setBackupFlag(wallet.walletId);
|
||||
if ($stateParams.fromOnboarding) {
|
||||
profileService.setDisclaimerAccepted(function(err) {
|
||||
if (err) $log.error(err);
|
||||
});
|
||||
|
||||
}
|
||||
$state.go('tabs.home');
|
||||
});
|
||||
}, 100);
|
||||
|
|
@ -421,13 +423,13 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
walletService.updateRemotePreferences(wallet, {}, function() {
|
||||
$log.debug('Remote preferences saved for:' + wallet.walletId)
|
||||
});
|
||||
$rootScope.$emit('Local/WalletImported', wallet.walletId);
|
||||
|
||||
if ($stateParams.fromOnboarding)
|
||||
profileService.setBackupFlag(wallet.walletId);
|
||||
if ($stateParams.fromOnboarding) {
|
||||
profileService.setDisclaimerAccepted(function(err) {
|
||||
if (err) $log.error(err);
|
||||
});
|
||||
|
||||
}
|
||||
$state.go('tabs.home');
|
||||
});
|
||||
}, 100);
|
||||
|
|
|
|||
|
|
@ -1,14 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesDeleteWordsController', function($scope, $ionicHistory, $stateParams, $ionicNavBarDelegate, gettextCatalog, confirmDialog, lodash, profileService, walletService, gettext) {
|
||||
angular.module('copayApp.controllers').controller('preferencesDeleteWordsController', function($scope, $ionicHistory, $stateParams, $ionicNavBarDelegate, gettextCatalog, confirmDialog, lodash, profileService, gettext) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('Delete recovery phrase'));
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
var msg = gettext('Are you sure you want to delete the recovery phrase?');
|
||||
var successMsg = gettext('Recovery phrase deleted');
|
||||
$scope.needsBackup = wallet.needsBackup;
|
||||
|
||||
walletService.needsBackup(wallet, function(needsBackup) {
|
||||
$scope.needsBackup = needsBackup;
|
||||
});
|
||||
if (lodash.isEmpty(wallet.credentials.mnemonic) && lodash.isEmpty(wallet.credentials.mnemonicEncrypted))
|
||||
$scope.deleted = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
});
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
$scope.isNW = platformInfo.isNW;
|
||||
$scope.needsBackup = false;
|
||||
}
|
||||
|
||||
$scope.$on('Wallet/Changed', function(event, wallet) {
|
||||
|
|
@ -20,17 +19,11 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
}
|
||||
$scope.wallet = wallet;
|
||||
$log.debug('Wallet changed: ' + wallet.name);
|
||||
|
||||
walletService.needsBackup(wallet, function(needsBackup) {
|
||||
if (needsBackup) $scope.needsBackup = true;
|
||||
else $scope.needsBackup = false;
|
||||
|
||||
$scope.setAddress(wallet);
|
||||
});
|
||||
$scope.setAddress(wallet);
|
||||
});
|
||||
|
||||
$scope.shareAddress = function(addr) {
|
||||
if ($scope.needsBackup || $scope.generatingAddress) return;
|
||||
if ($scope.generatingAddress) return;
|
||||
if ($scope.isCordova) {
|
||||
window.plugins.socialsharing.share('bitcoin:' + addr, null, null, null);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue