Get protocol handler from walletService
This commit is contained in:
parent
34fb28d389
commit
779d21e9e9
5 changed files with 18 additions and 2 deletions
|
|
@ -8,6 +8,10 @@ angular.module('copayApp.controllers').controller('customAmountController', func
|
|||
});
|
||||
};
|
||||
|
||||
var setProtocolHandler = function() {
|
||||
$scope.protocolHandler = walletService.getProtocolHandler($scope.wallet);
|
||||
}
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
var walletId = data.stateParams.id;
|
||||
|
||||
|
|
@ -20,6 +24,8 @@ angular.module('copayApp.controllers').controller('customAmountController', func
|
|||
|
||||
$scope.wallet = profileService.getWallet(walletId);
|
||||
|
||||
setProtocolHandler();
|
||||
|
||||
walletService.getAddress($scope.wallet, false, function(err, addr) {
|
||||
if (!addr) {
|
||||
showErrorAndBack('Error', 'Could not get the address');
|
||||
|
|
|
|||
|
|
@ -124,8 +124,13 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
return wallet;
|
||||
}
|
||||
|
||||
var setProtocolHandler = function() {
|
||||
$scope.protocolHandler = walletService.getProtocolHandler($scope.wallet);
|
||||
}
|
||||
|
||||
$scope.onWalletSelect = function(wallet) {
|
||||
$scope.wallet = wallet;
|
||||
setProtocolHandler();
|
||||
$scope.setAddress();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1232,5 +1232,10 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
});
|
||||
};
|
||||
|
||||
root.getProtocolHandler = function(wallet) {
|
||||
if (wallet.coin== 'bch') return 'bitcoincash';
|
||||
else return 'bitcoin';
|
||||
}
|
||||
|
||||
return root;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<ion-content scroll="false">
|
||||
<div class="address" ng-if="address && amountBtc">
|
||||
<div class="qr-code" copy-to-clipboard="copyToClipboard()">
|
||||
<qrcode size="220" data="bitcoin{{ wallet.coin == 'bch' ? 'cash' : '' }}:{{address + '?amount=' + amountBtc}}" color="#334"></qrcode>
|
||||
<qrcode size="220" data="{{ protocolHandler }}:{{address + '?amount=' + amountBtc}}" color="#334"></qrcode>
|
||||
</div>
|
||||
<div class="info">
|
||||
<div class="item single-line" copy-to-clipboard="address">
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
<span translate>Show address</span>
|
||||
</button>
|
||||
</span>
|
||||
<qrcode ng-if="addr" size="220" data="bitcoin{{ wallet.coin == 'bch' ? 'cash' : ''}}:{{addr}}" color="#334"></qrcode>
|
||||
<qrcode ng-if="addr" size="220" data="{{ protocolHandler }}:{{addr}}" color="#334"></qrcode>
|
||||
<div class="address-label">
|
||||
<span class="ellipsis">{{addr}}</span>
|
||||
<ion-spinner ng-show="!addr" class="spinner-dark" icon="crescent"></ion-spinner>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue