mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #6107 from cmgustavo/ref/tab-receive-01
Ref/tab receive 01
This commit is contained in:
commit
b61944a510
|
@ -1,8 +1,9 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('copayersController',
|
angular.module('copayApp.controllers').controller('copayersController',
|
||||||
function($scope, $log, $timeout, $stateParams, $state, $rootScope, $ionicHistory, appConfigService, lodash, profileService, walletService, popupService, bwcError, platformInfo, gettextCatalog, ongoingProcess) {
|
function($scope, $log, $timeout, $stateParams, $state, $rootScope, $ionicHistory, appConfigService, lodash, profileService, walletService, popupService, bwcError, platformInfo, gettextCatalog, ongoingProcess, pushNotificationsService) {
|
||||||
|
|
||||||
|
var listener;
|
||||||
var appName = appConfigService.userVisibleName;
|
var appName = appConfigService.userVisibleName;
|
||||||
var appUrl = appConfigService.url;
|
var appUrl = appConfigService.url;
|
||||||
|
|
||||||
|
@ -10,13 +11,15 @@ angular.module('copayApp.controllers').controller('copayersController',
|
||||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||||
$scope.wallet = profileService.getWallet(data.stateParams.walletId);
|
$scope.wallet = profileService.getWallet(data.stateParams.walletId);
|
||||||
updateWallet();
|
updateWallet();
|
||||||
|
$scope.shareIcon = platformInfo.isIOS ? 'iOS' : 'Android';
|
||||||
|
|
||||||
|
listener = $rootScope.$on('bwsEvent', function(e, walletId, type, n) {
|
||||||
|
if ($scope.wallet && walletId == $scope.wallet.id && type == ('NewCopayer' || 'WalletComplete'))
|
||||||
|
updateWalletDebounced();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var listener = $rootScope.$on('bwsEvent', function() {
|
$scope.$on("$ionicView.leave", function(event, data) {
|
||||||
updateWallet();
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.$on('$destroy', function() {
|
|
||||||
listener();
|
listener();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -35,12 +38,19 @@ angular.module('copayApp.controllers').controller('copayersController',
|
||||||
if (status.wallet.status == 'complete') {
|
if (status.wallet.status == 'complete') {
|
||||||
$scope.wallet.openWallet(function(err, status) {
|
$scope.wallet.openWallet(function(err, status) {
|
||||||
if (err) $log.error(err);
|
if (err) $log.error(err);
|
||||||
$scope.goHome();
|
$scope.clearNextView();
|
||||||
|
$state.go('tabs.home').then(function() {
|
||||||
|
$state.transitionTo('tabs.wallet', {
|
||||||
|
walletId: $scope.wallet.credentials.walletId
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var updateWalletDebounced = lodash.debounce(updateWallet, 5000, true);
|
||||||
|
|
||||||
$scope.showDeletePopup = function() {
|
$scope.showDeletePopup = function() {
|
||||||
var title = gettextCatalog.getString('Confirm');
|
var title = gettextCatalog.getString('Confirm');
|
||||||
var msg = gettextCatalog.getString('Are you sure you want to cancel and delete this wallet?');
|
var msg = gettextCatalog.getString('Are you sure you want to cancel and delete this wallet?');
|
||||||
|
@ -56,7 +66,9 @@ angular.module('copayApp.controllers').controller('copayersController',
|
||||||
if (err) {
|
if (err) {
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), err.message || err);
|
popupService.showAlert(gettextCatalog.getString('Error'), err.message || err);
|
||||||
} else {
|
} else {
|
||||||
$scope.goHome();
|
pushNotificationsService.unsubscribe($scope.wallet);
|
||||||
|
$scope.clearNextView();
|
||||||
|
$state.go('tabs.home');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -81,8 +93,12 @@ angular.module('copayApp.controllers').controller('copayersController',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.goHome = function() {
|
$scope.clearNextView = function() {
|
||||||
$state.go('tabs.home');
|
listener(); // remove listener
|
||||||
|
$ionicHistory.nextViewOptions({
|
||||||
|
disableAnimate: true,
|
||||||
|
historyRoot: true
|
||||||
|
});
|
||||||
$ionicHistory.clearHistory();
|
$ionicHistory.clearHistory();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'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) {
|
var showErrorAndBack = function(title, msg) {
|
||||||
popupService.showAlert(title, msg, function() {
|
popupService.showAlert(title, msg, function() {
|
||||||
|
@ -16,6 +16,8 @@ angular.module('copayApp.controllers').controller('customAmountController', func
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.showShareButton = platformInfo.isCordova ? (platformInfo.isIOS ? 'iOS' : 'Android') : null;
|
||||||
|
|
||||||
$scope.wallet = profileService.getWallet(walletId);
|
$scope.wallet = profileService.getWallet(walletId);
|
||||||
|
|
||||||
walletService.getAddress($scope.wallet, false, function(err, addr) {
|
walletService.getAddress($scope.wallet, false, function(err, addr) {
|
||||||
|
@ -57,6 +59,12 @@ angular.module('copayApp.controllers').controller('customAmountController', func
|
||||||
$ionicHistory.goBack(-2);
|
$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() {
|
$scope.copyToClipboard = function() {
|
||||||
return 'bitcoin:' + $scope.address + '?amount=' + $scope.amountBtc;
|
return 'bitcoin:' + $scope.address + '?amount=' + $scope.amountBtc;
|
||||||
};
|
};
|
||||||
|
|
|
@ -98,6 +98,8 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
||||||
var selectedWallet = checkSelectedWallet($scope.wallet, $scope.wallets);
|
var selectedWallet = checkSelectedWallet($scope.wallet, $scope.wallets);
|
||||||
$scope.onWalletSelect(selectedWallet);
|
$scope.onWalletSelect(selectedWallet);
|
||||||
|
|
||||||
|
$scope.showShareButton = platformInfo.isCordova ? (platformInfo.isIOS ? 'iOS' : 'Android') : null;
|
||||||
|
|
||||||
listeners = [
|
listeners = [
|
||||||
$rootScope.$on('bwsEvent', function(e, walletId, type, n) {
|
$rootScope.$on('bwsEvent', function(e, walletId, type, n) {
|
||||||
// Update current address
|
// Update current address
|
||||||
|
@ -132,8 +134,8 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
||||||
$scope.showWallets = true;
|
$scope.showWallets = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.copyToClipboard = function() {
|
$scope.shareAddress = function() {
|
||||||
if ($scope.isCordova) return 'bitcoin:' + $scope.addr;
|
if (!$scope.isCordova) return;
|
||||||
else return $scope.addr;
|
window.plugins.socialsharing.share('bitcoin:' + $scope.addr, null, null, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,18 +21,18 @@ angular.module('copayApp.directives')
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
|
|
||||||
if (isCordova) {
|
if (isCordova) {
|
||||||
window.plugins.socialsharing.share(data, null, null, null);
|
cordova.plugins.clipboard.copy(data);
|
||||||
} else if (isNW) {
|
} else if (isNW) {
|
||||||
nodeWebkitService.writeToClipboard(data);
|
nodeWebkitService.writeToClipboard(data);
|
||||||
scope.$apply(function() {
|
|
||||||
ionicToast.show(msg, 'bottom', false, 1000);
|
|
||||||
});
|
|
||||||
} else if (clipboard.supported) {
|
} else if (clipboard.supported) {
|
||||||
clipboard.copyText(data);
|
clipboard.copyText(data);
|
||||||
|
} else {
|
||||||
|
// No supported
|
||||||
|
return;
|
||||||
|
}
|
||||||
scope.$apply(function() {
|
scope.$apply(function() {
|
||||||
ionicToast.show(msg, 'bottom', false, 1000);
|
ionicToast.show(msg, 'bottom', false, 1000);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ $v-text-accent-color: #647ce8 !default;
|
||||||
|
|
||||||
$v-success-color: #13e5b6 !default;
|
$v-success-color: #13e5b6 !default;
|
||||||
$v-warning-color: #ffa500 !default;
|
$v-warning-color: #ffa500 !default;
|
||||||
|
$v-error-color: #ef473a !default;
|
||||||
|
|
||||||
$v-wallet-color-map: (
|
$v-wallet-color-map: (
|
||||||
0: (color: #dd4b39, name: 'Cinnabar'),
|
0: (color: #dd4b39, name: 'Cinnabar'),
|
||||||
|
|
|
@ -1,4 +1,27 @@
|
||||||
.copayers-secret {
|
#copayers-invitation {
|
||||||
|
@extend .deflash-blue;
|
||||||
|
.button-share {
|
||||||
|
color: #fff;
|
||||||
|
box-shadow: none;
|
||||||
|
border-color: transparent;
|
||||||
|
background: transparent;
|
||||||
|
padding: 0 10px;
|
||||||
|
.icon:before {
|
||||||
|
font-size: 26px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.button-cancel {
|
||||||
|
margin-top: 15px;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
font-size: 12px;
|
||||||
|
color: $v-error-color;
|
||||||
|
i.icon {
|
||||||
|
vertical-align: middle;
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.copayers-secret {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
|
@ -10,4 +33,5 @@
|
||||||
white-space: -webkit-pre-wrap;
|
white-space: -webkit-pre-wrap;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,16 @@
|
||||||
$item-lateral-padding: 20px;
|
$item-lateral-padding: 20px;
|
||||||
$item-vertical-padding: 10px;
|
$item-vertical-padding: 10px;
|
||||||
$item-label-color: #6C6C6E;
|
$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 {
|
.address {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
@ -39,6 +49,11 @@
|
||||||
padding-right: $item-lateral-padding;
|
padding-right: $item-lateral-padding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.item-note {
|
||||||
|
width: 75%;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: $item-label-color;
|
color: $item-label-color;
|
||||||
|
|
|
@ -1,5 +1,33 @@
|
||||||
#tab-receive {
|
#tab-receive {
|
||||||
@extend .deflash-blue;
|
@extend .deflash-blue;
|
||||||
|
.button-share {
|
||||||
|
color: #fff;
|
||||||
|
box-shadow: none;
|
||||||
|
border-color: transparent;
|
||||||
|
background: transparent;
|
||||||
|
padding: 0 10px;
|
||||||
|
.icon:before {
|
||||||
|
font-size: 26px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.button-request {
|
||||||
|
margin-top: 10px;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
font-size: 12px;
|
||||||
|
color: $v-text-accent-color;
|
||||||
|
i.icon {
|
||||||
|
vertical-align: middle;
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.button-address {
|
||||||
|
margin-top: 10px;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
font-size: 12px;
|
||||||
|
color: $v-text-accent-color;
|
||||||
|
}
|
||||||
.address {
|
.address {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
@ -21,9 +49,6 @@
|
||||||
margin-top: 5%;
|
margin-top: 5%;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
.request-button {
|
|
||||||
padding-top: 20px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.incomplete {
|
.incomplete {
|
||||||
.title {
|
.title {
|
||||||
|
|
|
@ -1,19 +1,23 @@
|
||||||
|
|
||||||
<ion-view>
|
<ion-view id="copayers-invitation">
|
||||||
<ion-nav-bar class="bar-royal">
|
<ion-nav-bar class="bar-royal">
|
||||||
<ion-nav-back-button>
|
<ion-nav-back-button>
|
||||||
</ion-nav-back-button>
|
</ion-nav-back-button>
|
||||||
<ion-nav-title>{{wallet.name}}</ion-nav-title>
|
<ion-nav-title>{{wallet.name}}</ion-nav-title>
|
||||||
<ion-nav-buttons side="secondary">
|
<ion-nav-buttons side="secondary">
|
||||||
<button class="button button-clear" ng-click="showDeletePopup()">
|
<button class="button-share ng-hide" ng-show="isCordova && secret" ng-click="shareSecret()">
|
||||||
Cancel
|
<i class="icon"
|
||||||
|
ng-class="{
|
||||||
|
'ion-ios-upload-outline': shareIcon == 'iOS',
|
||||||
|
'ion-android-share-alt': shareIcon != 'iOS'
|
||||||
|
}"></i>
|
||||||
</button>
|
</button>
|
||||||
</ion-nav-buttons>
|
</ion-nav-buttons>
|
||||||
</ion-nav-bar>
|
</ion-nav-bar>
|
||||||
|
|
||||||
<ion-content>
|
<ion-content>
|
||||||
<div ng-show="!wallet.notAuthorized">
|
<div ng-show="!wallet.notAuthorized">
|
||||||
<div class="list card text-center">
|
<div class="list text-center">
|
||||||
<div class="item item-heading item-text-wrap" translate>
|
<div class="item item-heading item-text-wrap" translate>
|
||||||
Share this invitation with your copayers
|
Share this invitation with your copayers
|
||||||
</div>
|
</div>
|
||||||
|
@ -29,11 +33,8 @@
|
||||||
{{secret || ('Loading...'|translate)}}
|
{{secret || ('Loading...'|translate)}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button ng-if="isCordova && secret"
|
<button ng-if="secret" class="button-cancel" ng-click="showDeletePopup()">
|
||||||
class="button button-primary button-outline button-small"
|
<span translate>Cancel invitation</span>
|
||||||
ng-click="shareSecret()">
|
|
||||||
<i class="icon ion-ios-upload-outline"></i>
|
|
||||||
<span translate>Share invitation</span>
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,11 +1,20 @@
|
||||||
<ion-view id="custom-amount" hide-tabs>
|
<ion-view id="custom-amount" hide-tabs>
|
||||||
<ion-nav-bar class="bar-royal">
|
<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>
|
<ion-nav-title>
|
||||||
{{'Custom Amount' | translate}}
|
{{'Custom Amount' | translate}}
|
||||||
</ion-nav-title>
|
</ion-nav-title>
|
||||||
<ion-nav-buttons side="secondary">
|
<ion-nav-buttons side="secondary">
|
||||||
<button class="button no-border" ng-click="close()" translate>
|
<button class="button-share ng-hide" ng-show="showShareButton" ng-click="shareAddress()">
|
||||||
Close
|
<i class="icon"
|
||||||
|
ng-class="{
|
||||||
|
'ion-ios-upload-outline': showShareButton == 'iOS',
|
||||||
|
'ion-android-share-alt': showShareButton != 'iOS'
|
||||||
|
}"></i>
|
||||||
</button>
|
</button>
|
||||||
</ion-nav-buttons>
|
</ion-nav-buttons>
|
||||||
</ion-nav-bar>
|
</ion-nav-bar>
|
||||||
|
@ -15,7 +24,7 @@
|
||||||
<qrcode size="220" data="bitcoin:{{address + '?amount=' + amountBtc}}" color="#334"></qrcode>
|
<qrcode size="220" data="bitcoin:{{address + '?amount=' + amountBtc}}" color="#334"></qrcode>
|
||||||
</div>
|
</div>
|
||||||
<div class="info">
|
<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="label" translate>Address</span>
|
||||||
<span class="item-note ellipsis">
|
<span class="item-note ellipsis">
|
||||||
{{address}}
|
{{address}}
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
<ion-view id="tab-receive">
|
<ion-view id="tab-receive">
|
||||||
<ion-nav-bar class="bar-royal">
|
<ion-nav-bar class="bar-royal">
|
||||||
<ion-nav-title>{{'Receive' | translate}}</ion-nav-title>
|
<ion-nav-title>{{'Receive' | translate}}</ion-nav-title>
|
||||||
|
<ion-nav-buttons side="secondary">
|
||||||
|
<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>
|
</ion-nav-bar>
|
||||||
<ion-content scroll="false">
|
<ion-content scroll="false">
|
||||||
<article class="list card padding text-center" ng-if="!wallets[0]">
|
<article class="list card padding text-center" ng-if="!wallets[0]">
|
||||||
|
@ -19,7 +28,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="address-info" ng-if="wallet && wallet.isComplete()">
|
<div class="address-info" ng-if="wallet && wallet.isComplete()">
|
||||||
<div copy-to-clipboard="copyToClipboard()">
|
<div copy-to-clipboard="addr">
|
||||||
<span ng-show="shouldShowReceiveAddressFromHardware()">
|
<span ng-show="shouldShowReceiveAddressFromHardware()">
|
||||||
<button class="button button-standard button-primary" ng-click="showReceiveAddressFromHardware()">
|
<button class="button button-standard button-primary" ng-click="showReceiveAddressFromHardware()">
|
||||||
<span translate>Show address</span>
|
<span translate>Show address</span>
|
||||||
|
@ -31,8 +40,16 @@
|
||||||
<ion-spinner ng-show="!addr" class="spinner-dark" icon="crescent"></ion-spinner>
|
<ion-spinner ng-show="!addr" class="spinner-dark" icon="crescent"></ion-spinner>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div ng-show="addr" class="request-button">
|
<div>
|
||||||
<button class="button button-standard button-primary button-outline button-small" ng-click="requestSpecificAmount()" translate>Request Specific amount</button>
|
<button ng-show="addr" class="button-request" ng-click="requestSpecificAmount()">
|
||||||
|
<span translate>Request Specific amount</span>
|
||||||
|
<i class="icon ion-ios-arrow-right"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button ng-show="addr" class="button-address" ng-click="setAddress(true)">
|
||||||
|
<span translate>Generate new address</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
|
Loading…
Reference in New Issue