Remove secure storage feature, postpone

This commit is contained in:
Jean-Baptiste Dominguez 2018-07-02 14:06:36 +09:00
commit 9224d40a65
2 changed files with 8 additions and 49 deletions

View file

@ -73,8 +73,6 @@
<plugin name="cordova-plugin-firebase" spec="https://github.com/arnesson/cordova-plugin-firebase.git" /> <plugin name="cordova-plugin-firebase" spec="https://github.com/arnesson/cordova-plugin-firebase.git" />
<plugin name="cordova-plugin-wkwebview-inputfocusfix" spec="https://github.com/onderceylan/cordova-plugin-wkwebview-inputfocusfix.git" /> <plugin name="cordova-plugin-wkwebview-inputfocusfix" spec="https://github.com/onderceylan/cordova-plugin-wkwebview-inputfocusfix.git" />
<plugin name="cordova-plugin-nativeaudio" spec="^3.0.9" /> <plugin name="cordova-plugin-nativeaudio" spec="^3.0.9" />
<!-- Changes in error descriptions may break the use of cordova-plugin-secure-storage -->
<plugin name="cordova-plugin-secure-storage" spec="2.6.8" />
<!-- Supported Platforms --> <!-- Supported Platforms -->
<engine name="ios" spec="~4.5.3" /> <engine name="ios" spec="~4.5.3" />
<engine name="android" spec="~6.3.0" /> <engine name="android" spec="~6.3.0" />

View file

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.services') angular.module('copayApp.services')
.factory('storageService', function(appConfigService, logHeader, fileStorageService, localStorageService, sjcl, $log, lodash, platformInfo, secureStorageService, $timeout) { .factory('storageService', function(appConfigService, logHeader, fileStorageService, localStorageService, sjcl, $log, lodash, platformInfo, $timeout) {
var root = {}; var root = {};
var storage; var storage;
@ -121,11 +121,7 @@ angular.module('copayApp.services')
root.storeProfile = function(profile, cb) { root.storeProfile = function(profile, cb) {
var profileString = profile.toObj(); var profileString = profile.toObj();
if (platformInfo.isNW) { storage.set('profile', profileString, cb);
storage.set('profile', profileString, cb);
} else {
secureStorageService.set('profile', profileString, cb);
}
}; };
/** /**
@ -205,48 +201,13 @@ angular.module('copayApp.services')
* @param {getProfileCallback} cb * @param {getProfileCallback} cb
*/ */
root.getProfile = function(cb) { root.getProfile = function(cb) {
if (platformInfo.isNW) { storage.get('profile', function(getErr, getStr) {
storage.get('profile', function(getErr, getStr) { if (getErr) {
_onOldProfileRetrieved(getErr, getStr, cb); cb(getErr, null);
}); } else {
return profile = Profile.fromString(getStr);
} cb(null, profile);
secureStorageService.get('profile', function(secureErr, secureStr) {
var secureProfile;
var oldProfile;
if (secureErr) {
return cb(secureErr, null);
} }
if (secureStr) {
try {
secureProfile = Profile.fromString(secureStr);
$log.debug('profile: ' + JSON.stringify(secureProfile));
} catch (e) {
$log.error(e);
return cb(e, null);
}
}
storage.get('profile', function(getErr, getStr) {
_onOldProfileRetrieved(getErr, getStr, function(oldErr, oldProfile){
if (oldErr) {
return cb(oldErr, null);
}
if (!oldProfile) {
if (secureProfile) {
return cb(null, secureProfile);
} else {
// No profiles found. No errors either.
return cb(null, null);
}
}
_migrateProfiles(oldProfile, secureProfile, cb);
});
});
}); });
}; };