Skip to content

Commit

Permalink
whoops
Browse files Browse the repository at this point in the history
  • Loading branch information
pylixonly committed Mar 7, 2024
1 parent 8c8baae commit 100d896
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions src/core/ui/settings/data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, any>;
Expand All @@ -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: () => (
Expand All @@ -81,7 +81,7 @@ export const getScreens = (): Screen[] => [
},
{
key: "VendettaThemes",
title: Strings.THEMES,
title: () => Strings.THEMES,
icon: "ic_theme_24px",
// TODO: bad
shouldRender: () => isThemeSupported(),
Expand All @@ -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<string, object>) => {
const navigation = NavigationNative.useNavigation();
Expand All @@ -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,
}));
Expand All @@ -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) => {
Expand All @@ -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: {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/ui/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 1 addition & 1 deletion src/lib/ui/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function createThemedStyleSheet<T extends StyleSheet.NamedStyles<T>>(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;
}
});
}
Expand Down

0 comments on commit 100d896

Please sign in to comment.