deleting agree disclaimer flag in storage and adding to the storage profile

This commit is contained in:
Gabriel Bazán 2015-11-30 12:58:52 -03:00
commit 3f7485ca8d
7 changed files with 62 additions and 58 deletions

View file

@ -134,30 +134,27 @@ angular.module('copayApp.services')
};
root.loadAndBindProfile = function(cb) {
storageService.getCopayDisclaimerFlag(function(err, val) {
if (!val) {
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
} else {
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);
}
});
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 {
if (!profile.agreeDisclaimer)
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
$log.debug('Profile read');
return root.bindProfile(profile, cb);
}
});
};
@ -380,14 +377,14 @@ angular.module('copayApp.services')
var handleImport = function(cb) {
var isImport = opts.mnemonic || opts.externalSource || opts.extendedPrivateKey;
var isImport = opts.mnemonic || opts.externalSource || opts.extendedPrivateKey;
if (!isImport)
if (!isImport)
return cb();
$rootScope.$emit('Local/BackupDone', walletId);
if (!walletClient.isComplete())
if (!walletClient.isComplete())
return cb();
storageService.setCleanAndScanAddresses(walletId, cb);

View file

@ -120,7 +120,6 @@ angular.module('copayApp.services')
root.getProfile = function(cb) {
storage.get('profile', function(err, str) {
if (err || !str)
return cb(err);
@ -199,14 +198,6 @@ angular.module('copayApp.services')
storage.remove('config', cb);
};
root.setCopayDisclaimerFlag = function(cb) {
storage.set('agreeDisclaimer', true, cb);
};
root.getCopayDisclaimerFlag = function(cb) {
storage.get('agreeDisclaimer', cb);
};
root.setRemotePrefsStoredFlag = function(cb) {
storage.set('remotePrefStored', true, cb);
};