Bluesky app fork with some witchin' additions 馃挮
0
fork

Configure Feed

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

at 82f42e734c50b34de31e8aff1e7ced248ab6e96f 114 lines 3.5 kB view raw
1import {useCallback} from 'react' 2import {View} from 'react-native' 3import {msg, Trans} from '@lingui/macro' 4import {useLingui} from '@lingui/react' 5 6import { 7 type EmbedPlayerSource, 8 embedPlayerSources, 9 externalEmbedLabels, 10} from '#/lib/strings/embed-player' 11import {useSetExternalEmbedPref} from '#/state/preferences' 12import {atoms as a, web} from '#/alf' 13import {Admonition} from '#/components/Admonition' 14import {Button, ButtonText} from '#/components/Button' 15import * as Dialog from '#/components/Dialog' 16import {Text} from '#/components/Typography' 17 18export function EmbedConsentDialog({ 19 control, 20 source, 21 onAccept, 22}: { 23 control: Dialog.DialogControlProps 24 source: EmbedPlayerSource 25 onAccept: () => void 26}) { 27 const {_} = useLingui() 28 const setExternalEmbedPref = useSetExternalEmbedPref() 29 30 const onShowAllPress = useCallback(() => { 31 for (const key of embedPlayerSources) { 32 setExternalEmbedPref(key, 'show') 33 } 34 onAccept() 35 control.close() 36 }, [control, onAccept, setExternalEmbedPref]) 37 38 const onShowPress = useCallback(() => { 39 setExternalEmbedPref(source, 'show') 40 onAccept() 41 control.close() 42 }, [control, onAccept, setExternalEmbedPref, source]) 43 44 const onHidePress = useCallback(() => { 45 setExternalEmbedPref(source, 'hide') 46 control.close() 47 }, [control, setExternalEmbedPref, source]) 48 49 return ( 50 <Dialog.Outer control={control} nativeOptions={{preventExpansion: true}}> 51 <Dialog.Handle /> 52 <Dialog.ScrollableInner 53 label={_(msg`External Media`)} 54 style={web({maxWidth: 400})}> 55 <View style={a.gap_sm}> 56 <Text style={[a.text_2xl, a.font_bold]}> 57 <Trans>External Media</Trans> 58 </Text> 59 60 <View style={[a.mt_sm, a.mb_2xl, a.gap_lg]}> 61 <Text style={[a.text_md, a.leading_snug]}> 62 <Trans> 63 This content is hosted by {externalEmbedLabels[source]}. Do you 64 want to enable external media? 65 </Trans> 66 </Text> 67 68 <Admonition type="info"> 69 <Trans> 70 External media may allow websites to collect information about 71 you and your device. No information is sent or requested until 72 you press the "play" button. 73 </Trans> 74 </Admonition> 75 </View> 76 </View> 77 <View style={a.gap_md}> 78 <Button 79 label={_(msg`Enable external media`)} 80 onPress={onShowAllPress} 81 onAccessibilityEscape={control.close} 82 color="primary" 83 size="large"> 84 <ButtonText> 85 <Trans>Enable external media</Trans> 86 </ButtonText> 87 </Button> 88 <Button 89 label={_(msg`Enable this source only`)} 90 onPress={onShowPress} 91 onAccessibilityEscape={control.close} 92 color="secondary" 93 size="large"> 94 <ButtonText> 95 <Trans>Enable {externalEmbedLabels[source]} only</Trans> 96 </ButtonText> 97 </Button> 98 <Button 99 label={_(msg`No thanks`)} 100 onAccessibilityEscape={control.close} 101 onPress={onHidePress} 102 color="secondary" 103 size="large" 104 variant="ghost"> 105 <ButtonText> 106 <Trans>No thanks</Trans> 107 </ButtonText> 108 </Button> 109 </View> 110 <Dialog.Close /> 111 </Dialog.ScrollableInner> 112 </Dialog.Outer> 113 ) 114}