Copay: Terms of Use in APP
This commit is contained in:
parent
e194bb6c7e
commit
1224f89c17
7 changed files with 113 additions and 44 deletions
|
|
@ -157,6 +157,9 @@ input:-webkit-autofill, textarea:-webkit-autofill, select:-webkit-autofill, inpu
|
|||
overflow: auto;
|
||||
}
|
||||
|
||||
.content.disclaimer {
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.logo-setup {
|
||||
text-align: center;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,26 +135,32 @@ angular.module('copayApp.services')
|
|||
};
|
||||
|
||||
root.loadAndBindProfile = function(cb) {
|
||||
storageService.getProfile(function(err, profile) {
|
||||
if (err) {
|
||||
$rootScope.$emit('Local/DeviceError', err);
|
||||
return cb(err);
|
||||
}
|
||||
if (!profile) {
|
||||
// Migration??
|
||||
storageService.tryToMigrate(function(err, migratedProfile) {
|
||||
if (err) return cb(err);
|
||||
if (!migratedProfile)
|
||||
return cb(new Error('NOPROFILE: No profile'));
|
||||
|
||||
profile = migratedProfile;
|
||||
return root.bindProfile(profile, cb);
|
||||
})
|
||||
storageService.getCopayDisclaimer(function(err, val) {
|
||||
if (!val) {
|
||||
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
|
||||
} else {
|
||||
$log.debug('Profile read');
|
||||
return root.bindProfile(profile, cb);
|
||||
}
|
||||
storageService.getProfile(function(err, profile) {
|
||||
if (err) {
|
||||
$rootScope.$emit('Local/DeviceError', err);
|
||||
return cb(err);
|
||||
}
|
||||
if (!profile) {
|
||||
// Migration??
|
||||
storageService.tryToMigrate(function(err, migratedProfile) {
|
||||
if (err) return cb(err);
|
||||
if (!migratedProfile)
|
||||
return cb(new Error('NOPROFILE: No profile'));
|
||||
|
||||
profile = migratedProfile;
|
||||
return root.bindProfile(profile, cb);
|
||||
})
|
||||
} else {
|
||||
$log.debug('Profile read');
|
||||
return root.bindProfile(profile, cb);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -176,5 +176,13 @@ angular.module('copayApp.services')
|
|||
storage.remove('config', cb);
|
||||
};
|
||||
|
||||
root.setCopayDisclaimer = function(cb) {
|
||||
storage.set('agreeDisclaimer', true, cb);
|
||||
};
|
||||
|
||||
root.getCopayDisclaimer = function(cb) {
|
||||
storage.get('agreeDisclaimer', cb);
|
||||
};
|
||||
|
||||
return root;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue