[settings] Add Experiments as a core feature
This commit is contained in:
parent
5169bfadf4
commit
c675172309
4 changed files with 30 additions and 1 deletions
|
|
@ -54,6 +54,7 @@
|
|||
"MACHINE_ID": "Machine ID",
|
||||
"MANUFACTURER": "Manufacturer",
|
||||
"MESSAGE": "Message",
|
||||
"MISCELLANEOUS": "Miscellaneous",
|
||||
"MODAL_THEME_REFETCHED": "Theme refetched",
|
||||
"MODAL_THEME_REFETCHED_DESC": "A reload is required to see the changes. Do you want to reload now?",
|
||||
"MODAL_UNPROXIED_PLUGIN_DESC": "The plugin you are trying to install has not been proxied/verified by staffs. Are you sure you want to continue?",
|
||||
|
|
@ -77,6 +78,8 @@
|
|||
"SAFE_MODE_NOTICE_PLUGINS": "You are in Safe Mode, so plugins cannot be loaded. Disable any misbehaving plugins, then return to Normal Mode from the General settings page.",
|
||||
"SAFE_MODE_NOTICE_THEMES": "You are in Safe Mode, meaning themes have been temporarily disabled. {enabled, select, true {If a theme appears to be causing the issue, you can press below to disable it persistently.} false {}}",
|
||||
"SEARCH": "Search",
|
||||
"SETTINGS_ACTIVATE_DISCORD_EXPERIMENTS": "Activate Discord Experiments",
|
||||
"SETTINGS_ACTIVATE_DISCORD_EXPERIMENTS_DESC": "Warning: Messing with this feature may lead to account termination. We are not responsible for what you do with this feature.",
|
||||
"STACK_TRACE": "Stack Trace",
|
||||
"SUCCESSFULLY_INSTALLED": "Successfully installed",
|
||||
"THEME_REFETCH_FAILED": "Failed to refetch theme!",
|
||||
|
|
|
|||
|
|
@ -84,6 +84,18 @@ export default function General() {
|
|||
}}
|
||||
/>
|
||||
</TableRowGroup>
|
||||
<TableRowGroup title={Strings.MISCELLANEOUS}>
|
||||
<TableSwitchRow
|
||||
label={Strings.SETTINGS_ACTIVATE_DISCORD_EXPERIMENTS}
|
||||
subLabel={Strings.SETTINGS_ACTIVATE_DISCORD_EXPERIMENTS_DESC}
|
||||
icon={<TableRow.Icon source={getAssetIDByName("ic_progress_wrench_24px")} />}
|
||||
value={settings.enableDiscordDeveloperSettings}
|
||||
onValueChange={(v: boolean) => {
|
||||
settings.enableDiscordDeveloperSettings = v;
|
||||
}}
|
||||
/>
|
||||
</TableRowGroup>
|
||||
|
||||
</Stack>
|
||||
</ScrollView>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { instead } from "@lib/api/patcher";
|
||||
|
||||
|
||||
export type MetroModules = { [id: string]: any; };
|
||||
export type PropIntellisense<P extends string | symbol> = Record<P, any> & Record<PropertyKey, any>;
|
||||
export type PropsFinder = <T extends string | symbol>(...props: T[]) => PropIntellisense<T>;
|
||||
|
|
@ -42,6 +41,20 @@ const onModuleCheck = (exports: any) => {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (exports?.default?.constructor?.displayName === "DeveloperExperimentStore") {
|
||||
exports.default = new Proxy(exports.default, {
|
||||
get: (target, property, receiver) => {
|
||||
if (property === "isDeveloper") {
|
||||
// Hopefully won't explode accessing it here :3
|
||||
const { settings } = require("@lib/settings");
|
||||
return settings.enableDiscordDeveloperSettings ?? false;
|
||||
}
|
||||
|
||||
return Reflect.get(target, property, receiver);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function maybeInitializeModule(id: string) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { createFileBackend, createMMKVBackend, createStorage, wrapSync } from "@
|
|||
export interface Settings {
|
||||
debuggerUrl: string;
|
||||
developerSettings: boolean;
|
||||
enableDiscordDeveloperSettings: boolean;
|
||||
safeMode?: {
|
||||
enabled: boolean;
|
||||
currentThemeId?: string;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue