disable enabling adult content on iOS (#4651)

zio/stable
Samuel Newman 2024-06-26 15:28:31 +01:00 committed by GitHub
parent b23f112689
commit 8621ecd38a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 25 additions and 1 deletions

View File

@ -1,5 +1,5 @@
import React from 'react' import React from 'react'
import {View} from 'react-native' import {Linking, View} from 'react-native'
import {useSafeAreaFrame} from 'react-native-safe-area-context' import {useSafeAreaFrame} from 'react-native-safe-area-context'
import {ComAtprotoLabelDefs} from '@atproto/api' import {ComAtprotoLabelDefs} from '@atproto/api'
import {LABELS} from '@atproto/api' import {LABELS} from '@atproto/api'
@ -10,6 +10,7 @@ import {useFocusEffect} from '@react-navigation/native'
import {getLabelingServiceTitle} from '#/lib/moderation' import {getLabelingServiceTitle} from '#/lib/moderation'
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types' import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types'
import {logger} from '#/logger' import {logger} from '#/logger'
import {isIOS} from '#/platform/detection'
import { import {
useMyLabelersQuery, useMyLabelersQuery,
usePreferencesQuery, usePreferencesQuery,
@ -202,6 +203,8 @@ export function ModerationScreenInner({
[setAdultContentPref], [setAdultContentPref],
) )
const disabledOnIOS = isIOS && !adultContentEnabled
return ( return (
<ScrollView <ScrollView
contentContainerStyle={[ contentContainerStyle={[
@ -324,12 +327,14 @@ export function ModerationScreenInner({
a.flex_row, a.flex_row,
a.align_center, a.align_center,
a.justify_between, a.justify_between,
disabledOnIOS && {opacity: 0.5},
]}> ]}>
<Text style={[a.font_semibold, t.atoms.text_contrast_high]}> <Text style={[a.font_semibold, t.atoms.text_contrast_high]}>
<Trans>Enable adult content</Trans> <Trans>Enable adult content</Trans>
</Text> </Text>
<Toggle.Item <Toggle.Item
label={_(msg`Toggle to enable or disable adult content`)} label={_(msg`Toggle to enable or disable adult content`)}
disabled={disabledOnIOS}
name="adultContent" name="adultContent"
value={adultContentEnabled} value={adultContentEnabled}
onChange={onToggleAdultContentEnabled}> onChange={onToggleAdultContentEnabled}>
@ -345,6 +350,25 @@ export function ModerationScreenInner({
</View> </View>
</Toggle.Item> </Toggle.Item>
</View> </View>
{disabledOnIOS && (
<View style={[a.pb_lg, a.px_lg]}>
<Text>
<Trans>
Adult content can only be enabled via the Web at{' '}
<InlineLinkText
to=""
onPress={evt => {
evt.preventDefault()
Linking.openURL('https://bsky.app/')
return false
}}>
bsky.app
</InlineLinkText>
.
</Trans>
</Text>
</View>
)}
<Divider /> <Divider />
</> </>
)} )}