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