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',
views: {
'tab-home@tabs': {
@ -973,21 +973,19 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
$log.debug('No profile... redirecting');
$state.go('onboarding.welcome');
} else if (err.message && err.message.match('NONAGREEDDISCLAIMER')) {
$log.debug('Display disclaimer... redirecting');
storageService.getLastState(function(err, state) {
if (err && !state) {
$log.error(err);
$state.go('onboarding.disclaimer');
}
else {
var state = JSON.parse(state);
$state.go(state.name, state.toParams);
}
})
if (lodash.isEmpty(profileService.getWallets())) {
$log.debug('No wallets and no disclaimer... redirecting');
$state.go('onboarding.welcome');
}
else {
$log.debug('Display disclaimer... redirecting');
$state.go('onboarding.disclaimer');
}
} else {
throw new Error(err); // TODO
}
} else {
}
else {
profileService.storeProfileIfDirty();
$log.debug('Profile loaded ... Starting UX.');
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(' toParams:' + JSON.stringify(toParams || {}));
$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);
};
root.setHomeTipAccepted = function(val, cb) {
storage.set('homeTip', val, cb);
};
root.setHomeTipAccepted = function(val, cb) {
storage.set('homeTip', val, cb);
};
root.setHideBalanceFlag = function(walletId, val, cb) {
storage.set('hideBalance-' + walletId, val, cb);
@ -284,14 +284,6 @@ angular.module('copayApp.services')
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() {
var block = '';
// 50MB