Copay: Terms of Use in APP

This commit is contained in:
Gustavo Maximiliano Cortez 2015-06-11 11:59:48 -03:00
commit 1224f89c17
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
7 changed files with 113 additions and 44 deletions

View file

@ -73,10 +73,14 @@ angular
views: {
'main': {
templateUrl: 'views/splash.html',
controller: function($scope, $timeout, $log, profileService, go) {
if (profileService.profile) {
go.walletHome();
}
controller: function($scope, $timeout, $log, profileService, storageService, go) {
storageService.getCopayDisclaimer(function(err, val) {
if (!val) go.path('disclaimer');
if (profileService.profile) {
go.walletHome();
}
});
$scope.create = function(noWallet) {
$scope.creatingProfile = true;
@ -97,6 +101,27 @@ angular
}
}
})
$stateProvider
.state('disclaimer', {
url: '/disclaimer',
needProfile: false,
views: {
'main': {
templateUrl: 'views/disclaimer.html',
controller: function($scope, storageService, applicationService) {
storageService.getCopayDisclaimer(function(err, val) {
$scope.agreed = val;
});
$scope.agree = function() {
storageService.setCopayDisclaimer(function(err) {
applicationService.restart();
});
};
}
}
}
})
.state('walletHome', {
url: '/',
walletShouldBeComplete: true,
@ -427,6 +452,7 @@ angular
preferencesEmail: 12,
about: 12,
logs: 13,
disclaimer: 13,
add: 11,
create: 12,
join: 12,
@ -451,6 +477,9 @@ angular
if (err.message.match('NOPROFILE')) {
$log.debug('No profile... redirecting');
$state.transitionTo('splash');
} else if (err.message.match('NONAGREEDDISCLAIMER')) {
$log.debug('Display disclaimer... redirecting');
$state.transitionTo('disclaimer');
} else {
throw new Error(err); // TODO
}