Working pretty roughly on iOS with cordova-plugin-secure-storage.

This commit is contained in:
Brendon Duncan 2018-05-31 17:53:58 +12:00
commit 90d321033b
3 changed files with 104 additions and 4 deletions

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.services')
.factory('storageService', function(logHeader, fileStorageService, localStorageService, sjcl, $log, lodash, platformInfo, $timeout) {
.factory('storageService', function(logHeader, fileStorageService, localStorageService, sjcl, $log, lodash, platformInfo, secureStorageService, $timeout) {
var root = {};
var storage;
@ -116,15 +116,21 @@ angular.module('copayApp.services')
};
root.storeNewProfile = function(profile, cb) {
storage.create('profile', profile.toObj(), cb);
//storage.create('profile', profile.toObj(), cb);
secureStorageService.set('profile', profile.toObj(), cb);
};
root.storeProfile = function(profile, cb) {
storage.set('profile', profile.toObj(), cb);
//storage.set('profile', profile.toObj(), cb);
secureStorageService.set('profile', profile.toObj(), cb);
};
root.getProfile = function(cb) {
storage.get('profile', function(err, str) {
$log.debug("getProfile() 31 7");
//storage.get('profile', function(err, str) {
secureStorageService.get('profile', function(err, str) {
if (err || !str)
return cb(err);