mirror of https://github.com/BTCPrivate/copay.git
Fix cache for activity, addressbook, amazon, proposals
This commit is contained in:
parent
1edcf184ee
commit
9cb0dc128c
|
@ -1,11 +1,12 @@
|
|||
|
||||
<ion-view>
|
||||
<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-bar>
|
||||
<ion-content class="padding" ng-controller="activityController" ng-init="init()">
|
||||
<ion-content class="padding">
|
||||
|
||||
<div ng-if="fetchingNotifications" class="updatingHistory">
|
||||
<div class="text-center">
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
</ion-nav-buttons>
|
||||
</ion-nav-bar>
|
||||
|
||||
<ion-content ng-init="initAddressbook()">
|
||||
<ion-content>
|
||||
|
||||
<div class="bar bar-header item-input-inset" ng-show="!isEmptyList">
|
||||
<label class="item-input-wrapper">
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
<ion-nav-title>Amazon.com Gift Cards</ion-nav-title>
|
||||
</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'">
|
||||
Sandbox version. Only for testing purpose
|
||||
</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">
|
||||
<div class="size-11 m10t"><b>Only</b> redeemable on www.amazon.com (USA website)</div>
|
||||
</div>
|
||||
|
@ -42,7 +42,7 @@
|
|||
Your cards
|
||||
</div>
|
||||
<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">
|
||||
<img src="img/a-smile_color_btn.png" alt="{{id}}" width="40">
|
||||
<h2 ng-if="item.claimCode">
|
||||
|
|
|
@ -7,14 +7,23 @@
|
|||
<ion-nav-back-button>
|
||||
</ion-nav-back-button>
|
||||
</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)">
|
||||
<span ng-include="'views/includes/txp.html'"></span>
|
||||
</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>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
|
|
|
@ -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'
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue