mv addr to walletData
This commit is contained in:
parent
1fba333a7c
commit
13996dc26a
3 changed files with 33 additions and 13 deletions
|
|
@ -25,10 +25,10 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
this.blockUx = false;
|
||||
this.isRateAvailable = false;
|
||||
this.showScanner = false;
|
||||
this.addr = {};
|
||||
this.lockedCurrentFeePerKb = null;
|
||||
this.paymentExpired = false;
|
||||
|
||||
|
||||
var disableScannerListener = $rootScope.$on('dataScanned', function(event, data) {
|
||||
self.setForm(data);
|
||||
$rootScope.$emit('Local/SetTab', 'send');
|
||||
|
|
@ -52,7 +52,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
});
|
||||
|
||||
var disableFocusListener = $rootScope.$on('Local/NewFocusedWallet', function() {
|
||||
self.addr = {};
|
||||
self.resetForm();
|
||||
});
|
||||
|
||||
|
|
@ -88,6 +87,26 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
$rootScope.shouldHideMenuBar = false;
|
||||
});
|
||||
|
||||
|
||||
this.walletData = {};
|
||||
this.getWalletData = function(key) {
|
||||
var fc = profileService.focusedClient;
|
||||
if (!fc) return;
|
||||
if (!this.walletData[fc.credentials.walletId]) return;
|
||||
|
||||
return this.walletData[fc.credentials.walletId][key];
|
||||
};
|
||||
|
||||
this.setWalletData = function(key,val) {
|
||||
var fc = profileService.focusedClient;
|
||||
if (!fc) return;
|
||||
if (!this.walletData[fc.credentials.walletId] )
|
||||
this.walletData[fc.credentials.walletId] = {};
|
||||
|
||||
this.walletData[fc.credentials.walletId][key] = val;
|
||||
};
|
||||
|
||||
|
||||
this.onQrCodeScanned = function(data) {
|
||||
if (data) go.send();
|
||||
$rootScope.$emit('dataScanned', data);
|
||||
|
|
@ -510,7 +529,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
return;
|
||||
|
||||
// Address already set?
|
||||
if (!forceNew && self.addr[fc.credentials.walletId]) {
|
||||
if (!forceNew && self.getWalletData('addr')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -523,7 +542,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
self.addrError = err;
|
||||
} else {
|
||||
if (addr)
|
||||
self.addr[fc.credentials.walletId] = addr;
|
||||
self.setWalletData('addr',addr);;
|
||||
}
|
||||
|
||||
$scope.$digest();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue