Merge pull request #3993 from JDonadio/fix/needs-backup
Display backup message in addressbook
This commit is contained in:
commit
76ce26d898
5 changed files with 69 additions and 70 deletions
|
|
@ -603,10 +603,6 @@ ul.manage li {
|
|||
color: #fff;
|
||||
}
|
||||
|
||||
.name-wallet i {
|
||||
color: #B6E9DF;
|
||||
}
|
||||
|
||||
.locked {
|
||||
font-size: 11px;
|
||||
color: #7A8C9E;
|
||||
|
|
|
|||
|
|
@ -130,7 +130,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
var confirm_msg = gettextCatalog.getString('Confirm');
|
||||
|
||||
this.openDestinationAddressModal = function(wallets, address) {
|
||||
self.destinationWalletNeedsBackup = null;
|
||||
$rootScope.modalOpened = true;
|
||||
var fc = profileService.focusedClient;
|
||||
self.lockAddress = false;
|
||||
|
|
@ -247,22 +246,26 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
};
|
||||
|
||||
$scope.selectWallet = function(walletId, walletName) {
|
||||
$scope.gettingAddress = true;
|
||||
$scope.selectedWalletName = walletName;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
addressService.getAddress(walletId, false, function(err, addr) {
|
||||
$scope.gettingAddress = false;
|
||||
profileService.isBackupNeeded(walletId, function(needsBackup) {
|
||||
$scope.needsBackup = {};
|
||||
$scope.needsBackup[walletId] = needsBackup;
|
||||
if (needsBackup) return;
|
||||
|
||||
if (err) {
|
||||
self.error = err;
|
||||
$modalInstance.dismiss('cancel');
|
||||
return;
|
||||
}
|
||||
$scope.gettingAddress = true;
|
||||
$scope.selectedWalletName = walletName;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
|
||||
addressService.getAddress(walletId, false, function(err, addr) {
|
||||
$scope.gettingAddress = false;
|
||||
|
||||
if (err) {
|
||||
self.error = err;
|
||||
$modalInstance.dismiss('cancel');
|
||||
return;
|
||||
}
|
||||
|
||||
profileService.isBackupNeeded(walletId, function(needsBackup) {
|
||||
self.destinationWalletNeedsBackup = needsBackup;
|
||||
$modalInstance.close(addr);
|
||||
});
|
||||
});
|
||||
|
|
@ -859,7 +862,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
};
|
||||
|
||||
this.submitForm = function() {
|
||||
if (!$scope._amount || !$scope._address || self.destinationWalletNeedsBackup) return;
|
||||
if (!$scope._amount || !$scope._address) return;
|
||||
var fc = profileService.focusedClient;
|
||||
var unitToSat = this.unitToSatoshi;
|
||||
var currentSpendUnconfirmed = configWallet.spendUnconfirmed;
|
||||
|
|
@ -991,7 +994,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
|
||||
this.resetForm = function() {
|
||||
this.resetError();
|
||||
this.destinationWalletNeedsBackup = null;
|
||||
this._paypro = null;
|
||||
this.lockedCurrentFeePerKb = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -181,18 +181,6 @@ 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)
|
||||
|
|
@ -306,8 +294,8 @@ angular.module('copayApp.services')
|
|||
|
||||
// check if exist
|
||||
if (lodash.find(root.profile.credentials, {
|
||||
'walletId': walletData.walletId
|
||||
})) {
|
||||
'walletId': walletData.walletId
|
||||
})) {
|
||||
return cb(gettext('Cannot join the same wallet more that once'));
|
||||
}
|
||||
} catch (ex) {
|
||||
|
|
@ -680,6 +668,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.getWallets = function(network) {
|
||||
if (!root.profile) return [];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue