[Bugfix] Fix forced Hindi timestamps

This commit is contained in:
Beef 2023-03-07 23:12:41 +00:00
parent 293c256dc9
commit 2201ff3a1d
6 changed files with 38 additions and 42 deletions

View file

@ -1,28 +0,0 @@
// Based on https://github.com/Aliucord/AliucordRN/blob/main/src/ui/patchTheme.ts
// Literally could not figure this out, many thanks
import { FluxDispatcher } from "@metro/common";
import { findByProps, findByStoreName } from "@metro/filters";
import logger from "@lib/logger";
// TODO: Move these to common modules?
const ThemeManager = findByProps("updateTheme", "overrideTheme");
const AMOLEDThemeManager = findByProps("setAMOLEDThemeEnabled");
const ThemeStore = findByStoreName("ThemeStore");
const UnsyncedUserSettingsStore = findByStoreName("UnsyncedUserSettingsStore");
function override() {
const theme = ThemeStore.theme || "dark";
ThemeManager.overrideTheme(theme);
if (AMOLEDThemeManager && UnsyncedUserSettingsStore.useAMOLEDTheme === 2) AMOLEDThemeManager.setAMOLEDThemeEnabled(true);
FluxDispatcher.unsubscribe("I18N_LOAD_START", override);
}
export default function fixTheme() {
try {
if (ThemeStore) FluxDispatcher.subscribe("I18N_LOAD_START", override);
} catch(e) {
logger.error("Failed to fix theme...", e)
}
}