Enable cache for nav tabs

This commit is contained in:
Gustavo Maximiliano Cortez 2016-09-21 17:12:25 -03:00
parent b86f2e240d
commit 889ebb8c6c
No known key found for this signature in database
GPG Key ID: 15EDAD8D9F2EB1AF
9 changed files with 44 additions and 37 deletions

View File

@ -3,7 +3,7 @@
<ion-nav-title>{{'Home' | translate}}</ion-nav-title>
</ion-nav-bar>
<ion-content class="padding" ng-controller="tabHomeController" ng-init="updateAllWallets(); nextStep()">
<ion-content class="padding">
<div class="list card homeTip" ng-show="homeTip">
<div class="item item-icon-right item-heading">
<a ng-click="hideHomeTip()"><i class="icon ion-ios-close-empty close-home-tip"></i></a>

View File

@ -1,4 +1,4 @@
<ion-view id="tab-receive" ng-controller="tabReceiveController" ng-init="init()">
<ion-view id="tab-receive">
<ion-nav-bar class="bar-royal">
<ion-nav-title>{{'Receive' | translate}}</ion-nav-title>
<ion-nav-buttons side="secondary">
@ -10,8 +10,11 @@
<ion-content>
<article id="address">
<div class="row">
<div class="m15t text-center col col-60 center-block" copy-to-clipboard="addr">
<qrcode size="220" data="bitcoin:{{addr}}"></qrcode>
<div class="m15t text-center col center-block" copy-to-clipboard="addr">
<qrcode ng-if="addr" size="220" data="bitcoin:{{addr}}"></qrcode>
<div ng-if="!addr" style="height:220px; width:220px; margin:auto; background: white; padding-top: 20%;">
...
</div>
<div ng-if="wallet.needsBackup" class="assertive m10t" translate>
Before receiving funds, you must backup your wallet. If this device is lost, it is impossible to access your funds without a backup.
</div>
@ -25,7 +28,7 @@
</div>
</div>
<div class="col" ng-class="{'center-block col-50': !isCordova || !addr}">
<div class="item item-icon-left" ng-click="setAddress(null, true)">
<div class="item item-icon-left" ng-click="setAddress(true)">
<i class="icon ion-ios-loop"></i>
<span translate>Next Address</span>
</div>
@ -46,11 +49,7 @@
<span translate>No Wallet</span>
</div>
<div class="list" ng-if="wallets[0]">
<!-- <div class="item item-icon-left" ng-click="setAddress(null, true)">
<i class="icon ion-ios-loop"></i>
<span translate>Next Address</span>
</div> -->
<wallets ng-if="wallets[0]" wallets="wallets"></wallets>
<wallets wallets="wallets"></wallets>
</div>
</article>
</ion-content>

View File

@ -3,7 +3,7 @@
<ion-nav-title>{{'Send' | translate}}</ion-nav-title>
</ion-nav-bar>
<ion-content ng-controller="tabSendController" ng-init="init()">
<ion-content>
<div>
<div class="item item-heading" translate>Recipient</div>
<label class="item item-input bitcoin-address">

View File

@ -3,7 +3,7 @@
<ion-nav-title>{{'Global Settings' | translate}}</ion-nav-title>
</ion-nav-bar>
<ion-content ng-controller="tabSettingsController" ng-init="init()">
<ion-content>
<div class="list">
<div class="item item-divider"></div>
<a class="item item-icon-left item-icon-right" ui-sref="tabs.addressbook">

View File

@ -172,7 +172,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$scope.hideHomeTip = function() {
$scope.homeTip = null;
$state.transitionTo($state.current, null, {
reload: false,
reload: true,
inherit: false,
notify: false
});
@ -204,4 +204,9 @@ angular.module('copayApp.controllers').controller('tabHomeController',
x();
});
});
$scope.$on("$ionicView.enter", function(event, data){
$scope.nextStep();
$scope.updateAllWallets();
});
});

View File

@ -3,15 +3,11 @@
angular.module('copayApp.controllers').controller('tabReceiveController', function($scope, $timeout, $log, $ionicModal, storageService, platformInfo, walletService, profileService, configService, lodash, gettextCatalog, popupService) {
$scope.isCordova = platformInfo.isCordova;
$scope.isNW = platformInfo.isNW;
$scope.init = function() {
$scope.wallets = profileService.getWallets({
onlyComplete: true
});
$scope.isNW = platformInfo.isNW;
$scope.isCordova = platformInfo.isCordova;
if (!$scope.isCordova) $scope.checkTips();
}
$scope.wallets = profileService.getWallets({
onlyComplete: true
});
$scope.checkTips = function(force) {
storageService.getReceiveTipsAccepted(function(err, accepted) {
@ -36,7 +32,7 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
}
$scope.wallet = wallet;
$log.debug('Wallet changed: ' + wallet.name);
$scope.setAddress(wallet);
$scope.setAddress();
});
$scope.shareAddress = function(addr) {
@ -46,25 +42,24 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
}
};
$scope.setAddress = function(wallet, forceNew) {
$scope.setAddress = function(forceNew) {
if ($scope.generatingAddress) return;
var wallet = wallet || $scope.wallet;
$scope.addr = null;
$scope.generatingAddress = true;
$timeout(function() {
walletService.getAddress(wallet, forceNew, function(err, addr) {
walletService.getAddress($scope.wallet, forceNew, function(err, addr) {
$scope.generatingAddress = false;
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), err);
} else {
if (addr)
$scope.addr = addr;
if (err || lodash.isEmpty(addr)) {
popupService.showAlert(gettextCatalog.getString('Error'), err || gettextCatalog.getString('Address is empty'));
return;
}
$scope.addr = addr;
$scope.$apply();
});
}, 1);
};
if (!$scope.isCordova) $scope.checkTips();
});

View File

@ -4,7 +4,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
var originalList;
$scope.init = function() {
var updateList = function() {
originalList = [];
var wallets = profileService.getWallets({
@ -83,8 +83,8 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
});
};
$scope.$on('modal.hidden', function() {
$scope.init();
$scope.$on("$ionicView.enter", function(event, data){
updateList();
});
});

View File

@ -2,7 +2,7 @@
angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, $rootScope, $log, $window, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService) {
$scope.init = function() {
var updateConfig = function() {
var config = configService.getSync();
var isCordova = platformInfo.isCordova;
@ -44,7 +44,7 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
}, function(err) {
$log.debug(err);
});
}
};
$scope.spendUnconfirmedChange = function() {
var opts = {
@ -94,4 +94,8 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
});
};
$scope.$on("$ionicView.enter", function(event, data){
updateConfig();
});
});

View File

@ -17,7 +17,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
$urlRouterProvider.otherwise('/starting');
// NO CACHE
$ionicConfigProvider.views.maxCache(0);
//$ionicConfigProvider.views.maxCache(0);
// TABS BOTTOM
$ionicConfigProvider.tabs.position('bottom');
@ -193,6 +193,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/home/:fromOnboarding',
views: {
'tab-home': {
controller: 'tabHomeController',
templateUrl: 'views/tab-home.html',
}
}
@ -201,6 +202,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/receive',
views: {
'tab-receive': {
controller: 'tabReceiveController',
templateUrl: 'views/tab-receive.html',
}
}
@ -209,6 +211,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/send',
views: {
'tab-send': {
controller: 'tabSendController',
templateUrl: 'views/tab-send.html',
}
}
@ -217,6 +220,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/settings',
views: {
'tab-settings': {
controller: 'tabSettingsController',
templateUrl: 'views/tab-settings.html',
}
}