fix receive view - refactor error message/view
This commit is contained in:
parent
8a88e712e1
commit
d56b22242b
2 changed files with 14 additions and 68 deletions
|
|
@ -3,43 +3,24 @@
|
|||
<ion-nav-title>Receive</ion-nav-title>
|
||||
</ion-nav-bar>
|
||||
|
||||
|
||||
<ion-content ng-controller="tabReceiveController" ng-init="init()" >
|
||||
|
||||
<div class="text-center m30v" copy-to-clipboard="addr" ng-show="addr" >
|
||||
<ion-content ng-controller="tabReceiveController" ng-init="init()">
|
||||
<div class="text-center m30v" copy-to-clipboard="addr" ng-show="addr">
|
||||
<qrcode size="220" data="bitcoin:{{addr}}" ng-show="addr"></qrcode>
|
||||
</div>
|
||||
|
||||
<div class="padding assertive" ng-show="error">
|
||||
{{error|translate}}
|
||||
</div>
|
||||
|
||||
<div ng-show="generatingAddress" class="m30v">
|
||||
<div style="height:220px; width:220px; margin:auto; background: #eee; text-align:center">
|
||||
<ion-spinner class="spinner-stable" icon="lines" style="stroke:black; margin-top: 85px"></ion-spinner>
|
||||
<div class="padding-top">
|
||||
<ion-spinner class="spinner-dark" icon="lines"></ion-spinner>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-show="incomplete">
|
||||
<div style="height:220px; width:220px; margin: 30px auto; background: #eee; text-align:center">
|
||||
incomplete wallet
|
||||
</div>
|
||||
|
||||
<div class="item item-icon-left" ng-click="shareAddress(addr)" ng-show="isCordova && addr" ng-disabled="generatingAddress">
|
||||
<i class="icon ion-ios-upload-outline"></i>
|
||||
</div>
|
||||
<div class="item item-icon-left" ng-click="setAddress(true)" ng-show="!generatingAddress">
|
||||
<i class="icon ion-ios-loop"></i>
|
||||
</div>
|
||||
<div class="item item-icon-left">
|
||||
<i class="icon ion-social-bitcoin-outline"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-show="addrError">
|
||||
<div style="height:220px; width:220px; margin: 30px auto; background: #eee; text-align:center">
|
||||
Error: {{addrError}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-show="!incomplete">
|
||||
<div class="list">
|
||||
<div class="item item-icon-left" ng-click="shareAddress(addr)" ng-show="isCordova && addr" ng-disabled="generatingAddress">
|
||||
<i class="icon ion-ios-upload-outline"></i>
|
||||
<span translate>Share address</span>
|
||||
|
|
@ -53,9 +34,7 @@ Error: {{addrError}}
|
|||
<span ng-show="generatingAddress">...</span>
|
||||
<span ng-show="!generatingAddress" copy-to-clipboard="addr">{{addr}}</span>
|
||||
</div>
|
||||
<wallets only-complete="true"></wallets>
|
||||
</div>
|
||||
|
||||
<wallets only-complete="true"></wallets>
|
||||
|
||||
</ion-content>
|
||||
</ion-view>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('tabReceiveController', function($scope, $ionicPopover, $timeout, $log, platformInfo, nodeWebkit, walletService, profileService, configService, lodash, gettextCatalog) {
|
||||
angular.module('copayApp.controllers').controller('tabReceiveController', function($scope, $timeout, $log, platformInfo, walletService, profileService, configService, lodash, gettextCatalog) {
|
||||
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
|
||||
|
|
@ -11,37 +11,6 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
$scope.setAddress(false);
|
||||
}
|
||||
|
||||
$scope.copyToClipboard = function(addr, $event) {
|
||||
var showPopover = function() {
|
||||
$ionicPopover.fromTemplateUrl('views/includes/copyToClipboard.html', {
|
||||
scope: $scope
|
||||
}).then(function(popover) {
|
||||
$scope.popover = popover;
|
||||
$scope.popover.show($event);
|
||||
});
|
||||
|
||||
$scope.close = function() {
|
||||
$scope.popover.hide();
|
||||
}
|
||||
|
||||
$timeout(function() {
|
||||
$scope.popover.hide(); //close the popover after 0.7 seconds
|
||||
}, 700);
|
||||
|
||||
$scope.$on('$destroy', function() {
|
||||
$scope.popover.remove();
|
||||
});
|
||||
};
|
||||
|
||||
if ($scope.isCordova) {
|
||||
window.cordova.plugins.clipboard.copy(addr);
|
||||
window.plugins.toast.showShortCenter(gettextCatalog.getString('Copied to clipboard'));
|
||||
} else if ($scope.isNW) {
|
||||
nodeWebkit.writeToClipboard(addr);
|
||||
showPopover($event);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.$on('Wallet/Changed', function(event, wallet) {
|
||||
if (!wallet) {
|
||||
$log.debug('No wallet provided');
|
||||
|
|
@ -63,24 +32,22 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
if ($scope.generatingAddress) return;
|
||||
|
||||
$scope.addr = null;
|
||||
$scope.addrError = null;
|
||||
$scope.error = null;
|
||||
|
||||
if (wallet && !wallet.isComplete()) {
|
||||
$scope.incomplete = true;
|
||||
$timeout(function() {
|
||||
$scope.$digest();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.incomplete = false;
|
||||
$scope.generatingAddress = true;
|
||||
|
||||
$timeout(function() {
|
||||
walletService.getAddress(wallet, forceNew, function(err, addr) {
|
||||
$scope.generatingAddress = false;
|
||||
if (err) {
|
||||
$scope.addrError = err;
|
||||
$scope.error = err;
|
||||
} else {
|
||||
if (addr)
|
||||
$scope.addr = addr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue