move function to profileService
This commit is contained in:
parent
ea2060511e
commit
d6325113d4
3 changed files with 17 additions and 16 deletions
|
|
@ -136,28 +136,13 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.initGlidera();
|
||||
|
||||
self.setCustomBWSFlag();
|
||||
self.isBackupNeeded(fc, function(needsBackup) {
|
||||
profileService.isBackupNeeded(self.walletId, function(needsBackup) {
|
||||
self.needsBackup = needsBackup;
|
||||
self.openWallet();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
self.isBackupNeeded = function(fc, cb) {
|
||||
if (fc.isPrivKeyExternal()) return cb(false);
|
||||
|
||||
if (!fc.credentials.mnemonic) {
|
||||
storageService.setBackupFlag(self.walletId, function(err) {
|
||||
$log.debug('Backup stored');
|
||||
return cb(false);
|
||||
});
|
||||
} else {
|
||||
storageService.getBackupFlag(self.walletId, function(err, val) {
|
||||
return cb(self.network == 'testnet' ? false : !val);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
self.setCustomBWSFlag = function() {
|
||||
var defaults = configService.getDefaults();
|
||||
var config = configService.getSync();
|
||||
|
|
|
|||
|
|
@ -250,6 +250,10 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
}
|
||||
|
||||
$modalInstance.close(addr);
|
||||
profileService.isBackupNeeded(walletId, function(needsBackup) {
|
||||
self.destinationWalletNeedsBackup = needsBackup;
|
||||
$modalInstance.close(addr);
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -174,6 +174,18 @@ angular.module('copayApp.services')
|
|||
});
|
||||
};
|
||||
|
||||
root.isBackupNeeded = function(walletId, cb) {
|
||||
var c = root.getClient(walletId);
|
||||
if (c.isPrivKeyExternal()) return cb(false);
|
||||
if (!c.credentials.mnemonic) return cb(false);
|
||||
if (c.credentials.network == 'testnet') return cb(false);
|
||||
|
||||
storageService.getBackupFlag(walletId, function(err, val) {
|
||||
if (err || val) return cb(false);
|
||||
return cb(true);
|
||||
});
|
||||
};
|
||||
|
||||
root._seedWallet = function(opts, cb) {
|
||||
opts = opts || {};
|
||||
if (opts.bwsurl)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue