Wallet information: enables copy to clipboard on mobile

This commit is contained in:
Gustavo Maximiliano Cortez 2016-07-11 18:06:43 -03:00
parent 87644b92c6
commit ebb62824e2
No known key found for this signature in database
GPG Key ID: 15EDAD8D9F2EB1AF
2 changed files with 14 additions and 6 deletions

View File

@ -22,7 +22,7 @@
</span>
</li>
<li class="line-b p20 oh">
<li class="line-b p20 oh" ng-click="copyToClipboard(walletId)">
<span translate>Wallet Id</span>
<span class="right text-gray enable_text_select">
{{walletId}}
@ -89,7 +89,7 @@
</li>
<h4 class="title m0" translate>Extended Public Keys</h4>
<li ng-repeat="pk in pubKeys">
<li ng-repeat="pk in pubKeys" ng-click="copyToClipboard(pk)">
<div class="row collapse">
<div class="small-4 columns">Copayer {{$index}}</div>
<div class="small-8 columns oh text-gray">
@ -105,7 +105,7 @@
<div ng-show="addrs">
<h4 class="title m0" translate>Last Wallet Addresses</h4>
<ul class="no-bullet m0">
<li ng-repeat="a in addrs" class="oh">
<li ng-repeat="a in addrs" class="oh" ng-click="copyToClipboard(a.address)">
<div class="enable_text_select ellipsis">
{{a.address}}
</div>
@ -131,7 +131,7 @@
<ul class="no-bullet m0 size-14" ng-show="index.balanceByAddress">
<div ng-if="index.balanceByAddress[0]">
<h4 class="title m0" translate>Balance By Address</h4>
<li class="line-b p20 oh" ng-repeat="a in index.balanceByAddress">
<li class="line-b p20 oh" ng-repeat="a in index.balanceByAddress" ng-click="copyToClipboard(a.address)">
<div class="enable_text_select ellipsis">
{{a.address}}
</div>

View File

@ -1,13 +1,14 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesInformation',
function($scope, $log, $timeout, platformInfo, gettextCatalog, lodash, profileService, storageService, configService, go, bitcore) {
function($scope, $log, $timeout, platformInfo, gettextCatalog, lodash, profileService, configService, go) {
var base = 'xpub';
var fc = profileService.focusedClient;
var c = fc.credentials;
var walletId = c.walletId;
var config = configService.getSync();
var b = 1;
var isCordova = platformInfo.isCordova;
config.colorFor = config.colorFor || {};
$scope.init = function() {
@ -109,6 +110,13 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
if (b != 5) return b++;
save('#202020');
}
};
$scope.copyToClipboard = function(data) {
if (isCordova) {
window.cordova.plugins.clipboard.copy(data);
window.plugins.toast.showShortCenter(gettextCatalog.getString('Copied to clipboard'));
}
};
});