Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

dev options in new settings (#6128)

authored by

Samuel Newman and committed by
GitHub
27bbf8b6 325bf198

+95 -3
+95 -3
src/screens/Settings/Settings.tsx
··· 1 - import React from 'react' 2 - import {View} from 'react-native' 1 + import React, {useState} from 'react' 2 + import {LayoutAnimation, View} from 'react-native' 3 3 import {Linking} from 'react-native' 4 4 import {AppBskyActorDefs, moderateProfile} from '@atproto/api' 5 5 import {msg, Trans} from '@lingui/macro' 6 6 import {useLingui} from '@lingui/react' 7 + import {useNavigation} from '@react-navigation/native' 7 8 import {NativeStackScreenProps} from '@react-navigation/native-stack' 8 9 10 + import {IS_INTERNAL} from '#/lib/app-info' 9 11 import {HELP_DESK_URL} from '#/lib/constants' 10 - import {CommonNavigatorParams} from '#/lib/routes/types' 12 + import {CommonNavigatorParams, NavigationProp} from '#/lib/routes/types' 11 13 import {useProfileShadow} from '#/state/cache/profile-shadow' 14 + import {clearStorage} from '#/state/persisted' 12 15 import {useModerationOpts} from '#/state/preferences/moderation-opts' 16 + import {useDeleteActorDeclaration} from '#/state/queries/messages/actor-declaration' 13 17 import {useProfileQuery, useProfilesQuery} from '#/state/queries/profile' 14 18 import {useSession, useSessionApi} from '#/state/session' 19 + import {useOnboardingDispatch} from '#/state/shell' 15 20 import {useLoggedOutViewControls} from '#/state/shell/logged-out' 16 21 import {useCloseAllActiveElements} from '#/state/util' 22 + import * as Toast from '#/view/com/util/Toast' 17 23 import {UserAvatar} from '#/view/com/util/UserAvatar' 18 24 import {ProfileHeaderDisplayName} from '#/screens/Profile/Header/DisplayName' 19 25 import {ProfileHeaderHandle} from '#/screens/Profile/Header/Handle' ··· 24 30 import {Accessibility_Stroke2_Corner2_Rounded as AccessibilityIcon} from '#/components/icons/Accessibility' 25 31 import {BubbleInfo_Stroke2_Corner2_Rounded as BubbleInfoIcon} from '#/components/icons/BubbleInfo' 26 32 import {CircleQuestion_Stroke2_Corner2_Rounded as CircleQuestionIcon} from '#/components/icons/CircleQuestion' 33 + import {CodeBrackets_Stroke2_Corner2_Rounded as CodeBracketsIcon} from '#/components/icons/CodeBrackets' 27 34 import {Earth_Stroke2_Corner2_Rounded as EarthIcon} from '#/components/icons/Globe' 28 35 import {Lock_Stroke2_Corner2_Rounded as LockIcon} from '#/components/icons/Lock' 29 36 import {PaintRoller_Stroke2_Corner2_Rounded as PaintRollerIcon} from '#/components/icons/PaintRoller' ··· 46 53 const {data: profile} = useProfileQuery({did: currentAccount?.did}) 47 54 const {setShowLoggedOut} = useLoggedOutViewControls() 48 55 const closeEverything = useCloseAllActiveElements() 56 + const [showDevOptions, setShowDevOptions] = useState(false) 49 57 50 58 const onAddAnotherAccount = () => { 51 59 setShowLoggedOut(true) ··· 175 183 <Trans>Sign out</Trans> 176 184 </SettingsList.ItemText> 177 185 </SettingsList.PressableItem> 186 + {IS_INTERNAL && ( 187 + <> 188 + <SettingsList.Divider /> 189 + <SettingsList.PressableItem 190 + onPress={() => { 191 + LayoutAnimation.configureNext( 192 + LayoutAnimation.Presets.easeInEaseOut, 193 + ) 194 + setShowDevOptions(d => !d) 195 + }} 196 + label={_(msg`Developer options`)}> 197 + <SettingsList.ItemIcon icon={CodeBracketsIcon} /> 198 + <SettingsList.ItemText> 199 + <Trans>Developer options</Trans> 200 + </SettingsList.ItemText> 201 + </SettingsList.PressableItem> 202 + {showDevOptions && <DevOptions />} 203 + </> 204 + )} 178 205 </SettingsList.Container> 179 206 </Layout.Content> 180 207 ··· 281 308 </View> 282 309 ) 283 310 } 311 + 312 + function DevOptions() { 313 + const {_} = useLingui() 314 + const onboardingDispatch = useOnboardingDispatch() 315 + const navigation = useNavigation<NavigationProp>() 316 + const {mutate: deleteChatDeclarationRecord} = useDeleteActorDeclaration() 317 + 318 + const resetOnboarding = async () => { 319 + navigation.navigate('Home') 320 + onboardingDispatch({type: 'start'}) 321 + Toast.show(_(msg`Onboarding reset`)) 322 + } 323 + 324 + const clearAllStorage = async () => { 325 + await clearStorage() 326 + Toast.show(_(msg`Storage cleared, you need to restart the app now.`)) 327 + } 328 + 329 + return ( 330 + <> 331 + <SettingsList.PressableItem 332 + onPress={() => navigation.navigate('Log')} 333 + label={_(msg`Open system log`)}> 334 + <SettingsList.ItemText> 335 + <Trans>System log</Trans> 336 + </SettingsList.ItemText> 337 + </SettingsList.PressableItem> 338 + <SettingsList.PressableItem 339 + onPress={() => navigation.navigate('Debug')} 340 + label={_(msg`Open storybook page`)}> 341 + <SettingsList.ItemText> 342 + <Trans>Storybook</Trans> 343 + </SettingsList.ItemText> 344 + </SettingsList.PressableItem> 345 + <SettingsList.PressableItem 346 + onPress={() => navigation.navigate('DebugMod')} 347 + label={_(msg`Open moderation debug page`)}> 348 + <SettingsList.ItemText> 349 + <Trans>Debug Moderation</Trans> 350 + </SettingsList.ItemText> 351 + </SettingsList.PressableItem> 352 + <SettingsList.PressableItem 353 + onPress={() => deleteChatDeclarationRecord()} 354 + label={_(msg`Open storybook page`)}> 355 + <SettingsList.ItemText> 356 + <Trans>Delete chat declaration record</Trans> 357 + </SettingsList.ItemText> 358 + </SettingsList.PressableItem> 359 + <SettingsList.PressableItem 360 + onPress={() => resetOnboarding()} 361 + label={_(msg`Reset onboarding state`)}> 362 + <SettingsList.ItemText> 363 + <Trans>Reset onboarding state</Trans> 364 + </SettingsList.ItemText> 365 + </SettingsList.PressableItem> 366 + <SettingsList.PressableItem 367 + onPress={() => clearAllStorage()} 368 + label={_(msg`Clear all storage data`)}> 369 + <SettingsList.ItemText> 370 + <Trans>Clear all storage data (restart after this)</Trans> 371 + </SettingsList.ItemText> 372 + </SettingsList.PressableItem> 373 + </> 374 + ) 375 + }