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
|
|
@ -25,15 +25,15 @@
|
||||||
<div class="modal-content fix-modals-touch p20b">
|
<div class="modal-content fix-modals-touch p20b">
|
||||||
<div class="create-tab small-only-text-center" ng-show="!editAddressbook && !addAddressbookEntry">
|
<div class="create-tab small-only-text-center" ng-show="!editAddressbook && !addAddressbookEntry">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="tab-container small-6 medium-3 large-2"
|
<div class="tab-container small-6 medium-3 large-2"
|
||||||
ng-class="{'selected':selectedWalletsOpt}"
|
ng-class="{'selected':selectedWalletsOpt}"
|
||||||
ng-style="{'border-color':selectedWalletsOpt ? color : 'inherit'}"
|
ng-style="{'border-color':selectedWalletsOpt ? color : 'inherit'}"
|
||||||
ng-click="selectedWalletsOpt = true">
|
ng-click="selectedWalletsOpt = true">
|
||||||
<a href
|
<a href
|
||||||
ng-style="{'color':selectedWalletsOpt ? color : 'inherit'}" translate> My wallets</a>
|
ng-style="{'color':selectedWalletsOpt ? color : 'inherit'}" translate> My wallets</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-container small-6 medium-3 large-2"
|
<div class="tab-container small-6 medium-3 large-2"
|
||||||
ng-class="{'selected':!selectedWalletsOpt}"
|
ng-class="{'selected':!selectedWalletsOpt}"
|
||||||
ng-style="{'border-color':!selectedWalletsOpt ? color : 'inherit'}"
|
ng-style="{'border-color':!selectedWalletsOpt ? color : 'inherit'}"
|
||||||
ng-click="selectedWalletsOpt = false">
|
ng-click="selectedWalletsOpt = false">
|
||||||
<a href
|
<a href
|
||||||
|
|
@ -58,16 +58,21 @@
|
||||||
<div ng-if="!gettingAddress">
|
<div ng-if="!gettingAddress">
|
||||||
<ul class="no-bullet">
|
<ul class="no-bullet">
|
||||||
<li class="line-b" ng-repeat="w in wallets">
|
<li class="line-b" ng-repeat="w in wallets">
|
||||||
<a ng-click="selectWallet(w.id, w.name)" class="db oh">
|
<a ng-click="selectWallet(w.id, w.name)" class="db oh">
|
||||||
<div class="avatar-wallet"
|
<div class="avatar-wallet"
|
||||||
ng-style="{'background-color':w.color}">
|
ng-style="{'background-color':w.color}">
|
||||||
<i class="icon-wallet size-21"></i>
|
<i class="icon-wallet size-21"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="ellipsis name-wallet text-bold">{{w.name || w.id}}</div>
|
<div class="ellipsis name-wallet text-bold">{{w.name || w.id}}
|
||||||
<div class="size-12">{{w.m}} of {{w.n}}
|
<span class="has-error right text-light size-12" ng-show="needsBackup[w.id]">
|
||||||
<span ng-show="w.network=='testnet'">[Testnet]</span>
|
<i class="icon-close-circle size-14"></i>
|
||||||
</div>
|
<span class="vm" translate>Needs backup</span>
|
||||||
</a>
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="size-12">{{w.m}} of {{w.n}}
|
||||||
|
<span ng-show="w.network=='testnet'">[Testnet]</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -76,25 +81,25 @@
|
||||||
<div ng-show="!selectedWalletsOpt" class="m20b">
|
<div ng-show="!selectedWalletsOpt" class="m20b">
|
||||||
<ul ng-show="!addAddressbookEntry" class="no-bullet m0" ng-init="list()">
|
<ul ng-show="!addAddressbookEntry" class="no-bullet m0" ng-init="list()">
|
||||||
<li class="p10 line-b" ng-repeat="(addr, label) in list">
|
<li class="p10 line-b" ng-repeat="(addr, label) in list">
|
||||||
<a ng-show="selectedAddressbook[addr]"
|
<a ng-show="selectedAddressbook[addr]"
|
||||||
class="removeAddressbook"
|
class="removeAddressbook"
|
||||||
ng-click="remove(addr)" translate>Remove</a>
|
ng-click="remove(addr)" translate>Remove</a>
|
||||||
<a class="selectAddressbook"
|
<a class="selectAddressbook"
|
||||||
ng-show="editAddressbook"
|
ng-show="editAddressbook"
|
||||||
ng-click="toggleSelectAddressbook(addr)">
|
ng-click="toggleSelectAddressbook(addr)">
|
||||||
<i class="fi-trash"></i></a>
|
<i class="fi-trash"></i></a>
|
||||||
<div ng-click="selectAddressbook(addr)">
|
<div ng-click="selectAddressbook(addr)">
|
||||||
|
|
||||||
<i class="icon-contact left size-42 m10r text-gray"></i>
|
<i class="icon-contact left size-42 m10r text-gray"></i>
|
||||||
<div class="">
|
<div class="">
|
||||||
<span>{{label}}</span>
|
<span>{{label}}</span>
|
||||||
<div class="size-12 text-gray ellipsis">{{addr}}</div>
|
<div class="size-12 text-gray ellipsis">{{addr}}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="p10" ng-show="!editAddressbook">
|
<li class="p10" ng-show="!editAddressbook">
|
||||||
<a ng-click="toggleAddAddressbookEntry()" class="p0i">
|
<a ng-click="toggleAddAddressbookEntry()" class="p0i">
|
||||||
<i class="fi-plus size-24 m20r lh icon"></i>
|
<i class="fi-plus size-24 m20r lh icon"></i>
|
||||||
<span class="size-12 tu text-bold" translate>Add a new entry</span>
|
<span class="size-12 tu text-bold" translate>Add a new entry</span>
|
||||||
<span class="size-10" ng-show="!list[newAddress] && newAddress">({{newAddress}})</span>
|
<span class="size-10" ng-show="!list[newAddress] && newAddress">({{newAddress}})</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -122,26 +127,26 @@
|
||||||
<qr-scanner on-scan="onQrCodeScanned(data, addressbookForm)" before-scan="beforeQrCodeScann()"></qr-scanner>
|
<qr-scanner on-scan="onQrCodeScanned(data, addressbookForm)" before-scan="beforeQrCodeScann()"></qr-scanner>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label translate>Label</label>
|
<label translate>Label</label>
|
||||||
<input type="text" id="label" name="label" ng-model="addressbook.label" required>
|
<input type="text" id="label" name="label" ng-model="addressbook.label" required>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="columns large-6 medium-6 small-6">
|
<div class="columns large-6 medium-6 small-6">
|
||||||
<input type="button"
|
<input type="button"
|
||||||
class="button expand outline dark-gray round"
|
class="button expand outline dark-gray round"
|
||||||
ng-click="newAddress = ''; toggleAddAddressbookEntry()"
|
ng-click="newAddress = ''; toggleAddAddressbookEntry()"
|
||||||
value="{{'Cancel'|translate}}">
|
value="{{'Cancel'|translate}}">
|
||||||
</div>
|
</div>
|
||||||
<div class="columns large-6 medium-6 small-6">
|
<div class="columns large-6 medium-6 small-6">
|
||||||
<input type="submit"
|
<input type="submit"
|
||||||
class="button expand round black"
|
class="button expand round black"
|
||||||
value="{{'Save'|translate}}"
|
value="{{'Save'|translate}}"
|
||||||
ng-disabled="!addressbookForm.$valid"
|
ng-disabled="!addressbookForm.$valid"
|
||||||
ng-click="newAddress = ''; add(addressbook)">
|
ng-click="newAddress = ''; add(addressbook)">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -420,11 +420,7 @@
|
||||||
<i class="icon-close-circle size-14"></i>
|
<i class="icon-close-circle size-14"></i>
|
||||||
<span class="vm" translate>Not valid</span>
|
<span class="vm" translate>Not valid</span>
|
||||||
</span>
|
</span>
|
||||||
<span class="has-error right size-12" ng-show="home.destinationWalletNeedsBackup">
|
<small class="right text-primary" ng-show="!sendForm.address.$invalid">
|
||||||
<i class="icon-close-circle size-14"></i>
|
|
||||||
<span class="vm" translate>Destination wallet needs backup</span>
|
|
||||||
</span>
|
|
||||||
<small class="right text-primary" ng-show="!sendForm.address.$invalid && !home.destinationWalletNeedsBackup">
|
|
||||||
<i class="icon-checkmark-circle size-14"></i>
|
<i class="icon-checkmark-circle size-14"></i>
|
||||||
</small>
|
</small>
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -508,7 +504,7 @@
|
||||||
<a fast-click callback-fn="home.resetForm(sendForm)" class="button expand outline dark-gray round" translate>Cancel</a>
|
<a fast-click callback-fn="home.resetForm(sendForm)" class="button expand outline dark-gray round" translate>Cancel</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="columns" ng-class="{'small-6 medium-6 large-6':(home._paypro || home.lockAddress || home.lockAmount)}">
|
<div class="columns" ng-class="{'small-6 medium-6 large-6':(home._paypro || home.lockAddress || home.lockAmount)}">
|
||||||
<button class="button black round expand" ng-disabled="sendForm.$invalid || home.blockUx || index.isOffline || home.destinationWalletNeedsBackup"
|
<button class="button black round expand" ng-disabled="sendForm.$invalid || home.blockUx || index.isOffline"
|
||||||
ng-style="{'background-color':index.backgroundColor}" fast-click callback-fn="home.submitForm()" translate>
|
ng-style="{'background-color':index.backgroundColor}" fast-click callback-fn="home.submitForm()" translate>
|
||||||
Send
|
Send
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
|
|
@ -603,10 +603,6 @@ ul.manage li {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.name-wallet i {
|
|
||||||
color: #B6E9DF;
|
|
||||||
}
|
|
||||||
|
|
||||||
.locked {
|
.locked {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: #7A8C9E;
|
color: #7A8C9E;
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
||||||
var confirm_msg = gettextCatalog.getString('Confirm');
|
var confirm_msg = gettextCatalog.getString('Confirm');
|
||||||
|
|
||||||
this.openDestinationAddressModal = function(wallets, address) {
|
this.openDestinationAddressModal = function(wallets, address) {
|
||||||
self.destinationWalletNeedsBackup = null;
|
|
||||||
$rootScope.modalOpened = true;
|
$rootScope.modalOpened = true;
|
||||||
var fc = profileService.focusedClient;
|
var fc = profileService.focusedClient;
|
||||||
self.lockAddress = false;
|
self.lockAddress = false;
|
||||||
|
|
@ -247,22 +246,26 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.selectWallet = function(walletId, walletName) {
|
$scope.selectWallet = function(walletId, walletName) {
|
||||||
$scope.gettingAddress = true;
|
profileService.isBackupNeeded(walletId, function(needsBackup) {
|
||||||
$scope.selectedWalletName = walletName;
|
$scope.needsBackup = {};
|
||||||
$timeout(function() {
|
$scope.needsBackup[walletId] = needsBackup;
|
||||||
$scope.$apply();
|
if (needsBackup) return;
|
||||||
});
|
|
||||||
addressService.getAddress(walletId, false, function(err, addr) {
|
|
||||||
$scope.gettingAddress = false;
|
|
||||||
|
|
||||||
if (err) {
|
$scope.gettingAddress = true;
|
||||||
self.error = err;
|
$scope.selectedWalletName = walletName;
|
||||||
$modalInstance.dismiss('cancel');
|
$timeout(function() {
|
||||||
return;
|
$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);
|
$modalInstance.close(addr);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -859,7 +862,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
||||||
};
|
};
|
||||||
|
|
||||||
this.submitForm = function() {
|
this.submitForm = function() {
|
||||||
if (!$scope._amount || !$scope._address || self.destinationWalletNeedsBackup) return;
|
if (!$scope._amount || !$scope._address) return;
|
||||||
var fc = profileService.focusedClient;
|
var fc = profileService.focusedClient;
|
||||||
var unitToSat = this.unitToSatoshi;
|
var unitToSat = this.unitToSatoshi;
|
||||||
var currentSpendUnconfirmed = configWallet.spendUnconfirmed;
|
var currentSpendUnconfirmed = configWallet.spendUnconfirmed;
|
||||||
|
|
@ -991,7 +994,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
||||||
|
|
||||||
this.resetForm = function() {
|
this.resetForm = function() {
|
||||||
this.resetError();
|
this.resetError();
|
||||||
this.destinationWalletNeedsBackup = null;
|
|
||||||
this._paypro = null;
|
this._paypro = null;
|
||||||
this.lockedCurrentFeePerKb = 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) {
|
root._seedWallet = function(opts, cb) {
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
if (opts.bwsurl)
|
if (opts.bwsurl)
|
||||||
|
|
@ -306,8 +294,8 @@ angular.module('copayApp.services')
|
||||||
|
|
||||||
// check if exist
|
// check if exist
|
||||||
if (lodash.find(root.profile.credentials, {
|
if (lodash.find(root.profile.credentials, {
|
||||||
'walletId': walletData.walletId
|
'walletId': walletData.walletId
|
||||||
})) {
|
})) {
|
||||||
return cb(gettext('Cannot join the same wallet more that once'));
|
return cb(gettext('Cannot join the same wallet more that once'));
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} 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) {
|
root.getWallets = function(network) {
|
||||||
if (!root.profile) return [];
|
if (!root.profile) return [];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue