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

@ -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);
}
});
}
});
};

View file

@ -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;
});