mirror of https://github.com/BTCPrivate/copay.git
copy address to clipboard on mobile
This commit is contained in:
parent
b2ddca4569
commit
608fed4386
|
@ -1,17 +1,20 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('ReceiveController',
|
||||
function($scope, $rootScope, $timeout, $modal) {
|
||||
function($scope, $rootScope, $timeout, $modal, isCordova) {
|
||||
|
||||
$scope.newAddr = function() {
|
||||
var w = $rootScope.wallet;
|
||||
$scope.loading = true;
|
||||
var lastAddr = w.generateAddress(null);
|
||||
$scope.setAddressList();
|
||||
$scope.addr = lastAddr;
|
||||
$timeout(function() {
|
||||
$scope.loading = false;
|
||||
}, 1);
|
||||
};
|
||||
|
||||
$scope.copyAddress = function(addr) {
|
||||
if (isCordova) {
|
||||
window.cordova.plugins.clipboard.copy(addr);
|
||||
window.plugins.toast.showShortCenter('Copied to clipboard');
|
||||
}
|
||||
};
|
||||
|
||||
$scope.init = function() {
|
||||
|
@ -32,8 +35,13 @@ angular.module('copayApp.controllers').controller('ReceiveController',
|
|||
};
|
||||
|
||||
$scope.openAddressModal = function(address) {
|
||||
var scope = $scope;
|
||||
var ModalInstanceCtrl = function($scope, $modalInstance, address) {
|
||||
$scope.address = address;
|
||||
$scope.isCordova = isCordova;
|
||||
$scope.copyAddress = function(addr) {
|
||||
scope.copyAddress(addr);
|
||||
};
|
||||
|
||||
$scope.cancel = function() {
|
||||
$modalInstance.dismiss('cancel');
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
<div class="text-center m20t">
|
||||
<qrcode size="220" data="{{address.address}}"></qrcode>
|
||||
<div class="text-center m20t" ng-init="addr = address.address">
|
||||
<qrcode size="220" data="{{addr}}"></qrcode>
|
||||
|
||||
<div class="m10t" ng-init="label = $root.wallet.addressBook[address.address].label">
|
||||
<div class="m10t"
|
||||
ng-init="label = $root.wallet.addressBook[addr].label">
|
||||
<div class="size-12">
|
||||
{{address.address}} <small class="label" ng-show="address.isChange">change</small>
|
||||
{{addr}} <small class="label" ng-show="address.isChange">change</small>
|
||||
</div>
|
||||
<b class="db m5t" ng-show="label">
|
||||
({{label}})
|
||||
</b>
|
||||
</div>
|
||||
<div class="text-center m10t" ng-if="isCordova">
|
||||
<button class="primary expand" ng-click="copyAddress(addr)">
|
||||
Copy to clipboard
|
||||
</button>
|
||||
</div>
|
||||
<a class="close-reveal-modal" ng-click="cancel()"><i class="fi-x size-18"></i></a>
|
||||
</div>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<div class="large-12 columns">
|
||||
<div class="panel">
|
||||
<h2 class="line-b" translate>My Bitcoin address:</h2>
|
||||
<div class="text-center">
|
||||
<div class="text-center" ng-click="copyAddress(addr)">
|
||||
<qrcode size="220" data="bitcoin:{{addr}}"></qrcode>
|
||||
<div class="m10t">
|
||||
<h4 class="size-12">{{addr}}</h4>
|
||||
|
|
Loading…
Reference in New Issue