Share a custom amount

This commit is contained in:
Gustavo Maximiliano Cortez 2017-05-24 16:24:52 -03:00
commit acbfb87f45
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
3 changed files with 36 additions and 4 deletions

View file

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

View file

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