More copy and share for mobile

This commit is contained in:
Gustavo Maximiliano Cortez 2015-02-06 13:23:10 -03:00
parent 04fe842b61
commit 79db8cea2e
11 changed files with 69 additions and 26 deletions

View File

@ -1,12 +1,13 @@
'use strict';
angular.module('copayApp.controllers').controller('CopayersController',
function($scope, $rootScope, $timeout, go, identityService, notification) {
function($scope, $rootScope, $timeout, go, identityService, notification, isCordova) {
var w = $rootScope.wallet;
$scope.init = function() {
$rootScope.title = 'Share this secret with your copayers';
$scope.loading = false;
$scope.secret = $rootScope.wallet.getSecret();
$scope.isCordova = isCordova;
w.on('publicKeyRingUpdated', $scope.updateList);
w.on('ready', $scope.updateList);
@ -48,4 +49,20 @@ angular.module('copayApp.controllers').controller('CopayersController',
});
};
$scope.copySecret = function(secret) {
if (isCordova) {
window.cordova.plugins.clipboard.copy(secret);
window.plugins.toast.showShortCenter('Copied to clipboard');
}
};
$scope.shareSecret = function(secret) {
if (isCordova) {
if (isMobile.Android() || isMobile.Windows()) {
window.ignoreMobilePause = true;
}
window.plugins.socialsharing.share(secret, null, null, null);
}
};
});

View File

@ -137,6 +137,13 @@ angular.module('copayApp.controllers').controller('MoreController',
});
};
$scope.copyText = function(text) {
if (isCordova) {
window.cordova.plugins.clipboard.copy(text);
window.plugins.toast.showShortCenter('Copied to clipboard');
}
};
$scope.downloadWalletBackup = function() {
backupService.walletDownload(w);
};

View File

@ -10,21 +10,28 @@
<div ng-if="!$root.wallet.isComplete()">
<div class="panel oh">
<div class="box-notification">
<div class="box-icon error">
<i class="fi-alert size-24"></i>
<div class="box-notification">
<div class="box-icon error">
<i class="fi-alert size-24"></i>
</div>
<span class="text-warning size-14">
Please note the wallet creator <b>must be online</b> until all copayers have joined.
</span>
</div>
<span class="text-warning size-14">
Please note the wallet creator <b>must be online</b> until all copayers have joined.
</span>
</div>
<div class="text-center">
<qrcode size="250" data="{{secret}}"></qrcode>
<div ng-click="copySecret(secret)">
<div class="text-center">
<qrcode size="250" data="{{secret}}"></qrcode>
</div>
<div class="secret m10t">
{{secret}}
</div>
</div>
<div class="secret m10v">
{{secret}}
<div class="text-center m10t" ng-if="isCordova">
<span class="button outline dark-gray tiny"
ng-click="shareSecret(secret)">
<i class="fi-share"></i> Share secret
</span>
</div>
<div class="size-10 line-t text-center">
<h2 class="m10t">{{$root.wallet.getName()}}</h2>
@ -32,7 +39,7 @@
[{{$root.wallet.requiredCopayers}} of {{$root.wallet.totalCopayers}} ]
</span>
<span ng-if="$root.wallet.isTestnet()"> in TESTNET</span>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,5 +1,5 @@
<nav class="tab-bar text-right hide-for-large-up">
<a ng-click="close()" class="p10 text-white">Close</a>
<span ng-click="close()" class="p10 text-white">Close</span>
</nav>
<div class="row modal-mobile">
<div class="large-12 columns">

View File

@ -1,5 +1,5 @@
<nav class="tab-bar text-right hide-for-large-up">
<a ng-click="cancel()" class="p10 text-white">Close</a>
<span ng-click="cancel()" class="p10 text-white">Close</span>
</nav>
<div class="modal-mobile">
<div class="text-center">

View File

@ -1,5 +1,5 @@
<nav class="tab-bar text-right hide-for-large-up">
<a ng-click="cancel()" class="p10 text-white">Close</a>
<span ng-click="cancel()" class="p10 text-white">Close</span>
</nav>
<div class="modal-mobile text-center" ng-init="addr = address.address">
<qrcode size="220" data="{{addr}}"></qrcode>
@ -15,7 +15,7 @@
</div>
<div class="text-center m10t" ng-if="isCordova">
<button class="primary expand" ng-click="copyAddress(addr)">
Copy to clipboard
<i class="fi-clipboard-pencil"></i> Copy to clipboard
</button>
</div>
<a class="close-reveal-modal show-for-large-up" ng-click="cancel()"><i class="fi-x size-18"></i></a>

View File

@ -1,5 +1,5 @@
<nav class="tab-bar text-right hide-for-large-up">
<a ng-click="cancel()" class="p10 text-white">Close</a>
<span ng-click="cancel()" class="p10 text-white">Close</span>
</nav>
<div class="modal-mobile">
<div class="header-modal text-center">

View File

@ -1,5 +1,5 @@
<nav class="tab-bar text-right hide-for-large-up">
<a ng-click="cancel()" class="p10 text-white">Close</a>
<span ng-click="cancel()" class="p10 text-white">Close</span>
</nav>
<div class="modal-mobile">
<div class="header-modal">

View File

@ -1,5 +1,5 @@
<nav class="tab-bar text-right hide-for-large-up">
<a ng-click="cancel()" class="p10 text-white">Close</a>
<span ng-click="cancel()" class="p10 text-white">Close</span>
</nav>
<div class="modal-mobile" ng-init="setWallets()">

View File

@ -145,7 +145,13 @@
<span translate ng-hide="!hidePriv">Show</span>
<span translate ng-hide="hidePriv">Hide</span>
</a>
<textarea class="m10t" ng-hide="hidePriv">{{priv}}</textarea>
<div class="m10t" ng-hide="hidePriv">
<textarea>{{priv}}</textarea>
<span ng-if="isCordova" class="button outline dark-gray tiny"
ng-click="copyText(priv)">
<i class="fi-clipboard-pencil"></i> Copy to clipboard
</span>
</div>
</div>
</div>
<div class="large-12 columns">
@ -193,7 +199,13 @@
<span translate ng-hide="!hideSecret">Show</span>
<span translate ng-hide="hideSecret">Hide</span>
</a>
<textarea class="m10t" ng-hide="hideSecret">{{secret}}</textarea>
<div class="m10t" ng-hide="hideSecret">
<textarea>{{secret}}</textarea>
<span ng-if="isCordova" class="button outline dark-gray tiny"
ng-click="copyText(secret)">
<i class="fi-clipboard-pencil"></i> Copy to clipboard
</span>
</div>
</div>
</div>
</div>

View File

@ -17,12 +17,12 @@
</div>
</div>
<div class="m10t text-center" ng-show="isCordova">
<a href class="button-setup"
<span class="button outline dark-gray tiny"
ng-click="shareAddress(addr)">
<i class="fi-share"></i> Share address
</a>
</span>
</div>
<div class="line-t m10t size-12">
<div class="line-t size-12">
Share this with anyone to have them send you payments. To protect your privacy, new addresses are generated automatically once you use them.
</div>
</div>