Merge pull request #1727 from matiaspando/feature/selectWalletOnBIP21
Feature/select wallet on bip21
This commit is contained in:
commit
b2aef7c7db
4 changed files with 17 additions and 19 deletions
|
|
@ -2,13 +2,9 @@
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('HomeWalletController',
|
angular.module('copayApp.controllers').controller('HomeWalletController',
|
||||||
function($scope, $rootScope, $timeout, $modal, controllerUtils) {
|
function($scope, $rootScope, $timeout, $modal, controllerUtils) {
|
||||||
|
|
||||||
controllerUtils.redirIfNotComplete();
|
controllerUtils.redirIfNotComplete();
|
||||||
|
|
||||||
$rootScope.title = 'Home';
|
$rootScope.title = 'Home';
|
||||||
|
|
||||||
if ($rootScope.addrInfos) {
|
|
||||||
$scope.address = $rootScope.addrInfos[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
var bitcore = require('bitcore');
|
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 = [];
|
$scope.wallets = [];
|
||||||
|
|
||||||
|
|
@ -10,7 +10,13 @@ angular.module('copayApp.controllers').controller('PaymentIntentController', fun
|
||||||
_.each(wids, function(wid) {
|
_.each(wids, function(wid) {
|
||||||
var w = $rootScope.iden.getWalletById(wid);
|
var w = $rootScope.iden.getWalletById(wid);
|
||||||
if (w && w.isReady()) {
|
if (w && w.isReady()) {
|
||||||
|
|
||||||
$scope.wallets.push(w);
|
$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.
|
// It is not the same as the $modal service used above.
|
||||||
|
|
||||||
var ModalInstanceCtrl = function($scope, $modalInstance, items, controllerUtils) {
|
var ModalInstanceCtrl = function($scope, $modalInstance, items, controllerUtils) {
|
||||||
|
|
||||||
$scope.wallets = items;
|
$scope.wallets = items;
|
||||||
|
|
||||||
$scope.ok = function(selectedItem) {
|
$scope.ok = function(selectedItem) {
|
||||||
controllerUtils.setPaymentWallet(selectedItem);
|
controllerUtils.setPaymentWallet(selectedItem);
|
||||||
$modalInstance.close();
|
$modalInstance.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.cancel = function() {
|
$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();
|
if (cb) return cb();
|
||||||
};
|
};
|
||||||
|
|
||||||
root.updateBalance = function(w, cb) {
|
root.updateBalance = function(w, cb, refreshAll) {
|
||||||
w = w || $rootScope.wallet;
|
w = w || $rootScope.wallet;
|
||||||
if (!w) return root.onErrorDigest();
|
if (!w) return root.onErrorDigest();
|
||||||
if (!w.isReady()) return;
|
if (!w.isReady()) return;
|
||||||
|
|
||||||
w.balanceInfo = {};
|
w.balanceInfo = {};
|
||||||
var scope = root.isFocusedWallet(w.id) ? $rootScope : w.balanceInfo;
|
var scope = root.isFocusedWallet(w.id) && !refreshAll ? $rootScope : w.balanceInfo;
|
||||||
|
|
||||||
root.updateAddressList();
|
root.updateAddressList();
|
||||||
|
|
||||||
|
|
@ -303,7 +303,7 @@ angular.module('copayApp.services')
|
||||||
|
|
||||||
if (_balanceCache[wid]) {
|
if (_balanceCache[wid]) {
|
||||||
root._updateScope(w, _balanceCache[wid], scope, function() {
|
root._updateScope(w, _balanceCache[wid], scope, function() {
|
||||||
if (root.isFocusedWallet(w.id)) {
|
if (root.isFocusedWallet(w.id) && !refreshAll) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
|
||||||
|
|
@ -37,15 +37,15 @@
|
||||||
<div class="panel oh">
|
<div class="panel oh">
|
||||||
<h2 class="line-b" translate>Quick receive</h2>
|
<h2 class="line-b" translate>Quick receive</h2>
|
||||||
<div class="text-center">
|
<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">
|
<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">
|
<span ng-if="$root.updatingBalance">
|
||||||
<i class="fi-bitcoin-circle icon-rotate spinner"></i>
|
<i class="fi-bitcoin-circle icon-rotate spinner"></i>
|
||||||
</span>
|
</span>
|
||||||
<div class="small-10 columns small-centered">
|
<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>
|
<i class="fi-link"> </i> <span translate>Copy to clipboard</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue