Bluesky app fork with some witchin' additions 馃挮 witchsky.app
bluesky fork client
119
fork

Configure Feed

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

at a876aae44ea07494ebea9727350aa060b81f317b 112 lines 3.5 kB view raw
1import {useCallback} from 'react' 2import {View} from 'react-native' 3import {msg} from '@lingui/core/macro' 4import {useLingui} from '@lingui/react' 5import {Trans} from '@lingui/react/macro' 6 7import {useOpenLink} from '#/lib/hooks/useOpenLink' 8import {useSetInAppBrowser} from '#/state/preferences/in-app-browser' 9import {atoms as a, useTheme} from '#/alf' 10import {Button, ButtonIcon, ButtonText} from '#/components/Button' 11import * as Dialog from '#/components/Dialog' 12import {SquareArrowTopRight_Stroke2_Corner0_Rounded as External} from '#/components/icons/SquareArrowTopRight' 13import {Text} from '#/components/Typography' 14import {IS_WEB} from '#/env' 15import {useGlobalDialogsControlContext} from './Context' 16 17export function InAppBrowserConsentDialog() { 18 const {inAppBrowserConsentControl} = useGlobalDialogsControlContext() 19 20 if (IS_WEB) return null 21 22 return ( 23 <Dialog.Outer 24 control={inAppBrowserConsentControl.control} 25 nativeOptions={{preventExpansion: true}} 26 onClose={inAppBrowserConsentControl.clear}> 27 <Dialog.Handle /> 28 <InAppBrowserConsentInner href={inAppBrowserConsentControl.value} /> 29 </Dialog.Outer> 30 ) 31} 32 33function InAppBrowserConsentInner({href}: {href?: string}) { 34 const control = Dialog.useDialogContext() 35 const {_} = useLingui() 36 const t = useTheme() 37 const setInAppBrowser = useSetInAppBrowser() 38 const openLink = useOpenLink() 39 40 const onUseIAB = useCallback(() => { 41 control.close(() => { 42 setInAppBrowser(true) 43 if (href) { 44 openLink(href, true) 45 } 46 }) 47 }, [control, setInAppBrowser, href, openLink]) 48 49 const onUseLinking = useCallback(() => { 50 control.close(() => { 51 setInAppBrowser(false) 52 if (href) { 53 openLink(href, false) 54 } 55 }) 56 }, [control, setInAppBrowser, href, openLink]) 57 58 const onCancel = useCallback(() => { 59 control.close() 60 }, [control]) 61 62 return ( 63 <Dialog.ScrollableInner label={_(msg`How should we open this link?`)}> 64 <View style={[a.gap_2xl]}> 65 <View style={[a.gap_sm]}> 66 <Text style={[a.font_bold, a.text_2xl]}> 67 <Trans>How should we open this link?</Trans> 68 </Text> 69 <Text style={[t.atoms.text_contrast_high, a.leading_snug, a.text_md]}> 70 <Trans> 71 Your choice will be remembered for future links. You can change it 72 at any time in settings. 73 </Trans> 74 </Text> 75 </View> 76 <View style={[a.gap_sm]}> 77 <Button 78 label={_(msg`Use in-app browser`)} 79 onPress={onUseIAB} 80 size="large" 81 variant="solid" 82 color="primary"> 83 <ButtonText> 84 <Trans>Use in-app browser</Trans> 85 </ButtonText> 86 </Button> 87 <Button 88 label={_(msg`Use my default browser`)} 89 onPress={onUseLinking} 90 size="large" 91 variant="solid" 92 color="secondary"> 93 <ButtonText> 94 <Trans>Use my default browser</Trans> 95 </ButtonText> 96 <ButtonIcon position="right" icon={External} /> 97 </Button> 98 <Button 99 label={_(msg`Cancel`)} 100 onPress={onCancel} 101 size="large" 102 variant="ghost" 103 color="secondary"> 104 <ButtonText> 105 <Trans>Cancel</Trans> 106 </ButtonText> 107 </Button> 108 </View> 109 </View> 110 </Dialog.ScrollableInner> 111 ) 112}