remove serviceurl gate (#4019)

This commit is contained in:
Samuel Newman 2024-05-14 21:19:22 +01:00 committed by GitHub
parent ebc7571368
commit 0e04b19627
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 1 additions and 116 deletions

View file

@ -4,7 +4,6 @@ import {ChatBskyConvoDefs} from '@atproto/api'
import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {NativeStackScreenProps} from '@react-navigation/native-stack'
import {sha256} from 'js-sha256'
import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender'
import {MessagesTabNavigatorParams} from '#/lib/routes/types'
@ -15,12 +14,10 @@ import {useListConvos} from '#/state/queries/messages/list-converations'
import {List} from '#/view/com/util/List'
import {ViewHeader} from '#/view/com/util/ViewHeader'
import {CenteredView} from '#/view/com/util/Views'
import {ScrollView} from '#/view/com/util/Views'
import {atoms as a, useBreakpoints, useTheme} from '#/alf'
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
import {DialogControlProps, useDialogControl} from '#/components/Dialog'
import {NewChat} from '#/components/dms/NewChat'
import * as TextField from '#/components/forms/TextField'
import {useRefreshOnFocus} from '#/components/hooks/useRefreshOnFocus'
import {PlusLarge_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus'
import {SettingsSliderVertical_Stroke2_Corner0_Rounded as SettingsSlider} from '#/components/icons/SettingsSlider'
@ -28,7 +25,6 @@ import {Link} from '#/components/Link'
import {ListFooter, ListMaybePlaceholder} from '#/components/Lists'
import {Text} from '#/components/Typography'
import {ClipClopGate} from '../gate'
import {useDmServiceUrlStorage} from '../Temp/useDmServiceUrlStorage'
import {ChatListItem} from './ChatListItem'
type Props = NativeStackScreenProps<MessagesTabNavigatorParams, 'Messages'>
@ -54,17 +50,6 @@ export function MessagesScreen({navigation, route}: Props) {
const {gtMobile} = useBreakpoints()
const pushToConversation = route.params?.pushToConversation
// TEMP
const {serviceUrl, setServiceUrl} = useDmServiceUrlStorage()
const [serviceUrlValue, setServiceUrlValue] = useState(serviceUrl)
const hasValidServiceUrl = useMemo(() => {
const hash = sha256(serviceUrl)
return (
hash ===
'a32318b49dd3fe6aa6a35c66c13fcc4c1cb6202b24f5a852d9a2279acee4169f'
)
}, [serviceUrl])
// Whenever we have `pushToConversation` set, it means we pressed a notification for a chat without being on
// this tab. We should immediately push to the conversation after pressing the notification.
// After we push, reset with `setParams` so that this effect will fire next time we press a notification, even if
@ -145,33 +130,6 @@ export function MessagesScreen({navigation, route}: Props) {
const gate = useGate()
if (!gate('dms')) return <ClipClopGate />
if (!hasValidServiceUrl) {
return (
<ScrollView contentContainerStyle={a.p_lg}>
<View>
<TextField.LabelText>Service URL</TextField.LabelText>
<TextField.Root>
<TextField.Input
value={serviceUrlValue}
onChangeText={text => setServiceUrlValue(text)}
autoCapitalize="none"
keyboardType="url"
label="https://"
/>
</TextField.Root>
<Button
label="Set Service URL"
size="small"
variant="solid"
color="primary"
onPress={() => setServiceUrl(serviceUrlValue)}>
<ButtonText>Set</ButtonText>
</Button>
</View>
</ScrollView>
)
}
if (conversations.length < 1) {
return (
<View style={a.flex_1}>