Fix cache for activity, addressbook, amazon, proposals
This commit is contained in:
parent
1edcf184ee
commit
9cb0dc128c
9 changed files with 68 additions and 41 deletions
|
|
@ -1,11 +1,12 @@
|
||||||
|
|
||||||
<ion-view>
|
<ion-view>
|
||||||
<ion-nav-bar class="bar-royal">
|
<ion-nav-bar class="bar-royal">
|
||||||
<ion-nav-title>Recent Activity</ion-nav-title>
|
<ion-nav-title>
|
||||||
|
{{'Recent Activity'|translate}}
|
||||||
|
</ion-nav-title>
|
||||||
<ion-nav-back-button>
|
<ion-nav-back-button>
|
||||||
</ion-nav-back-button>
|
</ion-nav-back-button>
|
||||||
</ion-nav-bar>
|
</ion-nav-bar>
|
||||||
<ion-content class="padding" ng-controller="activityController" ng-init="init()">
|
<ion-content class="padding">
|
||||||
|
|
||||||
<div ng-if="fetchingNotifications" class="updatingHistory">
|
<div ng-if="fetchingNotifications" class="updatingHistory">
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
</ion-nav-buttons>
|
</ion-nav-buttons>
|
||||||
</ion-nav-bar>
|
</ion-nav-bar>
|
||||||
|
|
||||||
<ion-content ng-init="initAddressbook()">
|
<ion-content>
|
||||||
|
|
||||||
<div class="bar bar-header item-input-inset" ng-show="!isEmptyList">
|
<div class="bar bar-header item-input-inset" ng-show="!isEmptyList">
|
||||||
<label class="item-input-wrapper">
|
<label class="item-input-wrapper">
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
<ion-nav-title>Amazon.com Gift Cards</ion-nav-title>
|
<ion-nav-title>Amazon.com Gift Cards</ion-nav-title>
|
||||||
</ion-nav-bar>
|
</ion-nav-bar>
|
||||||
|
|
||||||
<ion-content ng-controller="amazonController as amazon" ng-init="amazon.init()">
|
<ion-content>
|
||||||
|
|
||||||
<div class="box-notification warning" ng-show="network == 'testnet'">
|
<div class="box-notification warning" ng-show="network == 'testnet'">
|
||||||
Sandbox version. Only for testing purpose
|
Sandbox version. Only for testing purpose
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="m20t text-center" ng-click="amazon.updatePendingGiftCards()">
|
<div class="m20t text-center" ng-click="updatePendingGiftCards()">
|
||||||
<img src="img/GCs-logo-cllb.png" alt="Amazon.com Gift Card" width="200">
|
<img src="img/GCs-logo-cllb.png" alt="Amazon.com Gift Card" width="200">
|
||||||
<div class="size-11 m10t"><b>Only</b> redeemable on www.amazon.com (USA website)</div>
|
<div class="size-11 m10t"><b>Only</b> redeemable on www.amazon.com (USA website)</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
Your cards
|
Your cards
|
||||||
</div>
|
</div>
|
||||||
<div ng-repeat="(id, item) in giftCards | orderObjectBy:'date':true track by $index"
|
<div ng-repeat="(id, item) in giftCards | orderObjectBy:'date':true track by $index"
|
||||||
ng-click="amazon.openCardModal(item)"
|
ng-click="openCardModal(item)"
|
||||||
class="item item-avatar">
|
class="item item-avatar">
|
||||||
<img src="img/a-smile_color_btn.png" alt="{{id}}" width="40">
|
<img src="img/a-smile_color_btn.png" alt="{{id}}" width="40">
|
||||||
<h2 ng-if="item.claimCode">
|
<h2 ng-if="item.claimCode">
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,23 @@
|
||||||
<ion-nav-back-button>
|
<ion-nav-back-button>
|
||||||
</ion-nav-back-button>
|
</ion-nav-back-button>
|
||||||
</ion-nav-bar>
|
</ion-nav-bar>
|
||||||
<ion-content class="padding" ng-controller="proposalsController" ng-init="init()">
|
<ion-content class="padding">
|
||||||
|
|
||||||
<div class="list card">
|
<div ng-if="fetchingProposals" class="updatingHistory">
|
||||||
|
<div class="text-center">
|
||||||
|
<ion-spinner class="spinner-dark" icon="lines"></ion-spinner>
|
||||||
|
<div translate>Updating pending proposals. Please stand by</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="list card" ng-show="txps[0] && !fetchingProposals">
|
||||||
<a ng-repeat="tx in txps" class="item" ng-click="openTxpModal(tx)">
|
<a ng-repeat="tx in txps" class="item" ng-click="openTxpModal(tx)">
|
||||||
<span ng-include="'views/includes/txp.html'"></span>
|
<span ng-include="'views/includes/txp.html'"></span>
|
||||||
</a>
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="item" ng-show="!txps[0]">
|
<div class="list card" ng-show="!txps[0] && !fetchingProposals">
|
||||||
|
<div class="item">
|
||||||
<span translate>No pending proposals</span>
|
<span translate>No pending proposals</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@
|
||||||
angular.module('copayApp.controllers').controller('activityController',
|
angular.module('copayApp.controllers').controller('activityController',
|
||||||
function($timeout, $scope, $log, $ionicModal, lodash, txpModalService, profileService, walletService, ongoingProcess, popupService, gettextCatalog) {
|
function($timeout, $scope, $log, $ionicModal, lodash, txpModalService, profileService, walletService, ongoingProcess, popupService, gettextCatalog) {
|
||||||
$scope.openTxpModal = txpModalService.open;
|
$scope.openTxpModal = txpModalService.open;
|
||||||
|
$scope.fetchingNotifications = true;
|
||||||
|
|
||||||
$scope.init = function() {
|
$scope.$on("$ionicView.enter", function(event, data){
|
||||||
$scope.fetchingNotifications = true;
|
|
||||||
profileService.getNotifications(50, function(err, n) {
|
profileService.getNotifications(50, function(err, n) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
|
$log.error(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$scope.fetchingNotifications = false;
|
$scope.fetchingNotifications = false;
|
||||||
|
|
@ -22,7 +22,7 @@ angular.module('copayApp.controllers').controller('activityController',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
});
|
||||||
|
|
||||||
$scope.openNotificationModal = function(n) {
|
$scope.openNotificationModal = function(n) {
|
||||||
if (n.txid) {
|
if (n.txid) {
|
||||||
|
|
@ -33,8 +33,16 @@ angular.module('copayApp.controllers').controller('activityController',
|
||||||
});
|
});
|
||||||
if (txp) txpModalService.open(txp);
|
if (txp) txpModalService.open(txp);
|
||||||
else {
|
else {
|
||||||
$log.warn('No txp found');
|
ongoingProcess.set('loadingTxInfo', true);
|
||||||
return popupService.showAlert(null, gettextCatalog.getString('Transaction not found'));
|
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'));
|
return popupService.showAlert(null, gettextCatalog.getString('Transaction not found'));
|
||||||
}
|
}
|
||||||
|
|
||||||
walletService.getTxNote(wallet, n.txid, function(err, note) {
|
$scope.wallet = wallet;
|
||||||
if (err) $log.debug(gettextCatalog.getString('Could not fetch transaction note'));
|
$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;
|
walletService.getTxNote(wallet, n.txid, function(err, note) {
|
||||||
$scope.btx = lodash.cloneDeep(tx);
|
if (err) $log.debug('Could not fetch transaction note');
|
||||||
$scope.btx.note = note;
|
$scope.btx.note = note;
|
||||||
$ionicModal.fromTemplateUrl('views/modals/tx-details.html', {
|
|
||||||
scope: $scope
|
|
||||||
}).then(function(modal) {
|
|
||||||
$scope.txDetailsModal = modal;
|
|
||||||
$scope.txDetailsModal.show();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ angular.module('copayApp.controllers').controller('addressbookListController', f
|
||||||
|
|
||||||
var contacts;
|
var contacts;
|
||||||
|
|
||||||
$scope.initAddressbook = function() {
|
var initAddressbook = function() {
|
||||||
addressbookService.list(function(err, ab) {
|
addressbookService.list(function(err, ab) {
|
||||||
if (err) $log.error(err);
|
if (err) $log.error(err);
|
||||||
|
|
||||||
|
|
@ -47,10 +47,14 @@ angular.module('copayApp.controllers').controller('addressbookListController', f
|
||||||
popupService.showAlert(err);
|
popupService.showAlert(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$scope.initAddressbook();
|
initAddressbook();
|
||||||
$scope.$digest();
|
$scope.$digest();
|
||||||
});
|
});
|
||||||
}, 100);
|
}, 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.$on("$ionicView.enter", function(event, data){
|
||||||
|
initAddressbook();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,7 @@ angular.module('copayApp.controllers').controller('amazonController',
|
||||||
externalLinkService.open(url, target);
|
externalLinkService.open(url, target);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.init = function() {
|
var initAmazon = function() {
|
||||||
var self = this;
|
|
||||||
$scope.network = amazonService.getEnvironment();
|
$scope.network = amazonService.getEnvironment();
|
||||||
amazonService.getPendingGiftCards(function(err, gcds) {
|
amazonService.getPendingGiftCards(function(err, gcds) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
@ -20,11 +19,10 @@ angular.module('copayApp.controllers').controller('amazonController',
|
||||||
$scope.$digest();
|
$scope.$digest();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.updatePendingGiftCards();
|
$scope.updatePendingGiftCards();
|
||||||
}
|
};
|
||||||
|
|
||||||
this.updatePendingGiftCards = lodash.debounce(function() {
|
$scope.updatePendingGiftCards = lodash.debounce(function() {
|
||||||
var self = this;
|
|
||||||
|
|
||||||
amazonService.getPendingGiftCards(function(err, gcds) {
|
amazonService.getPendingGiftCards(function(err, gcds) {
|
||||||
lodash.forEach(gcds, function(dataFromStorage) {
|
lodash.forEach(gcds, function(dataFromStorage) {
|
||||||
|
|
@ -69,8 +67,7 @@ angular.module('copayApp.controllers').controller('amazonController',
|
||||||
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
this.openCardModal = function(card) {
|
$scope.openCardModal = function(card) {
|
||||||
var self = this;
|
|
||||||
$scope.card = card;
|
$scope.card = card;
|
||||||
|
|
||||||
$ionicModal.fromTemplateUrl('views/modals/amazon-card-details.html', {
|
$ionicModal.fromTemplateUrl('views/modals/amazon-card-details.html', {
|
||||||
|
|
@ -81,7 +78,11 @@ angular.module('copayApp.controllers').controller('amazonController',
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.$on('UpdateAmazonList', function(event) {
|
$scope.$on('UpdateAmazonList', function(event) {
|
||||||
self.init();
|
initAmazon();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.$on("$ionicView.enter", function(event, data){
|
||||||
|
initAmazon();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,14 @@
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('proposalsController',
|
angular.module('copayApp.controllers').controller('proposalsController',
|
||||||
function($timeout, $scope, profileService, $log, txpModalService) {
|
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) {
|
profileService.getTxps(50, function(err, txps) {
|
||||||
|
$scope.fetchingProposals = false;
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
|
$log.error(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$scope.txps = txps;
|
$scope.txps = txps;
|
||||||
|
|
@ -17,7 +18,7 @@ angular.module('copayApp.controllers').controller('proposalsController',
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
}, 1);
|
}, 1);
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
|
||||||
$scope.openTxpModal = txpModalService.open;
|
$scope.openTxpModal = txpModalService.open;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
url: '/activity',
|
url: '/activity',
|
||||||
views: {
|
views: {
|
||||||
'tab-home': {
|
'tab-home': {
|
||||||
|
controller: 'activityController',
|
||||||
templateUrl: 'views/activity.html',
|
templateUrl: 'views/activity.html',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -173,6 +174,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
url: '/proposals',
|
url: '/proposals',
|
||||||
views: {
|
views: {
|
||||||
'tab-home': {
|
'tab-home': {
|
||||||
|
controller: 'proposalsController',
|
||||||
templateUrl: 'views/proposals.html',
|
templateUrl: 'views/proposals.html',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -742,6 +744,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
url: '/amazon',
|
url: '/amazon',
|
||||||
views: {
|
views: {
|
||||||
'tab-home@tabs': {
|
'tab-home@tabs': {
|
||||||
|
controller: 'amazonController',
|
||||||
templateUrl: 'views/amazon.html'
|
templateUrl: 'views/amazon.html'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue