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 @@