From 79db8cea2eda78938a37e82a1a1dcdf2ba3e1647 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Fri, 6 Feb 2015 13:23:10 -0300 Subject: [PATCH] More copy and share for mobile --- js/controllers/copayers.js | 19 +++++++++++++++++- js/controllers/more.js | 7 +++++++ views/copayers.html | 33 +++++++++++++++++++------------ views/modals/address-book.html | 2 +- views/modals/paypro.html | 2 +- views/modals/qr-address.html | 4 ++-- views/modals/tx-details.html | 2 +- views/modals/txp-details.html | 2 +- views/modals/walletSelection.html | 2 +- views/more.html | 16 +++++++++++++-- views/receive.html | 6 +++--- 11 files changed, 69 insertions(+), 26 deletions(-) diff --git a/js/controllers/copayers.js b/js/controllers/copayers.js index c424741a8..91d3ecd14 100644 --- a/js/controllers/copayers.js +++ b/js/controllers/copayers.js @@ -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); + } + }; + }); diff --git a/js/controllers/more.js b/js/controllers/more.js index ec3b81c3c..dd633372f 100644 --- a/js/controllers/more.js +++ b/js/controllers/more.js @@ -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); }; diff --git a/views/copayers.html b/views/copayers.html index d499f210d..1c02af7ee 100644 --- a/views/copayers.html +++ b/views/copayers.html @@ -10,21 +10,28 @@
-
-
- +
+
+ +
+ + Please note the wallet creator must be online until all copayers have joined. +
- - Please note the wallet creator must be online until all copayers have joined. - -
- -
- +
+
+ +
+
+ {{secret}} +
-
- {{secret}} +
+ + Share secret +

{{$root.wallet.getName()}}

@@ -32,7 +39,7 @@ [{{$root.wallet.requiredCopayers}} of {{$root.wallet.totalCopayers}} ] in TESTNET -
+
diff --git a/views/modals/address-book.html b/views/modals/address-book.html index 819cd6623..bb733ddb5 100644 --- a/views/modals/address-book.html +++ b/views/modals/address-book.html @@ -1,5 +1,5 @@