From 54f5d94205330f3941a73460f82d5e7e186aceba Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Sun, 2 Aug 2026 17:10:53 +0700 Subject: [PATCH] feat: warn user to update loader if native cache format is outdated --- lib/assets/src/caches.ts | 4 +++- lib/modules/src/caches.ts | 4 +++- src/plugins/start/recovery/index.tsx | 28 +++++++++++++++++++++++++++- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/lib/assets/src/caches.ts b/lib/assets/src/caches.ts index 1fc3d43..135d0aa 100644 --- a/lib/assets/src/caches.ts +++ b/lib/assets/src/caches.ts @@ -18,7 +18,7 @@ export let cache: Cache = callNativeMethodSync('revenge.caches.assets.read', []) ?? Uncached if (cache.version !== ExpectedCacheVersion) { - // TODO: Alert to user to update build + Uncached.outdated = true cache = Uncached } @@ -29,6 +29,8 @@ export interface Cache { } } version: number + /** Indicates if the loader cache on an outdated format */ + outdated?: boolean } const save = debounce(() => { diff --git a/lib/modules/src/caches.ts b/lib/modules/src/caches.ts index fad3e7a..604b922 100644 --- a/lib/modules/src/caches.ts +++ b/lib/modules/src/caches.ts @@ -20,7 +20,7 @@ export let cache: Cache = callNativeMethodSync('revenge.caches.modules.read', []) ?? Uncached if (cache.version !== ExpectedCacheVersion) { - // TODO: Alert to user to update build + Uncached.outdated = true cache = Uncached } @@ -34,6 +34,8 @@ export interface Cache { blacklist: Blacklist finds: Finds version: number + /** Indicates if the loader cache on an outdated format */ + outdated?: boolean } const save = debounce(() => { diff --git a/src/plugins/start/recovery/index.tsx b/src/plugins/start/recovery/index.tsx index e9ac4a8..188c282 100644 --- a/src/plugins/start/recovery/index.tsx +++ b/src/plugins/start/recovery/index.tsx @@ -6,7 +6,7 @@ import { onSettingsModulesLoaded, registerSettingsItem, } from '@revenge-mod/discord/modules/settings' -import { callNativeMethod } from '@revenge-mod/modules/native' +import { callNativeMethod, getBridgeInfo } from '@revenge-mod/modules/native' import { InternalPluginFlags, isDefaultsOnlyBoot, @@ -16,6 +16,8 @@ import { import { asap } from '@revenge-mod/utils/callback' import { AppState } from 'react-native' import { FullVersion } from '~constants' +import { cache as assetsCache } from '../../../../lib/assets/src/caches' +import { cache as modulesCache } from '../../../../lib/modules/src/caches' import { mErrorChain } from '../../../../lib/modules/src/metro/runtime' import pluginSettings from '../settings' import { Setting } from '../settings/constants' @@ -51,6 +53,15 @@ registerInternalPlugin( ) }) } + + if (assetsCache.outdated || modulesCache.outdated) { + asap(() => { + AlertActionCreators.openAlert( + 'revenge-loader-outdated', + , + ) + }) + } }, }, PluginFlags.Enabled, @@ -133,3 +144,18 @@ function RecoveryModal() { /> ) } + +function LoaderOutdatedModal() { + const info = getBridgeInfo() + if (!info) throw new Error('Failed to get native bridge info') + + return ( + + } + /> + ) +}