feat: warn user to update loader if native cache format is outdated

This commit is contained in:
PalmDevs 2026-08-02 17:10:53 +07:00
parent ed9f4dee43
commit 54f5d94205
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA
3 changed files with 33 additions and 3 deletions

View file

@ -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(() => {

View file

@ -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(() => {

View file

@ -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',
<LoaderOutdatedModal />,
)
})
}
},
},
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 (
<Design.AlertModal
title="Loader Outdated"
content={`Your loader is outdated. Update to the latest version to receive fixes and ensure compatibility with all plugins.\n\nYou're currently running ${info.name} v${info.version}`}
actions={
<Design.AlertActionButton variant="primary" text="Got it" />
}
/>
)
}