diff --git a/public/views/activity.html b/public/views/activity.html index 5465609ad..fb84142dc 100644 --- a/public/views/activity.html +++ b/public/views/activity.html @@ -1,11 +1,12 @@ - - Recent Activity + + {{'Recent Activity'|translate}} + - + diff --git a/public/views/addressbook.html b/public/views/addressbook.html index fea7fcf67..dbc5f9648 100644 --- a/public/views/addressbook.html +++ b/public/views/addressbook.html @@ -12,7 +12,7 @@ - + diff --git a/public/views/amazon.html b/public/views/amazon.html index 285725c86..86208c52c 100644 --- a/public/views/amazon.html +++ b/public/views/amazon.html @@ -5,13 +5,13 @@ Amazon.com Gift Cards - + Sandbox version. Only for testing purpose - + Only redeemable on www.amazon.com (USA website) @@ -42,7 +42,7 @@ Your cards diff --git a/public/views/proposals.html b/public/views/proposals.html index 5599b8559..abeb2ea15 100644 --- a/public/views/proposals.html +++ b/public/views/proposals.html @@ -7,14 +7,23 @@ - + - + + + + Updating pending proposals. Please stand by + + + + + - + + No pending proposals diff --git a/src/js/controllers/activity.js b/src/js/controllers/activity.js index ee1d50720..e9c140449 100644 --- a/src/js/controllers/activity.js +++ b/src/js/controllers/activity.js @@ -3,12 +3,12 @@ angular.module('copayApp.controllers').controller('activityController', function($timeout, $scope, $log, $ionicModal, lodash, txpModalService, profileService, walletService, ongoingProcess, popupService, gettextCatalog) { $scope.openTxpModal = txpModalService.open; + $scope.fetchingNotifications = true; - $scope.init = function() { - $scope.fetchingNotifications = true; + $scope.$on("$ionicView.enter", function(event, data){ profileService.getNotifications(50, function(err, n) { if (err) { - console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO + $log.error(err); return; } $scope.fetchingNotifications = false; @@ -22,7 +22,7 @@ angular.module('copayApp.controllers').controller('activityController', }); }); }); - }; + }); $scope.openNotificationModal = function(n) { if (n.txid) { @@ -33,8 +33,16 @@ angular.module('copayApp.controllers').controller('activityController', }); if (txp) txpModalService.open(txp); else { - $log.warn('No txp found'); - return popupService.showAlert(null, gettextCatalog.getString('Transaction not found')); + ongoingProcess.set('loadingTxInfo', true); + walletService.getTxp(n.wallet, n.txpId, function(err, txp) { + var _txp = txp; + ongoingProcess.set('loadingTxInfo', false); + if (err) { + $log.warn('No txp found'); + return popupService.showAlert(null, gettextCatalog.getString('Transaction not found')); + } + txpModalService.open(_txp); + }); } } }; @@ -56,18 +64,18 @@ angular.module('copayApp.controllers').controller('activityController', return popupService.showAlert(null, gettextCatalog.getString('Transaction not found')); } - walletService.getTxNote(wallet, n.txid, function(err, note) { - if (err) $log.debug(gettextCatalog.getString('Could not fetch transaction note')); + $scope.wallet = wallet; + $scope.btx = lodash.cloneDeep(tx); + $ionicModal.fromTemplateUrl('views/modals/tx-details.html', { + scope: $scope + }).then(function(modal) { + $scope.txDetailsModal = modal; + $scope.txDetailsModal.show(); + }); - $scope.wallet = wallet; - $scope.btx = lodash.cloneDeep(tx); + walletService.getTxNote(wallet, n.txid, function(err, note) { + if (err) $log.debug('Could not fetch transaction note'); $scope.btx.note = note; - $ionicModal.fromTemplateUrl('views/modals/tx-details.html', { - scope: $scope - }).then(function(modal) { - $scope.txDetailsModal = modal; - $scope.txDetailsModal.show(); - }); }); }); }; diff --git a/src/js/controllers/addressbook.js b/src/js/controllers/addressbook.js index d9e136901..35e4b32b2 100644 --- a/src/js/controllers/addressbook.js +++ b/src/js/controllers/addressbook.js @@ -4,7 +4,7 @@ angular.module('copayApp.controllers').controller('addressbookListController', f var contacts; - $scope.initAddressbook = function() { + var initAddressbook = function() { addressbookService.list(function(err, ab) { if (err) $log.error(err); @@ -47,10 +47,14 @@ angular.module('copayApp.controllers').controller('addressbookListController', f popupService.showAlert(err); return; } - $scope.initAddressbook(); + initAddressbook(); $scope.$digest(); }); }, 100); }; + $scope.$on("$ionicView.enter", function(event, data){ + initAddressbook(); + }); + }); diff --git a/src/js/controllers/amazon.js b/src/js/controllers/amazon.js index 302bd2a24..564291fbe 100644 --- a/src/js/controllers/amazon.js +++ b/src/js/controllers/amazon.js @@ -7,8 +7,7 @@ angular.module('copayApp.controllers').controller('amazonController', externalLinkService.open(url, target); }; - this.init = function() { - var self = this; + var initAmazon = function() { $scope.network = amazonService.getEnvironment(); amazonService.getPendingGiftCards(function(err, gcds) { if (err) { @@ -20,11 +19,10 @@ angular.module('copayApp.controllers').controller('amazonController', $scope.$digest(); }); }); - this.updatePendingGiftCards(); - } + $scope.updatePendingGiftCards(); + }; - this.updatePendingGiftCards = lodash.debounce(function() { - var self = this; + $scope.updatePendingGiftCards = lodash.debounce(function() { amazonService.getPendingGiftCards(function(err, gcds) { lodash.forEach(gcds, function(dataFromStorage) { @@ -69,8 +67,7 @@ angular.module('copayApp.controllers').controller('amazonController', }, 1000); - this.openCardModal = function(card) { - var self = this; + $scope.openCardModal = function(card) { $scope.card = card; $ionicModal.fromTemplateUrl('views/modals/amazon-card-details.html', { @@ -81,7 +78,11 @@ angular.module('copayApp.controllers').controller('amazonController', }); $scope.$on('UpdateAmazonList', function(event) { - self.init(); + initAmazon(); }); }; + + $scope.$on("$ionicView.enter", function(event, data){ + initAmazon(); + }); }); diff --git a/src/js/controllers/proposals.js b/src/js/controllers/proposals.js index 3747cd706..2fa6193a0 100644 --- a/src/js/controllers/proposals.js +++ b/src/js/controllers/proposals.js @@ -3,13 +3,14 @@ angular.module('copayApp.controllers').controller('proposalsController', function($timeout, $scope, profileService, $log, txpModalService) { - var self = this; + $scope.fetchingProposals = true; - $scope.init = function() { + $scope.$on("$ionicView.enter", function(event, data){ profileService.getTxps(50, function(err, txps) { + $scope.fetchingProposals = false; if (err) { - console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO + $log.error(err); return; } $scope.txps = txps; @@ -17,7 +18,7 @@ angular.module('copayApp.controllers').controller('proposalsController', $scope.$apply(); }, 1); }); - } + }); $scope.openTxpModal = txpModalService.open; }); diff --git a/src/js/routes.js b/src/js/routes.js index d8a4c9a5e..0419b05c8 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -165,6 +165,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr url: '/activity', views: { 'tab-home': { + controller: 'activityController', templateUrl: 'views/activity.html', } } @@ -173,6 +174,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr url: '/proposals', views: { 'tab-home': { + controller: 'proposalsController', templateUrl: 'views/proposals.html', } } @@ -742,6 +744,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr url: '/amazon', views: { 'tab-home@tabs': { + controller: 'amazonController', templateUrl: 'views/amazon.html' } }