Fix cache for activity, addressbook, amazon, proposals

This commit is contained in:
Gustavo Maximiliano Cortez 2016-09-22 01:47:39 -03:00
commit 9cb0dc128c
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
9 changed files with 68 additions and 41 deletions

View file

@ -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();
});
});