decord/source/modules/client_themes/native/MobileThemesUtils.tsx

107 lines
4.2 KiB
TypeScript
Raw Normal View History

2026-07-25 08:10:48 +00:00
// Module ID: 4064
2026-07-27 11:26:19 +00:00
// Function ID: 33851
2026-07-20 16:05:17 +00:00
// Name: getCustomThemesName
2026-07-25 08:10:48 +00:00
// Dependencies: [1278, 4065, 1322, 3944, 1212, 2397, 3945, 4066, 566, 1324, 2]
2026-07-20 16:05:17 +00:00
// Exports: getAllMobileThemes, useAllMobileThemes
2026-07-25 08:10:48 +00:00
// Module 4064 (getCustomThemesName)
2026-07-23 10:11:24 +00:00
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import closure_4 from "_isNativeReflectConstruct";
import closure_5 from "_isNativeReflectConstruct";
import items1 from "items1";
let closure_6;
let closure_7;
let closure_8;
const require = arg1;
2026-07-20 16:05:17 +00:00
function getCustomThemesName() {
2026-07-23 10:11:24 +00:00
const intl = require(1212) /* getSystemLocale */.intl;
2026-07-25 08:10:48 +00:00
return intl.string(importDefault(2397).yl1iMm);
2026-07-20 16:05:17 +00:00
}
function getCustomBackgroundGradient() {
2026-07-23 10:11:24 +00:00
customThemeDisplaySettings = customThemeDisplaySettings.getCustomThemeDisplaySettings();
2026-07-20 16:05:17 +00:00
let tmp2 = null;
if (undefined !== customThemeDisplaySettings) {
2026-07-25 08:10:48 +00:00
const obj = { type: require(3945) /* ClientThemeType */.ClientThemeType.CUSTOM_BACKGROUND_GRADIENT, getName: getCustomThemesName };
2026-07-20 16:05:17 +00:00
({ baseTheme: obj.theme, customTheme: obj.customThemeSettings } = customThemeDisplaySettings);
tmp2 = obj;
}
return tmp2;
}
function useCustomBackgroundGradient(base_theme) {
2026-07-25 08:10:48 +00:00
let obj = require(4066) /* useCustomThemeDisplaySettings */;
2026-07-20 16:05:17 +00:00
const customThemeDisplaySettings = obj.useCustomThemeDisplaySettings(base_theme);
let tmp2 = null;
if (undefined !== customThemeDisplaySettings) {
2026-07-25 08:10:48 +00:00
obj = { type: require(3945) /* ClientThemeType */.ClientThemeType.CUSTOM_BACKGROUND_GRADIENT, getName: getCustomThemesName };
2026-07-20 16:05:17 +00:00
({ baseTheme: obj2.theme, customTheme: obj2.customThemeSettings } = customThemeDisplaySettings);
tmp2 = obj;
}
return tmp2;
}
function usePerModeCustomBackgroundGradient(mode) {
2026-07-23 10:11:24 +00:00
const _require = mode;
const items = [_isNativeReflectConstruct];
return _require(566).useStateFromStores(items, () => {
if (null == mode) {
2026-07-20 16:05:17 +00:00
return null;
} else {
2026-07-23 10:11:24 +00:00
const syncedClientTheme = outer1_3.getSyncedClientTheme(mode);
2026-07-20 16:05:17 +00:00
let prop;
if (null != syncedClientTheme) {
prop = syncedClientTheme.customUserThemeSettings;
}
let tmp2 = null;
if (null != prop) {
tmp2 = null;
if (0 !== prop.colors.length) {
2026-07-23 10:11:24 +00:00
const obj = { type: mode(outer1_2[6]).ClientThemeType.CUSTOM_BACKGROUND_GRADIENT, getName: outer1_9, theme: outer1_3.themePreferenceForSystemTheme(mode), customThemeSettings: prop };
2026-07-20 16:05:17 +00:00
tmp2 = obj;
}
}
return tmp2;
}
});
}
function getMobileThemesArrayWithMaybeCustomTheme(arg0, arg1) {
const tmp = arg1 ? closure_8 : closure_7;
if (null != arg0) {
const items = [];
let arraySpreadResult = HermesBuiltin.arraySpread(tmp, 0);
items[arraySpreadResult] = arg0;
arraySpreadResult = HermesBuiltin.arraySpread(closure_6, arraySpreadResult + 1);
let items1 = items;
} else {
items1 = [];
HermesBuiltin.arraySpread(closure_6, HermesBuiltin.arraySpread(tmp, 0));
}
return items1;
}
function useSavedCustomTheme() {
const items = [closure_4];
2026-07-23 10:11:24 +00:00
const stateFromStores = require(566) /* initialize */.useStateFromStores(items, () => outer1_4.getSavedCustomTheme());
2026-07-20 16:05:17 +00:00
let tmp2 = null;
if (null != stateFromStores) {
tmp2 = stateFromStores;
}
return tmp2;
}
2026-07-23 10:11:24 +00:00
({ BACKGROUND_GRADIENT_PRESETS_MOBILE: closure_6, LEGACY_STANDARD_BACKGROUND_THEMES: closure_7, REFRESH_STANDARD_BACKGROUND_THEMES: closure_8 } = items1);
const result = require("_isNativeReflectConstruct").fileFinishedImporting("modules/client_themes/native/MobileThemesUtils.tsx");
2026-07-20 16:05:17 +00:00
export { getCustomBackgroundGradient };
export { useCustomBackgroundGradient };
export { usePerModeCustomBackgroundGradient };
export const getAllMobileThemes = function getAllMobileThemes() {
const tmp = getCustomBackgroundGradient();
2026-07-23 10:11:24 +00:00
return getMobileThemesArrayWithMaybeCustomTheme(tmp, require(1324) /* useIsMobileVisualRefreshExperimentEnabled */.isMobileVisualRefreshEnabled("MobileThemesUtils"));
2026-07-20 16:05:17 +00:00
};
export const useAllMobileThemes = function useAllMobileThemes(mode) {
let tmp = useCustomBackgroundGradient(useSavedCustomTheme());
if (null != mode) {
tmp = usePerModeCustomBackgroundGradient(mode);
}
2026-07-23 10:11:24 +00:00
return getMobileThemesArrayWithMaybeCustomTheme(tmp, importDefault(1324)("MobileThemesUtils"));
2026-07-20 16:05:17 +00:00
};
export { useSavedCustomTheme };