Merge pull request #32 from cmgustavo/ref/design-12

Removes msg error by popupService
This commit is contained in:
Matias Alejo Garcia 2016-09-01 15:44:56 -03:00 committed by GitHub
commit fd8f76bab0
21 changed files with 77 additions and 206 deletions

View File

@ -11,10 +11,6 @@
<ion-content ng-controller="joinController as join">
<div class="padding assertive" ng-show="join.error">
{{join.error|translate}}
</div>
<form name="joinForm" ng-submit="join.join(joinForm)" novalidate>
<div class="card list">

View File

@ -25,9 +25,6 @@
</li>
<li class="item">
<div class="assertive" ng-show="error">
<span class="text-warning size-14">{{error|translate}}</span>
</div>
<div class="row" ng-if="tx.removed">
<div class="column m20t text-center text-warning size-12" translate>

View File

@ -10,10 +10,6 @@
<ion-content ng-controller="createController as create" ng-init="create.setTotalCopayers(1)">
<div class="padding assertive" ng-show="create.error">
{{create.error|translate}}
</div>
<form name="setupForm" ng-submit="create.create(setupForm)" novalidate>
<div class="card list">

View File

@ -10,10 +10,6 @@
<ion-content ng-controller="createController as create" ng-init="create.setTotalCopayers(3)">
<div class="padding assertive" ng-show="create.error">
{{create.error|translate}}
</div>
<form name="setupForm" ng-submit="create.create(setupForm)" novalidate>
<div class="card list">

View File

@ -10,10 +10,6 @@
<ion-content ng-controller="importController" ng-init="type='file'">
<div class="padding assertive" ng-show="error">
{{error|translate}}
</div>
<form name="importForm" ng-submit="importBlob(importForm)" novalidate>
<div class="list card">

View File

@ -10,10 +10,6 @@
<ion-content ng-controller="importController" ng-init="type='hwWallet'">
<div class="padding assertive" ng-show="error">
{{error|translate}}
</div>
<form name="importForm3" ng-submit="importHW(importForm3)" novalidate>
<div class="card" ng-show="!seedOptions[0]">

View File

@ -10,21 +10,15 @@
<ion-content ng-controller="importController" ng-init="type='12'">
<div ng-show="importErr || error" class="padding assertive" ng-click="importErr = error = null">
<div ng-show="importErr">
<div translate>Could not access the wallet at the server. Please check:</div>
<ul>
<li translate>The password of the recovery phrase (if set)</li>
<li translate>The derivation path</li>
<li translate>The wallet service URL</li>
</ul>
<div translate>
NOTE: To import a wallet from a 3rd party software, please go to Add Wallet &gt; Create Wallet, and specify the Recovery Phrase there.
</div>
</div>
<div ng-show="error">
{{error|translate}}
<div ng-show="importErr" class="padding assertive" ng-click="importErr = null">
<div translate>Could not access the wallet at the server. Please check:</div>
<ul>
<li translate>The password of the recovery phrase (if set)</li>
<li translate>The derivation path</li>
<li translate>The wallet service URL</li>
</ul>
<div translate>
NOTE: To import a wallet from a 3rd party software, please go to Add Wallet &gt; Create Wallet, and specify the Recovery Phrase there.
</div>
</div>

View File

@ -11,10 +11,6 @@
</div>
</div>
<div class="padding assertive" ng-show="error">
{{error|translate}}
</div>
<div class="list card padding text-center" ng-if="!wallets[0]">
<span translate>No Wallet</span>
</div>

View File

@ -83,7 +83,6 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
this.getBuyPrice = function(token, price) {
var self = this;
this.error = null;
if (!price || (price && !price.qty && !price.fiat)) {
this.buyPrice = null;
return;

View File

@ -1,24 +1,10 @@
'use strict';
angular.module('copayApp.controllers').controller('confirmController', function($rootScope, $scope, $filter, $timeout, $ionicScrollDelegate, $ionicNavBarDelegate, gettextCatalog, walletService, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, profileService, bitcore, $ionicPopup, txStatus, gettext, txFormatService, ongoingProcess, $ionicModal) {
angular.module('copayApp.controllers').controller('confirmController', function($rootScope, $scope, $filter, $timeout, $ionicScrollDelegate, $ionicNavBarDelegate, gettextCatalog, walletService, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, profileService, bitcore, $ionicPopup, txStatus, gettext, txFormatService, ongoingProcess, $ionicModal, popupService) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Confirm'));
var cachedTxp = {};
var isChromeApp = platformInfo.isChromeApp;
// An alert dialog
var showAlert = function(title, msg, cb) {
var message = msg.message ? msg.message : msg;
$log.warn(title + ": " + message);
var alertPopup = $ionicPopup.alert({
title: title,
template: message
});
if (!cb) cb = function() {};
alertPopup.then(cb);
};
$scope.showDescriptionPopup = function() {
var commentPopup = $ionicPopup.show({
templateUrl: "views/includes/note.html",
@ -52,7 +38,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
if (!wallet) return cb();
if (isChromeApp) {
showAlert(gettext('Payment Protocol not supported on Chrome App'));
popupService.showAlert(gettextCatalog.getString('Payment Protocol not supported on Chrome App'));
return cb(true);
}
@ -69,15 +55,15 @@ angular.module('copayApp.controllers').controller('confirmController', function(
$log.warn('Could not fetch payment request:', err);
var msg = err.toString();
if (msg.match('HTTP')) {
msg = gettext('Could not fetch payment information');
msg = gettextCatalog.getString('Could not fetch payment information');
}
showAlert(msg);
popupService.showAlert(msg);
return cb(true);
}
if (!paypro.verified) {
$log.warn('Failed to verify payment protocol signatures');
showAlert(gettext('Payment Protocol Invalid'));
popupService.showAlert(gettextCatalog.getString('Payment Protocol Invalid'));
return cb(true);
}
@ -189,7 +175,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
};
var setSendError = function(msg) {
showAlert(gettext('Error at confirm:'), msg);
popupService.showAlert(gettextCatalog.getString('Error at confirm:'), msg);
};
function apply(txp) {
@ -212,13 +198,13 @@ angular.module('copayApp.controllers').controller('confirmController', function(
if (description && !wallet.credentials.sharedEncryptingKey) {
var msg = 'Could not add message to imported wallet without shared encrypting key';
$log.warn(msg);
return setSendError(gettext(msg));
return setSendError(msg);
}
if (toAmount > Number.MAX_SAFE_INTEGER) {
var msg = 'Amount too big';
$log.warn(msg);
return setSendError(gettext(msg));
return setSendError(msg);
};
outputs.push({
@ -263,13 +249,11 @@ angular.module('copayApp.controllers').controller('confirmController', function(
var wallet = $scope.wallet;
var txp = $scope.txp;
if (!wallet) {
return setSendError(gettext('No wallet selected'));
return;
return setSendError(gettextCatalog.getString('No wallet selected'));
};
if (!txp) {
return setSendError(gettext('No transaction'));
return;
return setSendError(gettextCatalog.getString('No transaction'));
};
if (!wallet.canSign() && !wallet.isPrivKeyExternal()) {

View File

@ -45,7 +45,7 @@ angular.module('copayApp.controllers').controller('copayersController',
profileService.deleteWalletClient(wallet, function(err) {
ongoingProcess.set('deletingWallet', false);
if (err) {
$scope.error = err.message || err;
popupService.showAlert(gettextCatalog.getString('Error'), err.message || err);
} else {
$state.transitionTo('tabs.home');
}

View File

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('createController',
function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, profileService, configService, gettext, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, storageService) {
function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, profileService, configService, gettext, gettextCatalog, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, storageService, popupService) {
var isChromeApp = platformInfo.isChromeApp;
var isCordova = platformInfo.isCordova;
@ -92,7 +92,7 @@ angular.module('copayApp.controllers').controller('createController',
this.create = function(form) {
if (form && form.$invalid) {
this.error = gettext('Please enter the required fields');
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Please enter the required fields'));
return;
}
@ -119,7 +119,7 @@ angular.module('copayApp.controllers').controller('createController',
var pathData = derivationPathHelper.parse($scope.derivationPath);
if (!pathData) {
this.error = gettext('Invalid derivation path');
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid derivation path'));
return;
}
@ -132,14 +132,14 @@ angular.module('copayApp.controllers').controller('createController',
}
if (setSeed && !opts.mnemonic && !opts.extendedPrivateKey) {
this.error = gettext('Please enter the wallet recovery phrase');
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Please enter the wallet recovery phrase'));
return;
}
if (self.seedSourceId == 'ledger' || self.seedSourceId == 'trezor') {
var account = $scope.account;
if (!account || account < 1) {
this.error = gettext('Invalid account number');
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number'));
return;
}
@ -154,8 +154,7 @@ angular.module('copayApp.controllers').controller('createController',
src.getInfoForNewWallet(opts.n > 1, account, function(err, lopts) {
ongoingProcess.set('connecting' + self.seedSourceId, false);
if (err) {
self.error = err;
$scope.$apply();
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
opts = lodash.assign(lopts, opts);
@ -174,10 +173,7 @@ angular.module('copayApp.controllers').controller('createController',
ongoingProcess.set('creatingWallet', false);
if (err) {
$log.warn(err);
self.error = err;
$timeout(function() {
$rootScope.$apply();
});
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}

View File

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('exportController',
function($rootScope, $scope, $timeout, $log, lodash, backupService, walletService, storageService, profileService, platformInfo, gettext, gettextCatalog, $state, $stateParams) {
function($rootScope, $scope, $timeout, $log, lodash, backupService, walletService, storageService, profileService, platformInfo, gettext, gettextCatalog, $state, $stateParams, popupService) {
var prevState;
var isWP = platformInfo.isWP;
var isAndroid = platformInfo.isAndroid;
@ -10,7 +10,6 @@ angular.module('copayApp.controllers').controller('exportController',
$scope.isEncrypted = wallet.isPrivKeyEncrypted();
$scope.isCordova = platformInfo.isCordova;
$scope.isSafari = platformInfo.isSafari;
$scope.error = null;
$scope.init = function() {
$scope.supported = true;
@ -51,7 +50,7 @@ angular.module('copayApp.controllers').controller('exportController',
$scope.downloadWalletBackup = function() {
$scope.getAddressbook(function(err, localAddressBook) {
if (err) {
$scope.error = true;
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
return;
}
var opts = {
@ -61,7 +60,7 @@ angular.module('copayApp.controllers').controller('exportController',
backupService.walletDownload($scope.password, opts, function(err) {
if (err) {
$scope.error = true;
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
return;
}
$state.go('tabs.home');
@ -87,7 +86,7 @@ angular.module('copayApp.controllers').controller('exportController',
$scope.getBackup = function(cb) {
$scope.getAddressbook(function(err, localAddressBook) {
if (err) {
$scope.error = true;
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
return cb(null);
}
var opts = {
@ -97,9 +96,7 @@ angular.module('copayApp.controllers').controller('exportController',
var ew = backupService.walletExport($scope.password, opts);
if (!ew) {
$scope.error = true;
} else {
$scope.error = false;
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
}
return cb(ew);
});

View File

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('importController',
function($scope, $rootScope, $timeout, $log, $state, $stateParams, $ionicHistory, profileService, configService, sjcl, gettext, ledger, trezor, derivationPathHelper, platformInfo, bwcService, ongoingProcess, walletService) {
function($scope, $rootScope, $timeout, $log, $state, $stateParams, $ionicHistory, profileService, configService, sjcl, gettext, ledger, trezor, derivationPathHelper, platformInfo, bwcService, ongoingProcess, walletService, popupService, gettextCatalog) {
var isChromeApp = platformInfo.isChromeApp;
var isDevel = platformInfo.isDevel;
@ -38,12 +38,11 @@ angular.module('copayApp.controllers').controller('importController',
if (!code) return;
$scope.importErr = false;
$scope.error = null;
var parsedCode = code.split('|');
if (parsedCode.length != 5) {
/// Trying to import a malformed wallet export QR code
$scope.error = gettext('Incorrect code format');
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Incorrect code format'));
return;
}
@ -56,7 +55,7 @@ angular.module('copayApp.controllers').controller('importController',
};
if (info.type == 1 && info.hasPassphrase)
$scope.error = gettext('Password required. Make sure to enter your password in advanced options');
popupService.showAlert(gettextCatalog.getString('Password required. Make sure to enter your password in advanced options'));
$scope.derivationPath = info.derivationPath;
$scope.testnetEnabled = info.network == 'testnet' ? true : false;
@ -69,7 +68,6 @@ angular.module('copayApp.controllers').controller('importController',
$scope.setType = function(type) {
$scope.type = type;
$scope.error = null;
$timeout(function() {
$rootScope.$apply();
}, 1);
@ -80,12 +78,12 @@ angular.module('copayApp.controllers').controller('importController',
try {
str2 = sjcl.decrypt($scope.password, str);
} catch (e) {
err = gettext('Could not decrypt file, check your password');
err = gettextCatalog.getString('Could not decrypt file, check your password');
$log.warn(e);
};
if (err) {
$scope.error = err;
popupService.showAlert(gettextCatalog.getString('Error'), err);
$timeout(function() {
$rootScope.$apply();
});
@ -100,7 +98,7 @@ angular.module('copayApp.controllers').controller('importController',
profileService.importWallet(str2, opts, function(err, client) {
ongoingProcess.set('importingWallet', false);
if (err) {
$scope.error = err;
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
@ -129,7 +127,7 @@ angular.module('copayApp.controllers').controller('importController',
if (err instanceof errors.NOT_AUTHORIZED) {
$scope.importErr = true;
} else {
$scope.error = err;
popupService.showAlert(gettextCatalog.getString('Error'), err);
}
return $timeout(function() {
$scope.$apply();
@ -190,7 +188,7 @@ angular.module('copayApp.controllers').controller('importController',
if (err instanceof errors.NOT_AUTHORIZED) {
$scope.importErr = true;
} else {
$scope.error = err;
popupService.showAlert(gettextCatalog.getString('Error'), err);
}
return $timeout(function() {
$scope.$apply();
@ -232,10 +230,7 @@ angular.module('copayApp.controllers').controller('importController',
$scope.importBlob = function(form) {
if (form.$invalid) {
$scope.error = gettext('There is an error in the form');
$timeout(function() {
$scope.$apply();
});
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('There is an error in the form'));
return;
}
@ -244,11 +239,7 @@ angular.module('copayApp.controllers').controller('importController',
var password = form.password.$modelValue;
if (!backupFile && !backupText) {
$scope.error = gettext('Please, select your backup file');
$timeout(function() {
$scope.$apply();
});
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Please, select your backup file'));
return;
}
@ -263,10 +254,7 @@ angular.module('copayApp.controllers').controller('importController',
$scope.importMnemonic = function(form) {
if (form.$invalid) {
$scope.error = gettext('There is an error in the form');
$timeout(function() {
$scope.$apply();
});
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('There is an error in the form'));
return;
}
@ -276,7 +264,7 @@ angular.module('copayApp.controllers').controller('importController',
var pathData = derivationPathHelper.parse($scope.derivationPath);
if (!pathData) {
$scope.error = gettext('Invalid derivation path');
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid derivation path'));
return;
}
opts.account = pathData.account;
@ -284,10 +272,9 @@ angular.module('copayApp.controllers').controller('importController',
opts.derivationStrategy = pathData.derivationStrategy;
var words = form.words.$modelValue || null;
$scope.error = null;
if (!words) {
$scope.error = gettext('Please enter the recovery phrase');
popupService.showAlert(gettextCatalog.getString('Please enter the recovery phrase'));
} else if (words.indexOf('xprv') == 0 || words.indexOf('tprv') == 0) {
return _importExtendedPrivateKey(words, opts);
} else if (words.indexOf('xpub') == 0 || words.indexOf('tpuv') == 0) {
@ -296,17 +283,11 @@ angular.module('copayApp.controllers').controller('importController',
var wordList = words.split(/[\u3000\s]+/);
if ((wordList.length % 3) != 0) {
$scope.error = gettext('Wrong number of recovery words:') + wordList.length;
popupService.showAlert(gettextCatalog.getString('Wrong number of recovery words:') + wordList.length);
return;
}
}
if ($scope.error) {
$timeout(function() {
$scope.$apply();
});
return;
}
var passphrase = form.passphrase.$modelValue;
opts.passphrase = form.passphrase.$modelValue || null;
@ -317,8 +298,7 @@ angular.module('copayApp.controllers').controller('importController',
trezor.getInfoForNewWallet(isMultisig, account, function(err, lopts) {
ongoingProcess.clear();
if (err) {
$scope.error = err;
$scope.$apply();
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
@ -330,10 +310,8 @@ angular.module('copayApp.controllers').controller('importController',
profileService.importExtendedPublicKey(lopts, function(err, wallet) {
ongoingProcess.set('importingWallet', false);
if (err) {
$scope.error = err;
return $timeout(function() {
$scope.$apply();
});
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
@ -354,13 +332,9 @@ angular.module('copayApp.controllers').controller('importController',
$scope.importHW = function(form) {
if (form.$invalid || $scope.account < 0) {
$scope.error = gettext('There is an error in the form');
$timeout(function() {
$scope.$apply();
});
popupService.showAlert(gettextCatalog.getString('There is an error in the form'));
return;
}
$scope.error = '';
$scope.importErr = false;
var account = +$scope.account;
@ -400,8 +374,7 @@ angular.module('copayApp.controllers').controller('importController',
ledger.getInfoForNewWallet(true, account, function(err, lopts) {
ongoingProcess.clear();
if (err) {
$scope.error = err;
$scope.$apply();
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
@ -413,10 +386,8 @@ angular.module('copayApp.controllers').controller('importController',
profileService.importExtendedPublicKey(lopts, function(err, wallet) {
ongoingProcess.set('importingWallet', false);
if (err) {
$scope.error = err;
return $timeout(function() {
$scope.$apply();
});
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}

View File

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('joinController',
function($scope, $rootScope, $timeout, $state, profileService, configService, storageService, applicationService, gettext, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams) {
function($scope, $rootScope, $timeout, $state, profileService, configService, storageService, applicationService, gettext, gettextCatalog, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService) {
var isChromeApp = platformInfo.isChromeApp;
var isDevel = platformInfo.isDevel;
@ -14,7 +14,6 @@ angular.module('copayApp.controllers').controller('joinController',
this.onQrCodeScanned = function(data) {
console.log('[join.js.16:data:]',data); //TODO
$scope.secret = data;
if ($scope.joinForm) {
$scope.joinForm.secret.$setViewValue(data);
@ -64,7 +63,7 @@ console.log('[join.js.16:data:]',data); //TODO
this.join = function(form) {
if (form && form.$invalid) {
self.error = gettext('Please enter the required fields');
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Please enter the required fields'));
return;
}
@ -86,7 +85,7 @@ console.log('[join.js.16:data:]',data); //TODO
var pathData = derivationPathHelper.parse($scope.derivationPath);
if (!pathData) {
this.error = gettext('Invalid derivation path');
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid derivation path'));
return;
}
opts.account = pathData.account;
@ -100,15 +99,14 @@ console.log('[join.js.16:data:]',data); //TODO
if (setSeed && !opts.mnemonic && !opts.extendedPrivateKey) {
this.error = gettext('Please enter the wallet recovery phrase');
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Please enter the wallet recovery phrase'));
return;
}
if (self.seedSourceId == 'ledger' || self.seedSourceId == 'trezor') {
var account = $scope.account;
if (!account || account < 1) {
this.error = gettext('Invalid account number');
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number'));
return;
}
@ -122,8 +120,7 @@ console.log('[join.js.16:data:]',data); //TODO
src.getInfoForNewWallet(true, account, function(err, lopts) {
ongoingProcess.set('connecting' + self.seedSourceId, false);
if (err) {
self.error = err;
$scope.$apply();
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
opts = lodash.assign(lopts, opts);
@ -141,8 +138,7 @@ console.log('[join.js.16:data:]',data); //TODO
profileService.joinWallet(opts, function(err, client) {
ongoingProcess.set('joiningWallet', false);
if (err) {
self.error = err;
$rootScope.$apply();
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}

View File

@ -1,22 +1,9 @@
'use strict';
angular.module('copayApp.controllers').controller('addressbookModalController', function($scope, $log, $state, $timeout, $ionicPopup, addressbookService, lodash) {
angular.module('copayApp.controllers').controller('addressbookModalController', function($scope, $log, $state, $timeout, $ionicPopup, addressbookService, lodash, popupService) {
var contacts;
// An alert dialog
var showAlert = function(title, msg, cb) {
$log.warn(title + ": " + msg);
var alertPopup = $ionicPopup.alert({
title: title,
template: msg
});
if (!cb) cb = function() {};
alertPopup.then(cb);
};
$scope.initAddressbook = function() {
addressbookService.list(function(err, ab) {
if (err) $log.error(err);
@ -94,7 +81,7 @@ angular.module('copayApp.controllers').controller('addressbookModalController',
$timeout(function() {
addressbookService.add(addressbook, function(err, ab) {
if (err) {
showAlert(err);
popupService.showAlert(err);
return;
}
$scope.initAddressbook();
@ -108,7 +95,7 @@ angular.module('copayApp.controllers').controller('addressbookModalController',
$timeout(function() {
addressbookService.remove(addr, function(err, ab) {
if (err) {
showAlert(err);
popupService.showAlert(err);
return;
}
$scope.initAddressbook();

View File

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('txpDetailsController', function($scope, $rootScope, $timeout, $interval, $ionicModal, ongoingProcess, platformInfo, txStatus, $ionicScrollDelegate, txFormatService, fingerprintService, bwcError, gettextCatalog, lodash, walletService) {
angular.module('copayApp.controllers').controller('txpDetailsController', function($scope, $rootScope, $timeout, $interval, $ionicModal, ongoingProcess, platformInfo, txStatus, $ionicScrollDelegate, txFormatService, fingerprintService, bwcError, gettextCatalog, lodash, walletService, popupService) {
var self = $scope.self;
var tx = $scope.tx;
var copayers = $scope.copayers;
@ -25,13 +25,11 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
}
var setSendError = function(msg) {
$scope.error = msg || gettextCatalog.getString('Could not send payment');
var error = msg || gettextCatalog.getString('Could not send payment');
popupService.showAlert(gettextCatalog.getString('Error'), error);
}
$scope.sign = function() {
$scope.error = null;
$scope.loading = true;
walletService.publishAndSign($scope.wallet, $scope.tx, function(err, txp) {
$scope.$emit('UpdateTx');
@ -42,15 +40,11 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
function setError(err, prefix) {
$scope.loading = false;
$scope.error = bwcError.msg(err, prefix);
$timeout(function() {
$scope.$digest();
}, 10);
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err, prefix));
};
$scope.reject = function(txp) {
$scope.loading = true;
$scope.error = null;
walletService.reject($scope.wallet, $scope.tx, function(err, txpr) {
if (err)
@ -64,7 +58,6 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
$scope.remove = function() {
$scope.loading = true;
$scope.error = null;
$timeout(function() {
ongoingProcess.set('removeTx', true);
@ -84,7 +77,6 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
$scope.broadcast = function(txp) {
$scope.loading = true;
$scope.error = null;
$timeout(function() {
ongoingProcess.set('broadcastTx', true);

View File

@ -3,7 +3,6 @@
angular.module('copayApp.controllers').controller('preferencesBwsUrlController',
function($scope, $log, $stateParams, $ionicNavBarDelegate, configService, applicationService, profileService, storageService) {
$ionicNavBarDelegate.title('Wallet Service URL');
$scope.error = null;
$scope.success = null;
var wallet = profileService.getWallet($stateParams.walletId);

View File

@ -1,12 +1,11 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesDeleteWalletController',
function($scope, $ionicPopup, $stateParams, $ionicNavBarDelegate, gettextCatalog, lodash, profileService, $state, ongoingProcess) {
function($scope, $ionicPopup, $stateParams, $ionicNavBarDelegate, gettextCatalog, lodash, profileService, $state, ongoingProcess, popupService) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Delete Wallet'));
var wallet = profileService.getWallet($stateParams.walletId);
$scope.alias = lodash.isEqual(wallet.name, wallet.credentials.walletName) ? null : wallet.name + ' ';
$scope.walletName = '[' + wallet.credentials.walletName + ']';
$scope.error = null;
$scope.showDeletePopup = function() {
var popup = $ionicPopup.show({
@ -36,7 +35,7 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
profileService.deleteWalletClient(wallet, function(err) {
ongoingProcess.set('deletingWallet', false);
if (err) {
$scope.error = err.message || err;
popupService.showAlert(gettextCatalog.getString('Error'), err.message || err);
} else {
$state.go('tabs.home');
}

View File

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('tabReceiveController', function($scope, $timeout, $log, platformInfo, walletService, profileService, configService, lodash, gettextCatalog) {
angular.module('copayApp.controllers').controller('tabReceiveController', function($scope, $timeout, $log, platformInfo, walletService, profileService, configService, lodash, gettextCatalog, popupService) {
$scope.isCordova = platformInfo.isCordova;
@ -33,7 +33,6 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
if ($scope.generatingAddress) return;
var wallet = wallet || $scope.wallet;
$scope.error = null;
$scope.addr = null;
$scope.generatingAddress = true;
@ -41,7 +40,7 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
walletService.getAddress(wallet, forceNew, function(err, addr) {
$scope.generatingAddress = false;
if (err) {
$scope.error = err;
popupService.showAlert(gettextCatalog.getString('Error'), err);
} else {
if (addr)
$scope.addr = addr;

View File

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.services').factory('walletService', function($log, $timeout, lodash, trezor, ledger, storageService, configService, rateService, uxLanguage, $filter, gettextCatalog, bwcError, $ionicPopup, fingerprintService, ongoingProcess, gettext, $rootScope, txStatus, txFormatService, $ionicModal, $state, bwcService, bitcore) {
angular.module('copayApp.services').factory('walletService', function($log, $timeout, lodash, trezor, ledger, storageService, configService, rateService, uxLanguage, $filter, gettextCatalog, bwcError, $ionicPopup, fingerprintService, ongoingProcess, gettext, $rootScope, txStatus, txFormatService, $ionicModal, $state, bwcService, bitcore, popupService) {
// `wallet` is a decorated version of client.
var root = {};
@ -81,12 +81,11 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
wallet.notAuthorized = true;
$state.go('tabs.home');
} else if (err instanceof errors.NOT_FOUND) {
root.showErrorPopup(gettext('Could not access Wallet Service: Not found'));
popupService.showAlert(gettextCatalog.getString('Could not access Wallet Service: Not found'));
} else {
var msg = ""
$rootScope.$emit('Local/ClientError', (err.error ? err.error : err));
var msg = bwcError.msg(err, gettext('Error at Wallet Service'));
root.showErrorPopup(msg);
popupService.showAlert(bwcError.msg(err, gettextCatalog.getString('Error at Wallet Service')));
}
};
root.handleError = lodash.debounce(_handleError, 1000);
@ -664,20 +663,6 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
});
};
root.showErrorPopup = function(msg, cb) {
$log.warn('Showing err popup:' + msg);
// An alert dialog
var alertPopup = $ionicPopup.alert({
title: title,
template: msg
});
if (!cb) cb = function() {};
alertPopup.then(cb);
};
// walletHome
root.recreate = function(wallet, cb) {
ongoingProcess.set('recreating', true);