Loading...
Loading...
Handles MMKV storage operations and data persistence patterns with encryption. Use when implementing data persistence, caching, or user preferences in Fitness Tracker App.
npx skill4agent add planeinabottle/fitnessmobileapp react-native-storage-managerapp/utils/storage/index.tsimport * as SecureStore from "expo-secure-store"
import { MMKV } from "react-native-mmkv"
export const storage = new MMKV({
id: "purrsuit-storage",
encryptionKey: SecureStore.getItem("mmkv-encryption-key"),
})@/utils/storageimport { save, saveString } from "@/utils/storage"
save("user_preferences", { theme: "dark", notifications: true })
saveString("auth_token", "secure-token-here")import { load, loadString } from "@/utils/storage"
const prefs = load<{ theme: string }>("user_preferences")
const token = loadString("auth_token")import { remove, clear } from "@/utils/storage"
remove("auth_token")
clear() // Clear all data// app/utils/storage/keys.ts
export const STORAGE_KEYS = {
USER_PREFS: "user_preferences",
AUTH_TOKEN: "auth_token",
ENCOUNTERS_CACHE: "workouts_cache",
} as constonSnapshotafterCreate