mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

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

at rm-proxy 102 lines 2.9 kB view raw
1import React from 'react' 2import {StyleSheet, View} from 'react-native' 3 4import {s} from 'lib/styles' 5import {Text} from '../util/text/Text' 6import {Button} from '../util/forms/Button' 7import {ScrollView} from './util' 8import {usePalette} from 'lib/hooks/usePalette' 9 10import {msg, Trans} from '@lingui/macro' 11import {useLingui} from '@lingui/react' 12import {useModalControls} from '#/state/modals' 13import { 14 useOpenLink, 15 useSetInAppBrowser, 16} from '#/state/preferences/in-app-browser' 17 18export const snapPoints = [350] 19 20export function Component({href}: {href: string}) { 21 const pal = usePalette('default') 22 const {closeModal} = useModalControls() 23 const {_} = useLingui() 24 const setInAppBrowser = useSetInAppBrowser() 25 const openLink = useOpenLink() 26 27 const onUseIAB = React.useCallback(() => { 28 setInAppBrowser(true) 29 closeModal() 30 openLink(href, true) 31 }, [closeModal, setInAppBrowser, href, openLink]) 32 33 const onUseLinking = React.useCallback(() => { 34 setInAppBrowser(false) 35 closeModal() 36 openLink(href, false) 37 }, [closeModal, setInAppBrowser, href, openLink]) 38 39 return ( 40 <ScrollView 41 testID="inAppBrowserConsentModal" 42 style={[s.flex1, pal.view, {paddingHorizontal: 20, paddingTop: 10}]}> 43 <Text style={[pal.text, styles.title]}> 44 <Trans>How should we open this link?</Trans> 45 </Text> 46 <Text style={pal.text}> 47 <Trans> 48 Your choice will be saved, but can be changed later in settings. 49 </Trans> 50 </Text> 51 <View style={[styles.btnContainer]}> 52 <Button 53 testID="confirmBtn" 54 type="inverted" 55 onPress={onUseIAB} 56 accessibilityLabel={_(msg`Use in-app browser`)} 57 accessibilityHint="" 58 label={_(msg`Use in-app browser`)} 59 labelContainerStyle={{justifyContent: 'center', padding: 8}} 60 labelStyle={[s.f18]} 61 /> 62 <Button 63 testID="confirmBtn" 64 type="inverted" 65 onPress={onUseLinking} 66 accessibilityLabel={_(msg`Use my default browser`)} 67 accessibilityHint="" 68 label={_(msg`Use my default browser`)} 69 labelContainerStyle={{justifyContent: 'center', padding: 8}} 70 labelStyle={[s.f18]} 71 /> 72 <Button 73 testID="cancelBtn" 74 type="default" 75 onPress={() => { 76 closeModal() 77 }} 78 accessibilityLabel={_(msg`Cancel`)} 79 accessibilityHint="" 80 label={_(msg`Cancel`)} 81 labelContainerStyle={{justifyContent: 'center', padding: 8}} 82 labelStyle={[s.f18]} 83 /> 84 </View> 85 </ScrollView> 86 ) 87} 88 89const styles = StyleSheet.create({ 90 title: { 91 textAlign: 'center', 92 fontWeight: 'bold', 93 fontSize: 24, 94 marginBottom: 12, 95 }, 96 btnContainer: { 97 marginTop: 20, 98 flexDirection: 'column', 99 justifyContent: 'center', 100 rowGap: 10, 101 }, 102})