Share a custom amount

This commit is contained in:
Gustavo Maximiliano Cortez 2017-05-24 16:24:52 -03:00
parent aae4b41619
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;

View File

@ -1,11 +1,20 @@
<ion-view id="custom-amount" hide-tabs>
<ion-nav-bar class="bar-royal">
<ion-nav-buttons side="primary">
<button class="button back-button button-clear" ng-click="close()" translate>
Close
</button>
</ion-nav-buttons>
<ion-nav-title>
{{'Custom Amount' | translate}}
</ion-nav-title>
<ion-nav-buttons side="secondary">
<button class="button no-border" ng-click="close()" translate>
Close
<button class="button-share ng-hide" ng-show="showShareButton" ng-click="shareAddress()">
<i class="icon"
ng-class="{
'ion-ios-upload-outline': showShareButton == 'iOS',
'ion-android-share-alt': showShareButton != 'iOS'
}"></i>
</button>
</ion-nav-buttons>
</ion-nav-bar>
@ -15,7 +24,7 @@
<qrcode size="220" data="bitcoin:{{address + '?amount=' + amountBtc}}" color="#334"></qrcode>
</div>
<div class="info">
<div class="item single-line">
<div class="item single-line" copy-to-clipboard="address">
<span class="label" translate>Address</span>
<span class="item-note ellipsis">
{{address}}