From c6532ccc12ce70b3ea9244b88eb2f57ea5eac23f Mon Sep 17 00:00:00 2001 From: serenity <98162476+NekoDrone@users.noreply.github.com> Date: Fri, 3 Oct 2025 17:58:06 +0800 Subject: [PATCH] refactor: we aren't deer thank you aviva for the work you've done :) --- src/Navigation.tsx | 8 ++++---- src/lib/routes/types.ts | 2 +- src/lib/statsig/statsig.tsx | 12 ++++++------ src/routes.ts | 2 +- .../{DeerSettings.tsx => ExperimentalSettings.tsx} | 12 ++++++------ src/screens/Settings/Settings.tsx | 10 ++++++---- src/state/persisted/schema.ts | 2 +- src/storage/schema.ts | 4 ++-- 8 files changed, 27 insertions(+), 25 deletions(-) rename src/screens/Settings/{DeerSettings.tsx => ExperimentalSettings.tsx} (95%) diff --git a/src/Navigation.tsx b/src/Navigation.tsx index 0b07d514d..522a591d8 100644 --- a/src/Navigation.tsx +++ b/src/Navigation.tsx @@ -95,6 +95,7 @@ import {SearchScreen} from '#/screens/Search' import {ActivityPrivacySettingsScreen} from '#/screens/Settings/ActivityPrivacySettings' import {AppearanceSettingsScreen} from '#/screens/Settings/AppearanceSettings' import {AppIconSettingsScreen} from '#/screens/Settings/AppIconSettings' +import {ExperimentalSettingsScreen} from '#/screens/Settings/ExperimentalSettings' import {InterestsSettingsScreen} from '#/screens/Settings/InterestsSettings' import {LegacyNotificationSettingsScreen} from '#/screens/Settings/LegacyNotificationSettings' import {NotificationSettingsScreen} from '#/screens/Settings/NotificationSettings' @@ -129,7 +130,6 @@ import {AccessibilitySettingsScreen} from './screens/Settings/AccessibilitySetti import {AccountSettingsScreen} from './screens/Settings/AccountSettings' import {AppPasswordsScreen} from './screens/Settings/AppPasswords' import {ContentAndMediaSettingsScreen} from './screens/Settings/ContentAndMediaSettings' -import {DeerSettingsScreen} from './screens/Settings/DeerSettings' import {ExternalMediaPreferencesScreen} from './screens/Settings/ExternalMediaPreferences' import {FollowingFeedPreferencesScreen} from './screens/Settings/FollowingFeedPreferences' import {LanguageSettingsScreen} from './screens/Settings/LanguageSettings' @@ -386,10 +386,10 @@ function commonScreens(Stack: typeof Flat, unreadCountLabel?: string) { }} /> DeerSettingsScreen} + name="ExperimentalSettings" + getComponent={() => ExperimentalSettingsScreen} options={{ - title: title(msg`Deer Settings`), + title: title(msg`Experimental Settings`), requireAuth: true, }} /> diff --git a/src/lib/routes/types.ts b/src/lib/routes/types.ts index 08b81de1f..86f4d0878 100644 --- a/src/lib/routes/types.ts +++ b/src/lib/routes/types.ts @@ -123,7 +123,7 @@ export type FlatNavigatorParams = CommonNavigatorParams & { Feeds: undefined Notifications: undefined Messages: {pushToConversation?: string; animation?: 'push' | 'pop'} - CatskySettings: undefined + ExperimentalSettings: undefined } export type AllNavigatorParams = CommonNavigatorParams & { diff --git a/src/lib/statsig/statsig.tsx b/src/lib/statsig/statsig.tsx index 043c8df8b..2756b85c6 100644 --- a/src/lib/statsig/statsig.tsx +++ b/src/lib/statsig/statsig.tsx @@ -138,12 +138,12 @@ export function useGatesCache(): Map { return cache } -function writeDeerGateCache(cache: Map) { - device.set(['deerGateCache'], JSON.stringify(Object.fromEntries(cache))) +function writeCatskyGateCache(cache: Map) { + device.set(['catskyGateCache'], JSON.stringify(Object.fromEntries(cache))) } -export function resetDeerGateCache() { - writeDeerGateCache(new Map()) +export function resetCatskyGateCache() { + writeCatskyGateCache(new Map()) } export function useGate(): (gateName: Gate, options?: GateOptions) => boolean { @@ -166,7 +166,7 @@ export function useGate(): (gateName: Gate, options?: GateOptions) => boolean { } } cache.set(gateName, value) - writeDeerGateCache(cache) + writeCatskyGateCache(cache) return value }, [cache], @@ -190,7 +190,7 @@ export function useDangerousSetGate(): ( const dangerousSetGate = React.useCallback( (gateName: Gate, value: boolean) => { cache.set(gateName, value) - writeDeerGateCache(cache) + writeCatskyGateCache(cache) }, [cache], ) diff --git a/src/routes.ts b/src/routes.ts index 6c93b2d28..104182ea5 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -47,7 +47,7 @@ export const router = new Router({ PreferencesThreads: '/settings/threads', PreferencesExternalEmbeds: '/settings/external-embeds', AccessibilitySettings: '/settings/accessibility', - DeerSettings: '/settings/deer', + ExperimentalSettings: '/settings/experimental', AppearanceSettings: '/settings/appearance', SavedFeeds: '/settings/saved-feeds', AccountSettings: '/settings/account', diff --git a/src/screens/Settings/DeerSettings.tsx b/src/screens/Settings/ExperimentalSettings.tsx similarity index 95% rename from src/screens/Settings/DeerSettings.tsx rename to src/screens/Settings/ExperimentalSettings.tsx index 27acd3b75..69cbe8046 100644 --- a/src/screens/Settings/DeerSettings.tsx +++ b/src/screens/Settings/ExperimentalSettings.tsx @@ -6,7 +6,7 @@ import {type NativeStackScreenProps} from '@react-navigation/native-stack' import {type CommonNavigatorParams} from '#/lib/routes/types' import {type Gate} from '#/lib/statsig/gates' import { - resetDeerGateCache, + resetCatskyGateCache, useDangerousSetGate, useGatesCache, } from '#/lib/statsig/statsig' @@ -23,14 +23,14 @@ import * as SettingsList from '#/screens/Settings/components/SettingsList' import {atoms as a} from '#/alf' import {Admonition} from '#/components/Admonition' import * as Toggle from '#/components/forms/Toggle' -import {Atom_Stroke2_Corner0_Rounded as DeerIcon} from '#/components/icons/Atom' +import {Atom_Stroke2_Corner0_Rounded as ExperimentalIcon} from '#/components/icons/Atom' import {Eye_Stroke2_Corner0_Rounded as VisibilityIcon} from '#/components/icons/Eye' import {PaintRoller_Stroke2_Corner2_Rounded as PaintRollerIcon} from '#/components/icons/PaintRoller' import * as Layout from '#/components/Layout' type Props = NativeStackScreenProps -export function DeerSettingsScreen({}: Props) { +export function ExperimentalSettingsScreen({}: Props) { const {_} = useLingui() const goLinksEnabled = useGoLinksEnabled() @@ -58,7 +58,7 @@ export function DeerSettingsScreen({}: Props) { - Deer + Experimental @@ -66,7 +66,7 @@ export function DeerSettingsScreen({}: Props) { - + Redirects @@ -160,7 +160,7 @@ export function DeerSettingsScreen({}: Props) { { - resetDeerGateCache() + resetCatskyGateCache() setGatesView({}) }} /> diff --git a/src/screens/Settings/Settings.tsx b/src/screens/Settings/Settings.tsx index 3cf698dd5..d05134efb 100644 --- a/src/screens/Settings/Settings.tsx +++ b/src/screens/Settings/Settings.tsx @@ -40,7 +40,7 @@ import {Button, ButtonText} from '#/components/Button' import {useDialogControl} from '#/components/Dialog' import {SwitchAccountDialog} from '#/components/dialogs/SwitchAccount' import {Accessibility_Stroke2_Corner2_Rounded as AccessibilityIcon} from '#/components/icons/Accessibility' -import {Atom_Stroke2_Corner0_Rounded as DeerIcon} from '#/components/icons/Atom' +import {Atom_Stroke2_Corner0_Rounded as ExperimentalIcon} from '#/components/icons/Atom' import {Bell_Stroke2_Corner0_Rounded as NotificationIcon} from '#/components/icons/Bell' import {BubbleInfo_Stroke2_Corner2_Rounded as BubbleInfoIcon} from '#/components/icons/BubbleInfo' import {ChevronTop_Stroke2_Corner0_Rounded as ChevronUpIcon} from '#/components/icons/Chevron' @@ -216,10 +216,12 @@ export function SettingsScreen({}: Props) { Appearance - - + + - Deer + Experimental