adding agreeDisclaimer flag for compatibility

This commit is contained in:
Gabriel Bazán 2015-11-30 16:34:24 -03:00
commit b9557d47d2
7 changed files with 74 additions and 57 deletions

View file

@ -38,7 +38,10 @@ angular.module('copayApp.controllers').controller('disclaimerController',
storageService.getProfile(function(err, profile) {
if (!profile) create();
else $scope.creatingProfile = false;
//compatible
storageService.getCopayDisclaimerFlag(function(err, val) {
if (val) go.walletHome();
});
});
});

View file

@ -473,26 +473,30 @@ angular
storageService.getProfile(function(err, profile) {
$log.debug('### State: ', $stateParams.status);
switch ($stateParams.status) {
case 'resume':
$rootScope.$emit('Local/Resume');
break;
case 'backbutton':
var shouldExit = $stateParams.isHome == 'true' || !profile.agreeDisclaimer;
if (isCordova && shouldExit && !$rootScope.modalOpened) {
return navigator.app.exitApp();
} else {
$rootScope.$emit('closeModal');
}
break;
};
//for compatibility
storageService.getCopayDisclaimerFlag(function(err, val) {
if (profile.agreeDisclaimer) {
go.walletHome(true);
} else {
$state.transitionTo('disclaimer');
}
$log.debug('### State: ', $stateParams.status);
switch ($stateParams.status) {
case 'resume':
$rootScope.$emit('Local/Resume');
break;
case 'backbutton':
var shouldExit = $stateParams.isHome == 'true' || !profile.agreeDisclaimer || !val;
if (isCordova && shouldExit && !$rootScope.modalOpened) {
return navigator.app.exitApp();
} else {
$rootScope.$emit('closeModal');
}
break;
};
if (profile.agreeDisclaimer || val) {
go.walletHome(true);
} else {
$state.transitionTo('disclaimer');
}
});
});
}
}

View file

@ -134,7 +134,6 @@ angular.module('copayApp.services')
};
root.loadAndBindProfile = function(cb) {
storageService.getProfile(function(err, profile) {
if (err) {
$rootScope.$emit('Local/DeviceError', err);
@ -151,10 +150,13 @@ angular.module('copayApp.services')
return root.bindProfile(profile, cb);
})
} else {
if (!profile.agreeDisclaimer)
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
$log.debug('Profile read');
return root.bindProfile(profile, cb);
storageService.getCopayDisclaimerFlag(function(err, val) {
if (!profile.agreeDisclaimer) {
if (!val) return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
}
$log.debug('Profile read');
return root.bindProfile(profile, cb);
});
}
});
};

View file

@ -198,6 +198,11 @@ angular.module('copayApp.services')
storage.remove('config', cb);
};
//for compatibility
root.getCopayDisclaimerFlag = function(cb) {
storage.get('agreeDisclaimer', cb);
};
root.setRemotePrefsStoredFlag = function(cb) {
storage.set('remotePrefStored', true, cb);
};