Merge pull request #3354 from cmgustavo/bug/android-white-screen
Handle error when the device id mismatch
This commit is contained in:
commit
82959609ec
3 changed files with 16 additions and 7 deletions
|
|
@ -1045,13 +1045,16 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
self.needsBackup = false;
|
self.needsBackup = false;
|
||||||
$log.debug('Backup done');
|
$log.debug('Backup done');
|
||||||
storageService.setBackupFlag(self.walletId, function(err) {
|
storageService.setBackupFlag(self.walletId, function(err) {
|
||||||
if (err) root.showErrorPopup(err);
|
|
||||||
$log.debug('Backup done stored');
|
$log.debug('Backup done stored');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$rootScope.$on('Local/DeviceError', function(event, err) {
|
$rootScope.$on('Local/DeviceError', function(event, err) {
|
||||||
root.showErrorPopup(err);
|
self.showErrorPopup(err, function() {
|
||||||
|
if (self.isCordova && navigator && navigator.app) {
|
||||||
|
navigator.app.exitApp();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$rootScope.$on('Local/WalletImported', function(event, walletId) {
|
$rootScope.$on('Local/WalletImported', function(event, walletId) {
|
||||||
|
|
|
||||||
|
|
@ -515,10 +515,10 @@ angular
|
||||||
// Try to open local profile
|
// Try to open local profile
|
||||||
profileService.loadAndBindProfile(function(err) {
|
profileService.loadAndBindProfile(function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err.message.match('NOPROFILE')) {
|
if (err.message && err.message.match('NOPROFILE')) {
|
||||||
$log.debug('No profile... redirecting');
|
$log.debug('No profile... redirecting');
|
||||||
$state.transitionTo('splash');
|
$state.transitionTo('splash');
|
||||||
} else if (err.message.match('NONAGREEDDISCLAIMER')) {
|
} else if (err.message && err.message.match('NONAGREEDDISCLAIMER')) {
|
||||||
$log.debug('Display disclaimer... redirecting');
|
$log.debug('Display disclaimer... redirecting');
|
||||||
$state.transitionTo('disclaimer');
|
$state.transitionTo('disclaimer');
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -545,4 +545,4 @@ angular
|
||||||
}, 50);
|
}, 50);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -41,15 +41,21 @@ angular.module('copayApp.services')
|
||||||
json = JSON.parse(text);
|
json = JSON.parse(text);
|
||||||
} catch (e) {};
|
} catch (e) {};
|
||||||
|
|
||||||
|
if (!json) return cb('Could not access storage')
|
||||||
|
|
||||||
if (!json.iter || !json.ct)
|
if (!json.iter || !json.ct)
|
||||||
return cb(null, text);
|
return cb(null, text);
|
||||||
|
|
||||||
$log.debug('Profile is encrypted');
|
$log.debug('Profile is encrypted');
|
||||||
getUUID(function(uuid) {
|
getUUID(function(uuid) {
|
||||||
if (!uuid)
|
if (!uuid)
|
||||||
return cb(new Error('Could not decrypt localstorage profile'));
|
return cb('Could not decrypt storage: could not get device ID');
|
||||||
|
|
||||||
text = sjcl.decrypt(uuid, text);
|
try {
|
||||||
|
text = sjcl.decrypt(uuid, text);
|
||||||
|
} catch(e) {
|
||||||
|
return cb('Could not decrypt storage: device ID mismatch');
|
||||||
|
};
|
||||||
return cb(null, text);
|
return cb(null, text);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue