mirror of https://github.com/BTCPrivate/copay.git
Share a custom amount
This commit is contained in:
parent
aae4b41619
commit
acbfb87f45
|
@ -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() {
|
||||
|
@ -16,6 +16,8 @@ angular.module('copayApp.controllers').controller('customAmountController', func
|
|||
return;
|
||||
}
|
||||
|
||||
$scope.showShareButton = platformInfo.isCordova ? (platformInfo.isIOS ? 'iOS' : 'Android') : null;
|
||||
|
||||
$scope.wallet = profileService.getWallet(walletId);
|
||||
|
||||
walletService.getAddress($scope.wallet, false, function(err, addr) {
|
||||
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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}}
|
||||
|
|
Loading…
Reference in New Issue