[Chat] Delete GroupChatGate (#10846)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {useCallback, useEffect, useMemo, useRef, useState} from 'react'
|
||||
import {useCallback, useEffect, useMemo, useState} from 'react'
|
||||
import {type LayoutChangeEvent, View} from 'react-native'
|
||||
import {useSafeAreaInsets} from 'react-native-safe-area-context'
|
||||
import {ChatBskyConvoDefs, moderateProfile} from '@atproto/api'
|
||||
@@ -35,7 +35,6 @@ import {MessagesList} from '#/screens/Messages/components/MessagesList'
|
||||
import {atoms as a, web} from '#/alf'
|
||||
import {AgeRestrictedScreen} from '#/components/ageAssurance/AgeRestrictedScreen'
|
||||
import {useAgeAssuranceCopy} from '#/components/ageAssurance/useAgeAssuranceCopy'
|
||||
import * as Dialog from '#/components/Dialog'
|
||||
import {
|
||||
EmailDialogScreenID,
|
||||
useEmailDialogControl,
|
||||
@@ -45,10 +44,7 @@ import {MessagesListHeader} from '#/components/dms/MessagesListHeader'
|
||||
import {type ConvoWithDetails, parseConvoView} from '#/components/dms/util'
|
||||
import {Error} from '#/components/Error'
|
||||
import * as Layout from '#/components/Layout'
|
||||
import * as Prompt from '#/components/Prompt'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
import {IS_INTERNAL, IS_LIQUID_GLASS} from '#/env'
|
||||
import {IS_LIQUID_GLASS} from '#/env'
|
||||
import {ChatDisabled} from './components/ChatDisabled'
|
||||
import {ChatEnded} from './components/ChatEnded'
|
||||
import {ChatLocked} from './components/ChatLocked'
|
||||
@@ -299,79 +295,6 @@ function InnerReady({
|
||||
footer={footer}
|
||||
/>
|
||||
)}
|
||||
|
||||
{!IS_INTERNAL && convo?.kind === 'group' && <GroupChatGate />}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
function GroupChatGate() {
|
||||
const {t: l} = useLingui()
|
||||
const ax = useAnalytics()
|
||||
const navigation = useNavigation<NavigationProp>()
|
||||
|
||||
const groupChatGateDialogControl = Dialog.useDialogControl()
|
||||
|
||||
const isGatedGroupChat = !ax.features.enabled(ax.features.GroupChatsEnable)
|
||||
|
||||
useEffect(() => {
|
||||
if (isGatedGroupChat) {
|
||||
setTimeout(() => groupChatGateDialogControl.open())
|
||||
}
|
||||
}, [isGatedGroupChat, groupChatGateDialogControl])
|
||||
|
||||
const hasBeenReleased = ax.features.enabled(
|
||||
ax.features.GroupChatsHasBeenReleased,
|
||||
)
|
||||
|
||||
const isAlreadyGoingBackRef = useRef(false)
|
||||
const onGoBack = () => {
|
||||
if (isAlreadyGoingBackRef.current) return
|
||||
isAlreadyGoingBackRef.current = true
|
||||
if (navigation.canGoBack()) {
|
||||
navigation.goBack()
|
||||
} else {
|
||||
navigation.replace('Messages', {animation: 'pop'})
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Prompt.Outer
|
||||
control={groupChatGateDialogControl}
|
||||
onClose={onGoBack}
|
||||
nativeOptions={{preventDismiss: true, preventExpansion: true}}
|
||||
testID="groupChatGateDialog">
|
||||
<Prompt.Content>
|
||||
<View style={[a.w_full, a.align_center, a.py_3xl]}>
|
||||
<Text style={{fontSize: 72}} emoji>
|
||||
🐴
|
||||
</Text>
|
||||
</View>
|
||||
<Prompt.TitleText style={[a.text_center]}>
|
||||
{hasBeenReleased ? (
|
||||
<Trans>Group chats are now available</Trans>
|
||||
) : (
|
||||
<Trans>Group chats are not yet available</Trans>
|
||||
)}
|
||||
</Prompt.TitleText>
|
||||
<Prompt.DescriptionText style={[a.text_center]}>
|
||||
{hasBeenReleased ? (
|
||||
<Trans>Update your app to the latest version to join in!</Trans>
|
||||
) : (
|
||||
<Trans>
|
||||
Hold your horses! This feature isn't available to you yet. Please
|
||||
check back later.
|
||||
</Trans>
|
||||
)}
|
||||
</Prompt.DescriptionText>
|
||||
</Prompt.Content>
|
||||
<Prompt.Actions>
|
||||
<Prompt.Action
|
||||
cta={l`Go Back`}
|
||||
onPress={onGoBack}
|
||||
color="primary_subtle"
|
||||
/>
|
||||
</Prompt.Actions>
|
||||
</Prompt.Outer>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user