Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

themer: fix #52

Closed
wants to merge 4 commits into from
Closed

themer: fix #52

wants to merge 4 commits into from

Conversation

nikosszzz
Copy link
Contributor

  • RN will explode

@@ -44,9 +44,9 @@ export function themerInit(constants: typeof Constants) {

const themeFile = JSON.parse(AliuFS.readFile(THEMES_DIRECTORY + file.name, "text") as string) as Theme;

if (!themeFile?.name || !themeFile?.theme_color_map || !themeFile?.colors) throw new Error(`Theme file ${file.name} does not contain a name, theme_color_map or colors key.`);
if (!themeFile?.name || !themeFile?.theme_color_map) throw new Error(`Theme file ${file.name} does not contain a name, theme_color_map or colors key.`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!themeFile?.name || !themeFile?.theme_color_map) throw new Error(`Theme file ${file.name} does not contain a name, theme_color_map or colors key.`);
if (!themeFile?.name || !(themeFile.theme_color_map || themeFile.color || themeFile.colour))
throw new Error(`Theme ${file.name} does not contain a name and neither a theme_color_map, color or colours key.`);

@@ -31,7 +31,7 @@ export function setTheme(theme: Theme) {
// WARNING: this function is called before the Aliucord loads, meaning we're having limited access.
export function themerInit(constants: typeof Constants) {
try {
if (!AliuFS.exists(SETTINGS_DIRECTORY + "Aliucord.json")) return;
if (!AliuFS.exists(SETTINGS_DIRECTORY + "Aliucord.json")) throw new Error("Settings file does not exist.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nop just return and set themeApplied = false; or whatever

@@ -56,7 +56,7 @@ export function themerInit(constants: typeof Constants) {
applyTheme();
}
} catch (e) {
themeApplied = false;
themerErrored = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what

if (currentTheme.theme_color_map[key]) {
discordConstants.ThemeColorMap[key][ThemeType.AMOLED] = currentTheme.theme_color_map[key]?.[ThemeType.DARK];
if (currentTheme.theme_color_map[key]?.[ThemeType.AMOLED]) discordConstants.ThemeColorMap[key][ThemeType.AMOLED] = currentTheme.theme_color_map[key]?.[ThemeType.AMOLED];
discordConstants.ThemeColorMap[key][ThemeType.LIGHT] = currentTheme.theme_color_map[key]?.[ThemeType.LIGHT];
discordConstants.ThemeColorMap[key][ThemeType.DARK] = currentTheme.theme_color_map[key]?.[ThemeType.DARK];
}
}

// Enmity compat
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should only do enmity compat if theme_color_map does not exist (aliu takes priority)

@amsyarasyiq amsyarasyiq mentioned this pull request Jan 8, 2023
@nikosszzz nikosszzz closed this Jan 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants