fix copayers
This commit is contained in:
parent
6dba17937f
commit
9e70821c4c
11 changed files with 392 additions and 315 deletions
|
|
@ -61,7 +61,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
});
|
||||
};
|
||||
|
||||
root.needsBackup = function(wallet) {
|
||||
root.requiresBackup = function(wallet) {
|
||||
if (wallet.isPrivKeyExternal()) return false;
|
||||
if (!wallet.credentials.mnemonic) return false;
|
||||
if (wallet.credentials.network == 'testnet') return false;
|
||||
|
|
@ -69,6 +69,18 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
return true;
|
||||
};
|
||||
|
||||
root.needsBackup = function(wallet, cb) {
|
||||
|
||||
if (!walletService.requiresBackup(wallet))
|
||||
return cb(false);
|
||||
|
||||
storageService.getBackupFlag(wallet.credentials.walletId, function(err, val) {
|
||||
if (err) $log.error(err);
|
||||
if (val) return cb(false);
|
||||
return cb(true);
|
||||
});
|
||||
};
|
||||
|
||||
var _walletStatusHash = function(walletStatus) {
|
||||
var bal;
|
||||
if (walletStatus) {
|
||||
|
|
@ -90,6 +102,9 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
$log.warn('TODO');
|
||||
return; // TODO!!!
|
||||
if (err instanceof errors.NOT_AUTHORIZED) {
|
||||
|
||||
console.log('[walletService.js.93] TODO NOT AUTH'); //TODO
|
||||
// TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO
|
||||
self.notAuthorized = true;
|
||||
go.walletHome();
|
||||
} else if (err instanceof errors.NOT_FOUND) {
|
||||
|
|
@ -815,5 +830,18 @@ console.log('[walletService.js.786:wallet:]',wallet, forceNew); //TODO
|
|||
};
|
||||
|
||||
|
||||
root.isReady = function(wallet, cb) {
|
||||
if (!wallet.isComplete())
|
||||
return cb('WALLET_NOT_COMPLETE');
|
||||
|
||||
root.needsBackup(wallet, function(needsBackup) {
|
||||
if (needsBackup)
|
||||
return cb('WALLET_NEEDS_BACKUP');
|
||||
return cb();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
return root;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue