mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #1727 from matiaspando/feature/selectWalletOnBIP21
Feature/select wallet on bip21
This commit is contained in:
commit
b2aef7c7db
|
@ -2,13 +2,9 @@
|
|||
|
||||
angular.module('copayApp.controllers').controller('HomeWalletController',
|
||||
function($scope, $rootScope, $timeout, $modal, controllerUtils) {
|
||||
|
||||
controllerUtils.redirIfNotComplete();
|
||||
|
||||
$rootScope.title = 'Home';
|
||||
|
||||
if ($rootScope.addrInfos) {
|
||||
$scope.address = $rootScope.addrInfos[0];
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
var bitcore = require('bitcore');
|
||||
|
||||
angular.module('copayApp.controllers').controller('PaymentIntentController', function($rootScope, $scope, $modal, controllerUtils) {
|
||||
angular.module('copayApp.controllers').controller('PaymentIntentController', function($rootScope, $scope, $modal, $location, controllerUtils) {
|
||||
|
||||
$scope.wallets = [];
|
||||
|
||||
|
@ -10,7 +10,13 @@ angular.module('copayApp.controllers').controller('PaymentIntentController', fun
|
|||
_.each(wids, function(wid) {
|
||||
var w = $rootScope.iden.getWalletById(wid);
|
||||
if (w && w.isReady()) {
|
||||
|
||||
$scope.wallets.push(w);
|
||||
controllerUtils.clearBalanceCache(w);
|
||||
controllerUtils.updateBalance(w, function() {
|
||||
$rootScope.$digest();
|
||||
}, true);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -24,10 +30,6 @@ angular.module('copayApp.controllers').controller('PaymentIntentController', fun
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
modalInstance.result.then(function(selectedItem) {}, function() {
|
||||
$rootScope.pendingPayment = null;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
@ -35,16 +37,16 @@ angular.module('copayApp.controllers').controller('PaymentIntentController', fun
|
|||
// It is not the same as the $modal service used above.
|
||||
|
||||
var ModalInstanceCtrl = function($scope, $modalInstance, items, controllerUtils) {
|
||||
|
||||
$scope.wallets = items;
|
||||
|
||||
$scope.ok = function(selectedItem) {
|
||||
controllerUtils.setPaymentWallet(selectedItem);
|
||||
$modalInstance.close();
|
||||
};
|
||||
|
||||
$scope.cancel = function() {
|
||||
$modalInstance.dismiss('cancel');
|
||||
$rootScope.pendingPayment = null;
|
||||
$location.path('/');
|
||||
$modalInstance.close();
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -289,13 +289,13 @@ angular.module('copayApp.services')
|
|||
if (cb) return cb();
|
||||
};
|
||||
|
||||
root.updateBalance = function(w, cb) {
|
||||
root.updateBalance = function(w, cb, refreshAll) {
|
||||
w = w || $rootScope.wallet;
|
||||
if (!w) return root.onErrorDigest();
|
||||
if (!w.isReady()) return;
|
||||
|
||||
w.balanceInfo = {};
|
||||
var scope = root.isFocusedWallet(w.id) ? $rootScope : w.balanceInfo;
|
||||
var scope = root.isFocusedWallet(w.id) && !refreshAll ? $rootScope : w.balanceInfo;
|
||||
|
||||
root.updateAddressList();
|
||||
|
||||
|
@ -303,7 +303,7 @@ angular.module('copayApp.services')
|
|||
|
||||
if (_balanceCache[wid]) {
|
||||
root._updateScope(w, _balanceCache[wid], scope, function() {
|
||||
if (root.isFocusedWallet(w.id)) {
|
||||
if (root.isFocusedWallet(w.id) && !refreshAll) {
|
||||
setTimeout(function() {
|
||||
$rootScope.$digest();
|
||||
}, 1);
|
||||
|
|
|
@ -37,15 +37,15 @@
|
|||
<div class="panel oh">
|
||||
<h2 class="line-b" translate>Quick receive</h2>
|
||||
<div class="text-center">
|
||||
<qrcode size="220" data="bitcoin:{{address.addressStr}}"></qrcode>
|
||||
<qrcode size="220" data="bitcoin:{{$root.addrInfos[0].addressStr}}"></qrcode>
|
||||
|
||||
<div class="m10t">
|
||||
<h4 class="size-12">{{address.addressStr}} <span class="btn-copy" clip-copy="address.addressStr"></span></h4>
|
||||
<h4 class="size-12">{{$root.addrInfos[0].addressStr}} <span class="btn-copy" clip-copy="$root.addrInfos[0].addressStr"></span></h4>
|
||||
<span ng-if="$root.updatingBalance">
|
||||
<i class="fi-bitcoin-circle icon-rotate spinner"></i>
|
||||
</span>
|
||||
<div class="small-10 columns small-centered">
|
||||
<button class="m15t button secondary hide-for-large-up" ng-show="isMobile" ng-click="mobileCopy(address.addressStr)">
|
||||
<button class="m15t button secondary hide-for-large-up" ng-show="isMobile" ng-click="mobileCopy($root.addrInfos[0].addressStr)">
|
||||
<i class="fi-link"> </i> <span translate>Copy to clipboard</span>
|
||||
</button>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue