This repository has no description
Something went wrong. Try again.
9.9 kB · 269 lines
TypeScript
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270// SPDX-License-Identifier: AGPL-3.0-or-later
import type {DeveloperOptionsState} from '@app/features/devtools/state/DeveloperOptions';import type {MessageDescriptor} from '@lingui/core';import {msg} from '@lingui/core/macro';
const ENABLE_SELF_HOSTED_MODE_CLIENT_SIDE_HIDES_ALL_DESCRIPTOR = msg({ message: 'Enable self-hosted mode client-side. Hides all premium and billing UI.', comment: 'Developer / debug surface — keep terse and technical. Tooltip / description for the self-hosted mode override toggle.',});const ALWAYS_SHOW_THE_VANITY_URL_DISCLAIMER_WARNING_IN_DESCRIPTOR = msg({ message: 'Always show the vanity URL disclaimer warning in community settings.', comment: 'Developer / debug surface — keep terse and technical. Tooltip / description for forcing the vanity-URL disclaimer in community settings.',});const ALWAYS_SHOW_THE_PROFILE_DATA_WARNING_INDICATOR_EVEN_DESCRIPTOR = msg({ message: 'Always show the profile data warning indicator, even when the profile loads successfully.', comment: 'Developer / debug surface — keep terse and technical. Tooltip / description for forcing the profile-data warning indicator.',});const ALWAYS_SHOW_THE_PROFILE_LOADING_SKELETON_DESCRIPTOR = msg({ message: 'Always show the profile loading skeleton instead of resolved profile content.', comment: 'Developer / debug surface — keep terse and technical. Tooltip / description for forcing profile skeleton loading states.',});const RENDER_ALL_YOUR_MESSAGES_AS_AN_UNKNOWN_MESSAGE_DESCRIPTOR = msg({ message: 'Render all your messages as an unknown message type.', comment: 'Developer / debug surface — keep terse and technical. Tooltip / description for the force-unknown-message-type override.',});const ALWAYS_DISPLAY_THE_VOICE_CONNECTION_STATUS_BAR_IN_DESCRIPTOR = msg({ message: 'Always display the voice connection status bar in mocked mode.', comment: 'Developer / debug surface — keep terse and technical. Tooltip / description for forcing the voice connection status bar visible in mocked mode.',});const APP_STATE_DESCRIPTOR = msg({ message: 'App state', comment: 'Developer options group for overriding app/account state.',});const BYPASS_SPLASH_SCREEN_DESCRIPTOR = msg({ message: 'Bypass splash screen', comment: 'Developer option label.',});const FORCE_UPDATE_READY_DESCRIPTOR = msg({ message: 'Force update ready', comment: 'Developer option label for simulating an available update.',});const SHOW_MYSELF_TYPING_DESCRIPTOR = msg({ message: 'Show myself typing', comment: 'Developer option label for showing the current user as typing.',});const SELF_HOSTED_MODE_OVERRIDE_DESCRIPTOR = msg({ message: 'Self-hosted mode override', comment: 'Developer option label for forcing self-hosted client mode.',});const UI_COMPONENTS_DESCRIPTOR = msg({ message: 'UI components', comment: 'Developer options group for forcing UI component states.',});const FORCE_GIF_PICKER_LOADING_DESCRIPTOR = msg({ message: 'Force GIF picker loading', comment: 'Developer option label for simulating a loading GIF picker.',});const FORCE_SHOW_VANITY_URL_DISCLAIMER_DESCRIPTOR = msg({ message: 'Force show vanity URL disclaimer', comment: 'Developer option label for always showing a community settings warning.',});const NETWORKING_AND_PERFORMANCE_DESCRIPTOR = msg({ message: 'Networking and performance', comment: 'Developer options group for simulated slow or failed operations.',});const SLOW_MESSAGE_LOAD_DESCRIPTOR = msg({ message: 'Slow message load', comment: 'Developer option label for simulating slow message loading.',});const SLOW_MESSAGE_SEND_DESCRIPTOR = msg({ message: 'Slow message send', comment: 'Developer option label for simulating slow message sending.',});const SLOW_MESSAGE_EDIT_DESCRIPTOR = msg({ message: 'Slow message edit', comment: 'Developer option label for simulating slow message edits.',});const SLOW_ATTACHMENT_UPLOAD_DESCRIPTOR = msg({ message: 'Slow attachment upload', comment: 'Developer option label for simulating slow file uploads.',});const SLOW_PROFILE_LOAD_DESCRIPTOR = msg({ message: 'Slow profile load', comment: 'Developer option label for simulating slow profile loading.',});const FORCE_PROFILE_SKELETONS_DESCRIPTOR = msg({ message: 'Force profile skeletons', comment: 'Developer option label for forcing user profile loading skeletons.',});const FORCE_PROFILE_DATA_WARNING_DESCRIPTOR = msg({ message: 'Force profile data warning', comment: 'Developer option label for always showing profile data warnings.',});const FORCE_FAILED_MESSAGE_SENDS_DESCRIPTOR = msg({ message: 'Force failed message sends', comment: 'Developer option label for simulating failed message sends.',});const FORCE_FAILED_MESSAGE_LOADS_DESCRIPTOR = msg({ message: 'Force failed message loads', comment: 'Developer option label for simulating failed message loads.',});const FEATURES_DESCRIPTOR = msg({ message: 'Features', comment: 'Developer options group for feature behavior overrides.',});const FORCE_UNKNOWN_MESSAGE_TYPE_DESCRIPTOR = msg({ message: 'Force unknown message type', comment: 'Developer option label for rendering messages as unknown message types.',});const FORCE_SHOW_VOICE_CONNECTION_DESCRIPTOR = msg({ message: 'Force show voice connection', comment: 'Developer option label for always showing the voice connection status bar.',});const SHOW_EXPRESSION_PACKS_SETTINGS_DESCRIPTOR = msg({ message: 'Show expression packs settings', comment: 'Developer option label for exposing the staff-only Expression packs page in user settings.',});const SHOW_EXPRESSION_PACKS_SETTINGS_DESC_DESCRIPTOR = msg({ message: 'Expose the staff-only Expression packs page in user settings.', comment: 'Developer / debug surface — keep terse and technical. Tooltip / description for the Expression packs settings toggle.',});const SHOW_PROFILE_TIMEZONE_SETTINGS_DESCRIPTOR = msg({ message: 'Show profile timezone settings', comment: 'Developer option label for exposing the staff-only profile timezone section in profile settings.',});const SHOW_PROFILE_TIMEZONE_SETTINGS_DESC_DESCRIPTOR = msg({ message: 'Expose the staff-only timezone section in profile settings.', comment: 'Developer / debug surface — keep terse and technical. Tooltip / description for the profile timezone settings toggle.',});const NO_OP_IN_APP_REPORTS_DESCRIPTOR = msg({ message: 'No-op in-app reports', comment: 'Developer option label for short-circuiting the in-app reporting (IAR) flow. When enabled, submitting a report skips the network call.',});const NO_OP_IN_APP_REPORTS_DESC_DESCRIPTOR = msg({ message: 'Skip the network call when an in-app report is submitted. The flow still advances to the success screen so you can exercise the UI, but nothing is actually sent to the safety team.', comment: 'Developer / debug surface — keep terse and technical. Tooltip / description for the no-op in-app reports toggle.',});
interface ToggleDef { key: keyof DeveloperOptionsState; label: MessageDescriptor; description?: MessageDescriptor;}
export interface ToggleGroup { title: MessageDescriptor; items: Array<ToggleDef>;}
export const getToggleGroups = (): Array<ToggleGroup> => [ { title: APP_STATE_DESCRIPTOR, items: [ {key: 'bypassSplashScreen', label: BYPASS_SPLASH_SCREEN_DESCRIPTOR}, { key: 'forceUpdateReady', label: FORCE_UPDATE_READY_DESCRIPTOR, }, { key: 'showMyselfTyping', label: SHOW_MYSELF_TYPING_DESCRIPTOR, }, { key: 'selfHostedModeOverride', label: SELF_HOSTED_MODE_OVERRIDE_DESCRIPTOR, description: ENABLE_SELF_HOSTED_MODE_CLIENT_SIDE_HIDES_ALL_DESCRIPTOR, }, ], }, { title: UI_COMPONENTS_DESCRIPTOR, items: [ { key: 'forceGifPickerLoading', label: FORCE_GIF_PICKER_LOADING_DESCRIPTOR, }, { key: 'forceShowVanityURLDisclaimer', label: FORCE_SHOW_VANITY_URL_DISCLAIMER_DESCRIPTOR, description: ALWAYS_SHOW_THE_VANITY_URL_DISCLAIMER_WARNING_IN_DESCRIPTOR, }, ], }, { title: NETWORKING_AND_PERFORMANCE_DESCRIPTOR, items: [ { key: 'slowMessageLoad', label: SLOW_MESSAGE_LOAD_DESCRIPTOR, }, { key: 'slowMessageSend', label: SLOW_MESSAGE_SEND_DESCRIPTOR, }, { key: 'slowMessageEdit', label: SLOW_MESSAGE_EDIT_DESCRIPTOR, }, { key: 'slowAttachmentUpload', label: SLOW_ATTACHMENT_UPLOAD_DESCRIPTOR, }, { key: 'slowProfileLoad', label: SLOW_PROFILE_LOAD_DESCRIPTOR, }, { key: 'forceProfileSkeletons', label: FORCE_PROFILE_SKELETONS_DESCRIPTOR, description: ALWAYS_SHOW_THE_PROFILE_LOADING_SKELETON_DESCRIPTOR, }, { key: 'forceProfileDataWarning', label: FORCE_PROFILE_DATA_WARNING_DESCRIPTOR, description: ALWAYS_SHOW_THE_PROFILE_DATA_WARNING_INDICATOR_EVEN_DESCRIPTOR, }, { key: 'forceFailMessageSends', label: FORCE_FAILED_MESSAGE_SENDS_DESCRIPTOR, }, { key: 'forceFailMessageLoads', label: FORCE_FAILED_MESSAGE_LOADS_DESCRIPTOR, }, ], }, { title: FEATURES_DESCRIPTOR, items: [ { key: 'forceUnknownMessageType', label: FORCE_UNKNOWN_MESSAGE_TYPE_DESCRIPTOR, description: RENDER_ALL_YOUR_MESSAGES_AS_AN_UNKNOWN_MESSAGE_DESCRIPTOR, }, { key: 'forceShowVoiceConnection', label: FORCE_SHOW_VOICE_CONNECTION_DESCRIPTOR, description: ALWAYS_DISPLAY_THE_VOICE_CONNECTION_STATUS_BAR_IN_DESCRIPTOR, }, { key: 'showExpressionPacksSettings', label: SHOW_EXPRESSION_PACKS_SETTINGS_DESCRIPTOR, description: SHOW_EXPRESSION_PACKS_SETTINGS_DESC_DESCRIPTOR, }, { key: 'showProfileTimezoneSettings', label: SHOW_PROFILE_TIMEZONE_SETTINGS_DESCRIPTOR, description: SHOW_PROFILE_TIMEZONE_SETTINGS_DESC_DESCRIPTOR, }, { key: 'noOpInAppReports', label: NO_OP_IN_APP_REPORTS_DESCRIPTOR, description: NO_OP_IN_APP_REPORTS_DESC_DESCRIPTOR, }, ], },];