Clear PatcherCache when changing settings

This commit is contained in:
redphx 2024-05-04 11:22:42 +07:00
parent f36c77e727
commit f6ee79770c

View File

@ -5,6 +5,7 @@ import { getPreferredServerRegion } from "@utils/region";
import { UserAgent, UserAgentProfile } from "@utils/user-agent"; import { UserAgent, UserAgentProfile } from "@utils/user-agent";
import { getPref, Preferences, PrefKey, setPref, toPrefElement } from "@utils/preferences"; import { getPref, Preferences, PrefKey, setPref, toPrefElement } from "@utils/preferences";
import { t, refreshCurrentLocale } from "@utils/translation"; import { t, refreshCurrentLocale } from "@utils/translation";
import { PatcherCache } from "../patcher";
const SETTINGS_UI = { const SETTINGS_UI = {
'Better xCloud': { 'Better xCloud': {
@ -159,6 +160,9 @@ export function setupSettingsUi() {
$reloadBtnWrapper.classList.remove('bx-gone'); $reloadBtnWrapper.classList.remove('bx-gone');
// Clear PatcherCache;
PatcherCache.clear();
if ((e.target as HTMLElement).id === 'bx_setting_' + PrefKey.BETTER_XCLOUD_LOCALE) { if ((e.target as HTMLElement).id === 'bx_setting_' + PrefKey.BETTER_XCLOUD_LOCALE) {
// Update locale // Update locale
refreshCurrentLocale(); refreshCurrentLocale();