if no wallet resume welcome - if no disclaimer accepted resume disclaimer

This commit is contained in:
Gabriel Bazán 2016-10-11 12:22:58 -03:00
commit b9f5728ab7
2 changed files with 19 additions and 35 deletions

View file

@ -840,13 +840,13 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
} }
}) })
/* /*
* *
* BitPay Card * BitPay Card
* *
*/ */
.state('tabs.bitpayCard', { .state('tabs.bitpayCard', {
url: '/bitpay-card', url: '/bitpay-card',
views: { views: {
'tab-home@tabs': { 'tab-home@tabs': {
@ -973,21 +973,19 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
$log.debug('No profile... redirecting'); $log.debug('No profile... redirecting');
$state.go('onboarding.welcome'); $state.go('onboarding.welcome');
} else if (err.message && err.message.match('NONAGREEDDISCLAIMER')) { } else if (err.message && err.message.match('NONAGREEDDISCLAIMER')) {
$log.debug('Display disclaimer... redirecting'); if (lodash.isEmpty(profileService.getWallets())) {
storageService.getLastState(function(err, state) { $log.debug('No wallets and no disclaimer... redirecting');
if (err && !state) { $state.go('onboarding.welcome');
$log.error(err); }
$state.go('onboarding.disclaimer'); else {
} $log.debug('Display disclaimer... redirecting');
else { $state.go('onboarding.disclaimer');
var state = JSON.parse(state); }
$state.go(state.name, state.toParams);
}
})
} else { } else {
throw new Error(err); // TODO throw new Error(err); // TODO
} }
} else { }
else {
profileService.storeProfileIfDirty(); profileService.storeProfileIfDirty();
$log.debug('Profile loaded ... Starting UX.'); $log.debug('Profile loaded ... Starting UX.');
scannerService.gentleInitialize(); scannerService.gentleInitialize();
@ -1014,11 +1012,5 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
$log.debug('Route change from:', fromState.name || '-', ' to:', toState.name); $log.debug('Route change from:', fromState.name || '-', ' to:', toState.name);
$log.debug(' toParams:' + JSON.stringify(toParams || {})); $log.debug(' toParams:' + JSON.stringify(toParams || {}));
$log.debug(' fromParams:' + JSON.stringify(fromParams || {})); $log.debug(' fromParams:' + JSON.stringify(fromParams || {}));
if (!toState.name.match(/onboarding/)) return;
var state = {};
state.name = toState.name;
state.toParams = toParams;
if (state.name != 'starting') storageService.setLastState(JSON.stringify(state), function() {});
}); });
}); });

View file

@ -199,9 +199,9 @@ angular.module('copayApp.services')
storage.get('homeTip', cb); storage.get('homeTip', cb);
}; };
root.setHomeTipAccepted = function(val, cb) { root.setHomeTipAccepted = function(val, cb) {
storage.set('homeTip', val, cb); storage.set('homeTip', val, cb);
}; };
root.setHideBalanceFlag = function(walletId, val, cb) { root.setHideBalanceFlag = function(walletId, val, cb) {
storage.set('hideBalance-' + walletId, val, cb); storage.set('hideBalance-' + walletId, val, cb);
@ -284,14 +284,6 @@ angular.module('copayApp.services')
storage.remove('nextStep-' + service, cb); storage.remove('nextStep-' + service, cb);
}; };
root.setLastState = function(state, toParams, cb) {
storage.set('lastState', state, toParams, cb);
};
root.getLastState = function(cb) {
storage.get('lastState', cb);
};
root.checkQuota = function() { root.checkQuota = function() {
var block = ''; var block = '';
// 50MB // 50MB