diff --git a/src/js/controllers/activity.js b/src/js/controllers/activity.js index dbf2f5ada..29721ca3b 100644 --- a/src/js/controllers/activity.js +++ b/src/js/controllers/activity.js @@ -39,7 +39,7 @@ angular.module('copayApp.controllers').controller('activityController', ongoingProcess.set('loadingTxInfo', false); if (err) { $log.warn('No txp found'); - return popupService.showAlert(null, gettextCatalog.getString('Transaction not found')); + return popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Transaction not found')); } txpModalService.open(_txp); }); @@ -61,7 +61,7 @@ angular.module('copayApp.controllers').controller('activityController', if (!tx) { $log.warn('No tx found'); - return popupService.showAlert(null, gettextCatalog.getString('Transaction not found')); + return popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Transaction not found')); } $scope.wallet = wallet; diff --git a/src/js/controllers/addressbook.js b/src/js/controllers/addressbook.js index 4c3ffba35..00931bc83 100644 --- a/src/js/controllers/addressbook.js +++ b/src/js/controllers/addressbook.js @@ -47,7 +47,7 @@ angular.module('copayApp.controllers').controller('addressbookListController', f $timeout(function() { addressbookService.remove(addr, function(err, ab) { if (err) { - popupService.showAlert(err); + popupService.showAlert(gettextCatalog.getString('Error'), err); return; } initAddressbook(); @@ -56,7 +56,7 @@ angular.module('copayApp.controllers').controller('addressbookListController', f }, 100); }; - $scope.$on("$ionicView.beforeEnter", function(event, data){ + $scope.$on("$ionicView.beforeEnter", function(event, data) { initAddressbook(); }); diff --git a/src/js/controllers/addressbookAdd.js b/src/js/controllers/addressbookAdd.js index a33050197..a1bc7fd7a 100644 --- a/src/js/controllers/addressbookAdd.js +++ b/src/js/controllers/addressbookAdd.js @@ -27,7 +27,7 @@ angular.module('copayApp.controllers').controller('addressbookAddController', fu $timeout(function() { addressbookService.add(addressbook, function(err, ab) { if (err) { - popupService.showAlert(err); + popupService.showAlert(gettextCatalog.getString('Error'), err); return; } if ($scope.fromSendTab) $scope.goHome(); diff --git a/src/js/controllers/amazon.js b/src/js/controllers/amazon.js index 453cced4e..6bc4a4108 100644 --- a/src/js/controllers/amazon.js +++ b/src/js/controllers/amazon.js @@ -12,7 +12,7 @@ angular.module('copayApp.controllers').controller('amazonController', var initAmazon = function() { amazonService.getPendingGiftCards(function(err, gcds) { if (err) { - popupService.showAlert(err); + popupService.showAlert(gettextCatalog.getString('Error'), err); return; } $scope.giftCards = lodash.isEmpty(gcds) ? null : gcds; @@ -31,7 +31,7 @@ angular.module('copayApp.controllers').controller('amazonController', $log.debug("creating gift card"); amazonService.createGiftCard(dataFromStorage, function(err, giftCard) { if (err) { - popupService.showAlert(bwcError.msg(err)); + popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err)); return; } if (giftCard.status != 'PENDING') { @@ -51,7 +51,7 @@ angular.module('copayApp.controllers').controller('amazonController', $log.debug("Saving new gift card"); amazonService.getPendingGiftCards(function(err, gcds) { if (err) { - popupService.showAlert(err); + popupService.showAlert(gettextCatalog.getString('Error'), err); return; } $scope.giftCards = gcds; diff --git a/src/js/controllers/bitpayCard.js b/src/js/controllers/bitpayCard.js index 3e37210ea..dd84deaf9 100644 --- a/src/js/controllers/bitpayCard.js +++ b/src/js/controllers/bitpayCard.js @@ -4,12 +4,14 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi var self = this; var runningBalance; - $scope.dateRange = { value: 'last30Days'}; + $scope.dateRange = { + value: 'last30Days' + }; $scope.network = bitpayCardService.getEnvironment(); var updateHistoryFromCache = function(cb) { bitpayCardService.getBitpayDebitCardsHistory($scope.cardId, function(err, data) { - if (err || lodash.isEmpty(data)) return cb(); + if (err ||  lodash.isEmpty(data)) return cb(); $scope.historyCached = true; self.bitpayCardTransactionHistory = data.transactions; self.bitpayCardCurrentBalance = data.balance; @@ -19,8 +21,8 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi var setDateRange = function(preset) { var startDate, endDate; - preset = preset || 'last30Days'; - switch(preset) { + preset = preset ||  'last30Days'; + switch (preset) { case 'last30Days': startDate = moment().subtract(30, 'days').toISOString(); endDate = moment().toISOString(); @@ -138,7 +140,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi disableAnimate: true }); $state.go('tabs.home'); - popupService.showAlert(null, msg); + popupService.showAlert(gettextCatalog.getString('Error'), msg); } else { updateHistoryFromCache(function() { self.update(); @@ -147,4 +149,3 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi }); }); - diff --git a/src/js/controllers/bitpayCardIntro.js b/src/js/controllers/bitpayCardIntro.js index 73ef571ac..63e5b7904 100644 --- a/src/js/controllers/bitpayCardIntro.js +++ b/src/js/controllers/bitpayCardIntro.js @@ -24,11 +24,13 @@ angular.module('copayApp.controllers').controller('bitpayCardIntroController', f obj.otp = otp; bitpayCardService.bitAuthPair(obj, function(err, data) { if (err) { - popupService.showAlert(null, err); + popupService.showAlert(gettextCatalog.getString('Error'), err); return; } var title = gettextCatalog.getString('Add BitPay Card Account?'); - var msg = gettextCatalog.getString('Would you like to add this account ({{email}}) to your wallet?', {email: obj.email}); + var msg = gettextCatalog.getString('Would you like to add this account ({{email}}) to your wallet?', { + email: obj.email + }); var ok = gettextCatalog.getString('Add Account'); var cancel = gettextCatalog.getString('Go back'); popupService.showConfirm(title, msg, ok, cancel, function(res) { @@ -43,7 +45,9 @@ angular.module('copayApp.controllers').controller('bitpayCardIntroController', f }); $state.go('tabs.home').then(function() { if (data.cards[0]) { - $state.transitionTo('tabs.bitpayCard', {id: data.cards[0].id}); + $state.transitionTo('tabs.bitpayCard', { + id: data.cards[0].id + }); } }); }); diff --git a/src/js/controllers/confirm.js b/src/js/controllers/confirm.js index 4158d937d..1c50719de 100644 --- a/src/js/controllers/confirm.js +++ b/src/js/controllers/confirm.js @@ -28,7 +28,7 @@ angular.module('copayApp.controllers').controller('confirmController', function( if ($scope.paypro) { return setFromPayPro($scope.paypro, function(err) { if (err && !isChromeApp) { - popupService.showAlert(gettext('Could not fetch payment')); + popupService.showAlert(gettextCatalog.getString('Error'), gettext('Could not fetch payment')); } }); } @@ -159,7 +159,7 @@ angular.module('copayApp.controllers').controller('confirmController', function( if (!wallet) return cb(); if (isChromeApp) { - popupService.showAlert(gettextCatalog.getString('Payment Protocol not supported on Chrome App')); + popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Payment Protocol not supported on Chrome App')); return cb(true); } @@ -178,13 +178,13 @@ angular.module('copayApp.controllers').controller('confirmController', function( if (msg.match('HTTP')) { msg = gettextCatalog.getString('Could not fetch payment information'); } - popupService.showAlert(msg); + popupService.showAlert(gettextCatalog.getString('Error'), msg); return cb(true); } if (!paypro.verified) { $log.warn('Failed to verify payment protocol signatures'); - popupService.showAlert(gettextCatalog.getString('Payment Protocol Invalid')); + popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Payment Protocol Invalid')); return cb(true); } @@ -338,7 +338,7 @@ angular.module('copayApp.controllers').controller('confirmController', function( $scope.approve = function(onSendStatusChange) { if ($scope._paypro && $scope.paymentExpired.value) { - popupService.showAlert(null, gettextCatalog.getString('The payment request has expired')); + popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('The payment request has expired')); $scope.sendStatus = ''; $timeout(function() { $scope.$apply(); diff --git a/src/js/controllers/import.js b/src/js/controllers/import.js index 056d55ed5..af9dd6e31 100644 --- a/src/js/controllers/import.js +++ b/src/js/controllers/import.js @@ -60,7 +60,7 @@ angular.module('copayApp.controllers').controller('importController', }; if (info.type == 1 && info.hasPassphrase) - popupService.showAlert(gettextCatalog.getString('Password required. Make sure to enter your password in advanced options')); + popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Password required. Make sure to enter your password in advanced options')); $scope.formData.derivationPath = info.derivationPath; $scope.formData.testnetEnabled = info.network == 'testnet' ? true : false; @@ -236,7 +236,7 @@ angular.module('copayApp.controllers').controller('importController', var words = $scope.formData.words || null; if (!words) { - popupService.showAlert(gettextCatalog.getString('Please enter the recovery phrase')); + popupService.showAlert(gettextCatalog.getString('Error'), 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) { @@ -245,7 +245,7 @@ angular.module('copayApp.controllers').controller('importController', var wordList = words.split(/[\u3000\s]+/); if ((wordList.length % 3) != 0) { - popupService.showAlert(gettextCatalog.getString('Wrong number of recovery words:') + wordList.length); + popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Wrong number of recovery words: ') + wordList.length); return; } } @@ -280,7 +280,7 @@ angular.module('copayApp.controllers').controller('importController', $scope.importHW = function(form) { if (form.$invalid || $scope.formData.ccount < 0) { - popupService.showAlert(gettextCatalog.getString('There is an error in the form')); + popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('There is an error in the form')); return; } @@ -290,7 +290,7 @@ angular.module('copayApp.controllers').controller('importController', if ($scope.seedSource.id == 'trezor') { if (account < 1) { - popupService.showAlert(gettextCatalog.getString('Invalid account number')); + popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number')); return; } account = account - 1; diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js index 200de8b76..45d00c09b 100644 --- a/src/js/controllers/tab-home.js +++ b/src/js/controllers/tab-home.js @@ -41,7 +41,7 @@ angular.module('copayApp.controllers').controller('tabHomeController', ongoingProcess.set('loadingTxInfo', false); if (err) { $log.warn('No txp found'); - return popupService.showAlert(null, gettextCatalog.getString('Transaction not found')); + return popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Transaction not found')); } txpModalService.open(_txp); }); @@ -63,7 +63,7 @@ angular.module('copayApp.controllers').controller('tabHomeController', if (!tx) { $log.warn('No tx found'); - return popupService.showAlert(null, gettextCatalog.getString('Transaction not found')); + return popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Transaction not found')); } $scope.wallet = wallet; diff --git a/src/js/controllers/tabsController.js b/src/js/controllers/tabsController.js index f3397286b..1b07555d5 100644 --- a/src/js/controllers/tabsController.js +++ b/src/js/controllers/tabsController.js @@ -4,7 +4,7 @@ angular.module('copayApp.controllers').controller('tabsController', function($ro $scope.onScan = function(data) { if (!incomingData.redir(data)) { - popupService.showAlert(null, gettextCatalog.getString('Invalid data')); + popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid data')); } }; @@ -22,7 +22,7 @@ angular.module('copayApp.controllers').controller('tabsController', function($ro }, 1); }; - $scope.$on("$ionicView.beforeEnter", function(event, data){ + $scope.$on("$ionicView.beforeEnter", function(event, data) { $rootScope.hideTabs = ''; }); diff --git a/src/js/services/walletService.js b/src/js/services/walletService.js index dae6d3ccc..65b644ebb 100644 --- a/src/js/services/walletService.js +++ b/src/js/services/walletService.js @@ -83,11 +83,11 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim wallet.notAuthorized = true; $state.go('tabs.home'); } else if (err instanceof errors.NOT_FOUND) { - popupService.showAlert(gettextCatalog.getString('Could not access Wallet Service: Not found')); + popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not access Wallet Service: Not found')); } else { var msg = "" $rootScope.$emit('Local/ClientError', (err.error ? err.error : err)); - popupService.showAlert(bwcError.msg(err, gettextCatalog.getString('Error at Wallet Service'))); + popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err, gettextCatalog.getString('Error at Wallet Service'))); } }; root.handleError = lodash.debounce(_handleError, 1000);