From acbfb87f457f49c98795f1d554c746de057d8901 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Wed, 24 May 2017 16:24:52 -0300 Subject: [PATCH] Share a custom amount --- src/js/controllers/customAmount.js | 10 +++++++++- src/sass/views/custom-amount.scss | 15 +++++++++++++++ www/views/customAmount.html | 15 ++++++++++++--- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/js/controllers/customAmount.js b/src/js/controllers/customAmount.js index b3040977e..9a2b46f6c 100644 --- a/src/js/controllers/customAmount.js +++ b/src/js/controllers/customAmount.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('customAmountController', function($rootScope, $scope, $stateParams, $ionicHistory, txFormatService, platformInfo, configService, profileService, walletService, popupService) { +angular.module('copayApp.controllers').controller('customAmountController', function($scope, $ionicHistory, txFormatService, platformInfo, configService, profileService, walletService, popupService) { var showErrorAndBack = function(title, msg) { popupService.showAlert(title, msg, function() { @@ -15,6 +15,8 @@ angular.module('copayApp.controllers').controller('customAmountController', func showErrorAndBack('Error', 'No wallet selected'); return; } + + $scope.showShareButton = platformInfo.isCordova ? (platformInfo.isIOS ? 'iOS' : 'Android') : null; $scope.wallet = profileService.getWallet(walletId); @@ -57,6 +59,12 @@ angular.module('copayApp.controllers').controller('customAmountController', func $ionicHistory.goBack(-2); }; + $scope.shareAddress = function() { + if (!platformInfo.isCordova) return; + var data = 'bitcoin:' + $scope.address + '?amount=' + $scope.amountBtc; + window.plugins.socialsharing.share(data, null, null, null); + } + $scope.copyToClipboard = function() { return 'bitcoin:' + $scope.address + '?amount=' + $scope.amountBtc; }; diff --git a/src/sass/views/custom-amount.scss b/src/sass/views/custom-amount.scss index 245734a09..3576e56a0 100644 --- a/src/sass/views/custom-amount.scss +++ b/src/sass/views/custom-amount.scss @@ -3,6 +3,16 @@ $item-lateral-padding: 20px; $item-vertical-padding: 10px; $item-label-color: #6C6C6E; + .button-share { + color: #fff; + box-shadow: none; + border-color: transparent; + background: transparent; + padding: 0 10px; + .icon:before { + font-size: 26px; + } + } .address { background: #fff; overflow: auto; @@ -39,6 +49,11 @@ padding-right: $item-lateral-padding; } + .item-note { + width: 75%; + text-align: right; + } + .label { font-size: 14px; color: $item-label-color; diff --git a/www/views/customAmount.html b/www/views/customAmount.html index 3aead822c..902671d63 100644 --- a/www/views/customAmount.html +++ b/www/views/customAmount.html @@ -1,11 +1,20 @@ + + + {{'Custom Amount' | translate}} - @@ -15,7 +24,7 @@
-
+
Address {{address}}