Enable cache for nav tabs

This commit is contained in:
Gustavo Maximiliano Cortez 2016-09-21 17:12:25 -03:00
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

@ -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',
}
}