Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix Storage

ammarahm-ed16716d849fe9
diff --git a/apps/mobile/src/services/BiometricService.js b/apps/mobile/src/services/BiometricService.js
index dcc6539f1..9253cec0a 100644
--- a/apps/mobile/src/services/BiometricService.js
+++ b/apps/mobile/src/services/BiometricService.js
@@ -3,6 +3,7 @@ import Storage from '../utils/storage';
import {ToastEvent} from './EventManager';
import * as Keychain from 'react-native-keychain';
import {Platform} from 'react-native';
+import { MMKV } from '../utils/mmkv';
const CRYPT_CONFIG = Platform.select({
ios: {
@@ -27,7 +28,7 @@ async function enableFingerprintAuth() {
}
async function isFingerprintAuthEnabled() {
- return await Storage.read('fingerprintAuthEnabled', 'enabled');
+ return await MMKV.getStringAsync('fingerprintAuthEnabled', 'enabled');
}
async function storeCredentials(password) {
diff --git a/apps/mobile/src/utils/Storage.js b/apps/mobile/src/utils/Storage.js
index b1f48710a..b09465c82 100644
--- a/apps/mobile/src/utils/Storage.js
+++ b/apps/mobile/src/utils/Storage.js
@@ -7,12 +7,14 @@ import Sodium from 'react-native-sodium';
import * as Keychain from 'react-native-keychain';
let RNFetchBlob;
-async function read(key, isArray = false) {
+async function read(key) {
let data = await MMKV.getItem(key);
if (!data) return null;
-
- data = JSON.parse(data);
- return data;
+ try {
+ return JSON.parse(data);
+ } catch(e) {
+ return data;
+ }
}
async function write(key, data) {