From 8092d9e5a7c983799d76816c08f8d644a69244f3 Mon Sep 17 00:00:00 2001 From: Ldoppea Date: Wed, 4 Dec 2024 16:16:54 +0100 Subject: [PATCH] feat: Migrate Offline's platform storage from AsyncStorage to MMKV --- src/pouchdb/platformReactNative.storage.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pouchdb/platformReactNative.storage.ts b/src/pouchdb/platformReactNative.storage.ts index f294bc4ca..ce945c804 100644 --- a/src/pouchdb/platformReactNative.storage.ts +++ b/src/pouchdb/platformReactNative.storage.ts @@ -1,14 +1,14 @@ -import AsyncStorage from '@react-native-async-storage/async-storage' +import { storage as mmkvStorage } from '/libs/localStore' export const storage = { getItem: async (key: string): Promise => { - return AsyncStorage.getItem(key) + return Promise.resolve(mmkvStorage.getString(key) ?? null) }, setItem: async (key: string, value: string | undefined): Promise => { if (value === undefined) return - return AsyncStorage.setItem(key, value) + return Promise.resolve(mmkvStorage.set(key, value)) }, removeItem: async (key: string): Promise => { - return AsyncStorage.removeItem(key) + return Promise.resolve(mmkvStorage.delete(key)) } }