From 1a873874e5776ec4fe728c0f51ffd406c7443f37 Mon Sep 17 00:00:00 2001 From: Ritesh Shukla Date: Sun, 14 Dec 2025 03:25:17 +0530 Subject: [PATCH] MMKV to V4 (#823) * fix: plugins * fix: plugins * update locks --------- Co-authored-by: Violet Caulfield --- bun.lock | 4 +- ios/Podfile.lock | 70 ++++++++++--------- package.json | 2 +- .../mutations/download/offlineModeUtils.ts | 6 +- .../Settings/components/labs-tab.tsx | 2 +- src/constants/storage.ts | 7 +- src/constants/versioned-storage.ts | 15 ++-- 7 files changed, 58 insertions(+), 48 deletions(-) diff --git a/bun.lock b/bun.lock index 16eb4210..e657eb3e 100644 --- a/bun.lock +++ b/bun.lock @@ -43,7 +43,7 @@ "react-native-google-cast": "^4.9.1", "react-native-haptic-feedback": "^2.3.3", "react-native-linear-gradient": "^2.8.3", - "react-native-mmkv": "3.3.3", + "react-native-mmkv": "^4.1.0", "react-native-nitro-fetch": "^0.1.6", "react-native-nitro-modules": "0.31.10", "react-native-nitro-ota": "0.7.2", @@ -1926,7 +1926,7 @@ "react-native-linear-gradient": ["react-native-linear-gradient@2.8.3", "", { "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-KflAXZcEg54PXkLyflaSZQ3PJp4uC4whM7nT/Uot9m0e/qxFV3p6uor1983D1YOBJbJN7rrWdqIjq0T42jOJyA=="], - "react-native-mmkv": ["react-native-mmkv@3.3.3", "", { "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-GMsfOmNzx0p5+CtrCFRVtpOOMYNJXuksBVARSQrCFaZwjUyHJdQzcN900GGaFFNTxw2fs8s5Xje//RDKj9+PZA=="], + "react-native-mmkv": ["react-native-mmkv@4.1.0", "", { "peerDependencies": { "react": "*", "react-native": "*", "react-native-nitro-modules": "*" } }, "sha512-ia76WnU6dkLZxFkSSflxqFgHT2pIaML763aucEu7nMglF41oEWTdTtBu0o8a1cxbhZOaONk6KF8RQp5fLvPitA=="], "react-native-nitro-fetch": ["react-native-nitro-fetch@0.1.6", "", { "peerDependencies": { "react": "*", "react-native": "*", "react-native-nitro-modules": "^0.29.2", "react-native-worklets-core": "^1.6.0" }, "optionalPeers": ["react-native-worklets-core"] }, "sha512-DbE/vN5B67SJM8Q0myHOwSSc7ASqJPaKYXVsWdNGIPS+csr9gygCKILT4RQ+xZ92iJGKn4bfyq+rRsacRWBV9A=="], diff --git a/ios/Podfile.lock b/ios/Podfile.lock index edd12f6d..6f7b1897 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -12,6 +12,7 @@ PODS: - hermes-engine (0.14.0): - hermes-engine/Pre-built (= 0.14.0) - hermes-engine/Pre-built (0.14.0) + - MMKVCore (2.2.4) - NitroFetch (0.1.6): - boost - DoubleConversion @@ -42,6 +43,37 @@ PODS: - ReactCommon/turbomodule/core - SocketRocket - Yoga + - NitroMmkv (4.1.0): + - boost + - DoubleConversion + - fast_float + - fmt + - glog + - hermes-engine + - MMKVCore (= 2.2.4) + - NitroModules + - RCT-Folly + - RCT-Folly/Fabric + - RCTRequired + - RCTTypeSafety + - React-callinvoker + - React-Core + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-ImageManager + - React-jsi + - React-NativeModulesApple + - React-RCTFabric + - React-renderercss + - React-rendererdebug + - React-utils + - ReactCodegen + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - SocketRocket + - Yoga - NitroModules (0.31.10): - boost - DoubleConversion @@ -2084,34 +2116,6 @@ PODS: - google-cast-sdk - PromisesObjC - React - - react-native-mmkv (3.3.3): - - boost - - DoubleConversion - - fast_float - - fmt - - glog - - hermes-engine - - RCT-Folly - - RCT-Folly/Fabric - - RCTRequired - - RCTTypeSafety - - React-Core - - React-debug - - React-Fabric - - React-featureflags - - React-graphics - - React-ImageManager - - React-jsi - - React-NativeModulesApple - - React-RCTFabric - - React-renderercss - - React-rendererdebug - - React-utils - - ReactCodegen - - ReactCommon/turbomodule/bridging - - ReactCommon/turbomodule/core - - SocketRocket - - Yoga - react-native-netinfo (11.4.1): - React-Core - react-native-pager-view (7.0.2): @@ -3251,6 +3255,7 @@ DEPENDENCIES: - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) - hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`) - NitroFetch (from `../node_modules/react-native-nitro-fetch`) + - NitroMmkv (from `../node_modules/react-native-mmkv`) - NitroModules (from `../node_modules/react-native-nitro-modules`) - NitroOta (from `../node_modules/react-native-nitro-ota`) - NitroOtaBundleManager (from `../node_modules/react-native-nitro-ota`) @@ -3297,7 +3302,6 @@ DEPENDENCIES: - react-native-carplay (from `../node_modules/react-native-carplay`) - react-native-config (from `../node_modules/react-native-config`) - react-native-google-cast (from `../node_modules/react-native-google-cast`) - - react-native-mmkv (from `../node_modules/react-native-mmkv`) - "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)" - react-native-pager-view (from `../node_modules/react-native-pager-view`) - react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`) @@ -3355,6 +3359,7 @@ DEPENDENCIES: SPEC REPOS: trunk: - google-cast-sdk + - MMKVCore - PromisesObjC - Protobuf - SDWebImage @@ -3383,6 +3388,8 @@ EXTERNAL SOURCES: :tag: hermes-v0.14.0 NitroFetch: :path: "../node_modules/react-native-nitro-fetch" + NitroMmkv: + :path: "../node_modules/react-native-mmkv" NitroModules: :path: "../node_modules/react-native-nitro-modules" NitroOta: @@ -3473,8 +3480,6 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native-config" react-native-google-cast: :path: "../node_modules/react-native-google-cast" - react-native-mmkv: - :path: "../node_modules/react-native-mmkv" react-native-netinfo: :path: "../node_modules/@react-native-community/netinfo" react-native-pager-view: @@ -3588,7 +3593,9 @@ SPEC CHECKSUMS: glog: 5683914934d5b6e4240e497e0f4a3b42d1854183 google-cast-sdk: 1fb6724e94cc5ff23b359176e0cf6360586bb97a hermes-engine: 83ac7cadb2a3a158ae6d9e4192417c5232065e99 + MMKVCore: f2dd4c9befea04277a55e84e7812f930537993df NitroFetch: 660adfb47f84b28db664f97b50e5dc28506ab6c1 + NitroMmkv: ce1df9b9f0e06dfbde2455d863047e0411fceb6e NitroModules: 5bc319d441f4983894ea66b1d392c519536e6d23 NitroOta: 7755c4728f7348584cebb2d428480b1ed0cd2679 NitroOtaBundleManager: 482abb17f0ca629ad551da43f13e76e59dba9568 @@ -3636,7 +3643,6 @@ SPEC CHECKSUMS: react-native-carplay: 8f388f6f73e5e0f73ed154ad8794371343ee20c0 react-native-config: f1dde39f8468ad922fc7e8bd4308c8e6223d5ee8 react-native-google-cast: 7be68a5d0b7eeb95a5924c3ecef8d319ef6c0a44 - react-native-mmkv: ac7507625cd74bac0eb5333604a7cd7b08fe9e3e react-native-netinfo: cec9c4e86083cb5b6aba0e0711f563e2fbbff187 react-native-pager-view: 5c3098839820aa73d75873e7b1a7eb9f119602b7 react-native-safe-area-context: c00143b4823773bba23f2f19f85663ae89ceb460 diff --git a/package.json b/package.json index c8970e28..86dad27e 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "react-native-google-cast": "^4.9.1", "react-native-haptic-feedback": "^2.3.3", "react-native-linear-gradient": "^2.8.3", - "react-native-mmkv": "3.3.3", + "react-native-mmkv": "^4.1.0", "react-native-nitro-fetch": "^0.1.6", "react-native-nitro-modules": "0.31.10", "react-native-nitro-ota": "0.7.2", diff --git a/src/api/mutations/download/offlineModeUtils.ts b/src/api/mutations/download/offlineModeUtils.ts index 97e886dd..be982230 100644 --- a/src/api/mutations/download/offlineModeUtils.ts +++ b/src/api/mutations/download/offlineModeUtils.ts @@ -1,4 +1,4 @@ -import { MMKV } from 'react-native-mmkv' +import { createMMKV } from 'react-native-mmkv' import RNFS from 'react-native-fs' import JellifyTrack from '../../../types/JellifyTrack' @@ -117,7 +117,7 @@ export async function downloadJellyfinFile( } } -const mmkv = new MMKV({ +const mmkv = createMMKV({ id: 'offlineMode', encryptionKey: 'offlineMode', }) @@ -309,7 +309,7 @@ export const deleteDownloadsByIds = async ( export const deleteAudioCache = async (): Promise => { const downloads = getAudioCache() const result = await deleteDownloadsByIds(downloads.map((download) => download.item.Id)) - mmkv.delete(MMKV_OFFLINE_MODE_KEYS.AUDIO_CACHE) + mmkv.remove(MMKV_OFFLINE_MODE_KEYS.AUDIO_CACHE) return result } diff --git a/src/components/Settings/components/labs-tab.tsx b/src/components/Settings/components/labs-tab.tsx index 2f311e4e..42c1120e 100644 --- a/src/components/Settings/components/labs-tab.tsx +++ b/src/components/Settings/components/labs-tab.tsx @@ -19,7 +19,7 @@ export default function LabsTab(): React.JSX.Element { children: (