Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

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

remove serviceurl gate (#4019)

authored by

Samuel Newman and committed by
GitHub
0e04b196 ebc75713

+1 -116
-42
src/screens/Messages/List/index.tsx
··· 4 4 import {msg, Trans} from '@lingui/macro' 5 5 import {useLingui} from '@lingui/react' 6 6 import {NativeStackScreenProps} from '@react-navigation/native-stack' 7 - import {sha256} from 'js-sha256' 8 7 9 8 import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender' 10 9 import {MessagesTabNavigatorParams} from '#/lib/routes/types' ··· 15 14 import {List} from '#/view/com/util/List' 16 15 import {ViewHeader} from '#/view/com/util/ViewHeader' 17 16 import {CenteredView} from '#/view/com/util/Views' 18 - import {ScrollView} from '#/view/com/util/Views' 19 17 import {atoms as a, useBreakpoints, useTheme} from '#/alf' 20 18 import {Button, ButtonIcon, ButtonText} from '#/components/Button' 21 19 import {DialogControlProps, useDialogControl} from '#/components/Dialog' 22 20 import {NewChat} from '#/components/dms/NewChat' 23 - import * as TextField from '#/components/forms/TextField' 24 21 import {useRefreshOnFocus} from '#/components/hooks/useRefreshOnFocus' 25 22 import {PlusLarge_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus' 26 23 import {SettingsSliderVertical_Stroke2_Corner0_Rounded as SettingsSlider} from '#/components/icons/SettingsSlider' ··· 28 25 import {ListFooter, ListMaybePlaceholder} from '#/components/Lists' 29 26 import {Text} from '#/components/Typography' 30 27 import {ClipClopGate} from '../gate' 31 - import {useDmServiceUrlStorage} from '../Temp/useDmServiceUrlStorage' 32 28 import {ChatListItem} from './ChatListItem' 33 29 34 30 type Props = NativeStackScreenProps<MessagesTabNavigatorParams, 'Messages'> ··· 53 49 const newChatControl = useDialogControl() 54 50 const {gtMobile} = useBreakpoints() 55 51 const pushToConversation = route.params?.pushToConversation 56 - 57 - // TEMP 58 - const {serviceUrl, setServiceUrl} = useDmServiceUrlStorage() 59 - const [serviceUrlValue, setServiceUrlValue] = useState(serviceUrl) 60 - const hasValidServiceUrl = useMemo(() => { 61 - const hash = sha256(serviceUrl) 62 - return ( 63 - hash === 64 - 'a32318b49dd3fe6aa6a35c66c13fcc4c1cb6202b24f5a852d9a2279acee4169f' 65 - ) 66 - }, [serviceUrl]) 67 52 68 53 // Whenever we have `pushToConversation` set, it means we pressed a notification for a chat without being on 69 54 // this tab. We should immediately push to the conversation after pressing the notification. ··· 144 129 145 130 const gate = useGate() 146 131 if (!gate('dms')) return <ClipClopGate /> 147 - 148 - if (!hasValidServiceUrl) { 149 - return ( 150 - <ScrollView contentContainerStyle={a.p_lg}> 151 - <View> 152 - <TextField.LabelText>Service URL</TextField.LabelText> 153 - <TextField.Root> 154 - <TextField.Input 155 - value={serviceUrlValue} 156 - onChangeText={text => setServiceUrlValue(text)} 157 - autoCapitalize="none" 158 - keyboardType="url" 159 - label="https://" 160 - /> 161 - </TextField.Root> 162 - <Button 163 - label="Set Service URL" 164 - size="small" 165 - variant="solid" 166 - color="primary" 167 - onPress={() => setServiceUrl(serviceUrlValue)}> 168 - <ButtonText>Set</ButtonText> 169 - </Button> 170 - </View> 171 - </ScrollView> 172 - ) 173 - } 174 132 175 133 if (conversations.length < 1) { 176 134 return (
-70
src/screens/Messages/Temp/useDmServiceUrlStorage.tsx
··· 1 - import React from 'react' 2 - import {useAsyncStorage} from '@react-native-async-storage/async-storage' 3 - 4 - /** 5 - * TEMP: REMOVE BEFORE RELEASE 6 - * 7 - * Clip clop trivia: 8 - * 9 - * A little known fact about the term "clip clop" is that it may refer to a unit of time. It is unknown what the exact 10 - * length of a clip clop is, but it is generally agreed that it is approximately 9 minutes and 30 seconds, or 570 11 - * seconds. 12 - * 13 - * The term "clip clop" may also be used in other contexts, although it is unknown what all of these contexts may be. 14 - * Recently, the term has been used among many young adults to refer to a type of social media functionality, although 15 - * the exact nature of this functionality is also unknown. It is believed that the term may have originated from a 16 - * popular video game, but this has not been confirmed. 17 - * 18 - */ 19 - 20 - const DmServiceUrlStorageContext = React.createContext<{ 21 - serviceUrl: string 22 - setServiceUrl: (value: string) => void 23 - }>({ 24 - serviceUrl: '', 25 - setServiceUrl: () => {}, 26 - }) 27 - 28 - export const useDmServiceUrlStorage = () => 29 - React.useContext(DmServiceUrlStorageContext) 30 - 31 - export function DmServiceUrlProvider({children}: {children: React.ReactNode}) { 32 - const [serviceUrl, setServiceUrl] = React.useState<string>('') 33 - const {getItem, setItem: setItemInner} = useAsyncStorage('dmServiceUrl') 34 - 35 - React.useEffect(() => { 36 - ;(async () => { 37 - const v = await getItem() 38 - try { 39 - if (v) { 40 - new URL(v) 41 - setServiceUrl(v) 42 - } 43 - } catch (e) { 44 - console.error('Invalid service URL stored in async storage:', v) 45 - } 46 - })() 47 - }, [getItem]) 48 - 49 - const setItem = React.useCallback( 50 - (v: string) => { 51 - setItemInner(v) 52 - setServiceUrl(v) 53 - }, 54 - [setItemInner], 55 - ) 56 - 57 - const value = React.useMemo( 58 - () => ({ 59 - serviceUrl, 60 - setServiceUrl: setItem, 61 - }), 62 - [serviceUrl, setItem], 63 - ) 64 - 65 - return ( 66 - <DmServiceUrlStorageContext.Provider value={value}> 67 - {children} 68 - </DmServiceUrlStorageContext.Provider> 69 - ) 70 - }
+1 -4
src/state/preferences/index.tsx
··· 1 1 import React from 'react' 2 2 3 - import {DmServiceUrlProvider} from '#/screens/Messages/Temp/useDmServiceUrlStorage' 4 3 import {Provider as AltTextRequiredProvider} from './alt-text-required' 5 4 import {Provider as AutoplayProvider} from './autoplay' 6 5 import {Provider as DisableHapticsProvider} from './disable-haptics' ··· 33 32 <InAppBrowserProvider> 34 33 <DisableHapticsProvider> 35 34 <AutoplayProvider> 36 - <DmServiceUrlProvider> 37 - <KawaiiProvider>{children}</KawaiiProvider> 38 - </DmServiceUrlProvider> 35 + <KawaiiProvider>{children}</KawaiiProvider> 39 36 </AutoplayProvider> 40 37 </DisableHapticsProvider> 41 38 </InAppBrowserProvider>