From 100d8967ba168e699d8c05b2d1c9dfb5890aadd5 Mon Sep 17 00:00:00 2001 From: amsyarasyiq <82711525+amsyarasyiq@users.noreply.github.com> Date: Thu, 7 Mar 2024 09:38:44 +0800 Subject: [PATCH] whoops --- src/core/ui/settings/data.tsx | 18 +++++++++--------- src/lib/ui/color.ts | 4 ++-- src/lib/ui/styles.ts | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/core/ui/settings/data.tsx b/src/core/ui/settings/data.tsx index 60e81cc..1054845 100644 --- a/src/core/ui/settings/data.tsx +++ b/src/core/ui/settings/data.tsx @@ -26,7 +26,7 @@ const { useSafeAreaInsets } = findByProps("useSafeAreaInsets"); interface Screen { [index: string]: any; key: string; - title: string; + title: () => string; icon?: string; shouldRender?: () => boolean; options?: Record; @@ -48,13 +48,13 @@ const keyMap = (screens: Screen[], data: string | ((s: Screen) => any) | null) = export const getScreens = (): Screen[] => [ { key: "VendettaSettings", - title: Strings.GENERAL, + title: () => Strings.GENERAL, icon: "settings", render: General, }, { key: "VendettaPlugins", - title: Strings.PLUGINS, + title: () => Strings.PLUGINS, icon: "debug", options: { headerRight: () => ( @@ -81,7 +81,7 @@ export const getScreens = (): Screen[] => [ }, { key: "VendettaThemes", - title: Strings.THEMES, + title: () => Strings.THEMES, icon: "ic_theme_24px", // TODO: bad shouldRender: () => isThemeSupported(), @@ -92,14 +92,14 @@ export const getScreens = (): Screen[] => [ }, { key: "VendettaDeveloper", - title: Strings.DEVELOPER, + title: () => Strings.DEVELOPER, icon: "ic_progress_wrench_24px", shouldRender: () => settings.developerSettings ?? false, render: Developer, }, { key: "VendettaCustomPage", - title: "Vendetta Page", + title: () => "Vendetta Page", shouldRender: () => false, render: ({ render: PageView, noErrorBoundary, ...options }: { render: React.ComponentType; noErrorBoundary: boolean; } & Record) => { const navigation = NavigationNative.useNavigation(); @@ -111,7 +111,7 @@ export const getScreens = (): Screen[] => [ ]; export const getPanelsScreens = () => keyMap(getScreens(), s => ({ - title: s.title, + title: s.title(), render: s.render, ...s.options, })); @@ -128,7 +128,7 @@ export const getYouData = () => { // We can't use our keyMap function here since `settings` is an array not an object settings: screens.map(s => s.key) }), - titleConfig: keyMap(screens, "title"), + titleConfig: keyMap(screens, s => s.title()), relationships: keyMap(screens, null), rendererConfigs: keyMap(screens, s => { const WrappedComponent = React.memo(({ navigation, route }: any) => { @@ -142,7 +142,7 @@ export const getYouData = () => { return { type: "route", - title: () => s.title, + title: s.title, icon: s.icon ? getAssetIDByName(s.icon) : null, usePredicate: s.shouldRender && (() => useProxy(settings) && s.shouldRender!!()), screen: { diff --git a/src/lib/ui/color.ts b/src/lib/ui/color.ts index ce5d339..7765e91 100644 --- a/src/lib/ui/color.ts +++ b/src/lib/ui/color.ts @@ -20,10 +20,10 @@ export const rawColors = (color?.default?.unsafe_rawColors ?? constants?.Colors) const ThemeStore = findByStoreName("ThemeStore"); const colorResolver = color.default.internal ??= color.default.meta; -export function isSemanticColor(sym: Symbol): boolean { +export function isSemanticColor(sym: any): boolean { return colorResolver.isSemanticColor(sym); } -export function resolveSemanticColor(sym: Symbol, theme = ThemeStore.theme): string { +export function resolveSemanticColor(sym: any, theme = ThemeStore.theme): string { return colorResolver.resolveSemanticColor(theme, sym); } diff --git a/src/lib/ui/styles.ts b/src/lib/ui/styles.ts index 471088f..0939827 100644 --- a/src/lib/ui/styles.ts +++ b/src/lib/ui/styles.ts @@ -21,7 +21,7 @@ export function createThemedStyleSheet>(shee sheet[key] = new Proxy(StyleSheet.flatten(sheet[key]), { get(target, prop, receiver) { const res = Reflect.get(target, prop, receiver); - return typeof res === "symbol" && isSemanticColor(res) ? resolveSemanticColor(res) : res; + return isSemanticColor(res) ? resolveSemanticColor(res) : res; } }); }