Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

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

[GIFs] Remove consent flow (#3652)

* Remove tenor from settings

* Remove consent flow

authored by

dan and committed by
GitHub
86180462 76449fb6

+23 -104
+4 -89
src/components/dialogs/GifSelect.tsx
··· 9 9 import {cleanError} from '#/lib/strings/errors' 10 10 import {isWeb} from '#/platform/detection' 11 11 import { 12 - useExternalEmbedsPrefs, 13 - useSetExternalEmbedPref, 14 - } from '#/state/preferences' 15 - import { 16 12 Gif, 17 13 useFeaturedGifsQuery, 18 14 useGifSearchQuery, ··· 27 23 import {MagnifyingGlass2_Stroke2_Corner0_Rounded as Search} from '#/components/icons/MagnifyingGlass2' 28 24 import {Button, ButtonIcon, ButtonText} from '../Button' 29 25 import {ListFooter, ListMaybePlaceholder} from '../Lists' 30 - import {Text} from '../Typography' 31 26 32 27 export function GifSelectDialog({ 33 28 control, ··· 38 33 onClose: () => void 39 34 onSelectGif: (gif: Gif) => void 40 35 }) { 41 - const externalEmbedsPrefs = useExternalEmbedsPrefs() 42 36 const onSelectGif = useCallback( 43 37 (gif: Gif) => { 44 38 control.close(() => onSelectGifProp(gif)) ··· 46 40 [control, onSelectGifProp], 47 41 ) 48 42 49 - let content = null 50 - let snapPoints 51 - switch (externalEmbedsPrefs?.tenor) { 52 - case 'show': 53 - content = <GifList control={control} onSelectGif={onSelectGif} /> 54 - snapPoints = ['100%'] 55 - break 56 - case 'hide': 57 - default: 58 - content = <TenorConsentPrompt control={control} /> 59 - break 60 - } 61 - 62 43 const renderErrorBoundary = useCallback( 63 44 (error: any) => <DialogError details={String(error)} />, 64 45 [], ··· 67 48 return ( 68 49 <Dialog.Outer 69 50 control={control} 70 - nativeOptions={{sheet: {snapPoints}}} 51 + nativeOptions={{sheet: {snapPoints: ['100%']}}} 71 52 onClose={onClose}> 72 53 <Dialog.Handle /> 73 - <ErrorBoundary renderError={renderErrorBoundary}>{content}</ErrorBoundary> 54 + <ErrorBoundary renderError={renderErrorBoundary}> 55 + <GifList control={control} onSelectGif={onSelectGif} /> 56 + </ErrorBoundary> 74 57 </Dialog.Outer> 75 58 ) 76 59 } ··· 290 273 /> 291 274 )} 292 275 </Button> 293 - ) 294 - } 295 - 296 - function TenorConsentPrompt({control}: {control: Dialog.DialogControlProps}) { 297 - const {_} = useLingui() 298 - const t = useTheme() 299 - const {gtMobile} = useBreakpoints() 300 - const setExternalEmbedPref = useSetExternalEmbedPref() 301 - 302 - const onShowPress = useCallback(() => { 303 - setExternalEmbedPref('tenor', 'show') 304 - }, [setExternalEmbedPref]) 305 - 306 - const onHidePress = useCallback(() => { 307 - setExternalEmbedPref('tenor', 'hide') 308 - control.close() 309 - }, [control, setExternalEmbedPref]) 310 - 311 - const gtMobileWeb = gtMobile && isWeb 312 - 313 - return ( 314 - <Dialog.ScrollableInner label={_(msg`Permission to use Tenor`)}> 315 - <View style={a.gap_sm}> 316 - <Text style={[a.text_2xl, a.font_bold]}> 317 - <Trans>Permission to use Tenor</Trans> 318 - </Text> 319 - 320 - <View style={[a.mt_sm, a.mb_2xl, a.gap_lg]}> 321 - <Text> 322 - <Trans> 323 - Bluesky uses Tenor to provide the GIF selector feature. 324 - </Trans> 325 - </Text> 326 - 327 - <Text style={t.atoms.text_contrast_medium}> 328 - <Trans> 329 - Tenor is a third-party service that provides GIFs for use in 330 - Bluesky. By enabling Tenor, requests will be made to Tenor's 331 - servers to retrieve the GIFs. 332 - </Trans> 333 - </Text> 334 - </View> 335 - </View> 336 - <View style={[a.gap_md, gtMobileWeb && a.flex_row_reverse]}> 337 - <Button 338 - label={_(msg`Enable Tenor`)} 339 - onPress={onShowPress} 340 - onAccessibilityEscape={control.close} 341 - color="primary" 342 - size={gtMobileWeb ? 'small' : 'medium'} 343 - variant="solid"> 344 - <ButtonText> 345 - <Trans>Enable Tenor</Trans> 346 - </ButtonText> 347 - </Button> 348 - <Button 349 - label={_(msg`No thanks`)} 350 - onAccessibilityEscape={control.close} 351 - onPress={onHidePress} 352 - color="secondary" 353 - size={gtMobileWeb ? 'small' : 'medium'} 354 - variant="ghost"> 355 - <ButtonText> 356 - <Trans>No thanks</Trans> 357 - </ButtonText> 358 - </Button> 359 - </View> 360 - </Dialog.ScrollableInner> 361 276 ) 362 277 } 363 278
+19 -15
src/view/screens/PreferencesExternalEmbeds.tsx
··· 1 1 import React from 'react' 2 2 import {StyleSheet, View} from 'react-native' 3 + import {Trans} from '@lingui/macro' 3 4 import {useFocusEffect} from '@react-navigation/native' 4 - import {NativeStackScreenProps, CommonNavigatorParams} from 'lib/routes/types' 5 - import {s} from 'lib/styles' 6 - import {Text} from '../com/util/text/Text' 7 - import {usePalette} from 'lib/hooks/usePalette' 8 - import {useAnalytics} from 'lib/analytics/analytics' 9 - import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' 5 + 10 6 import { 11 7 EmbedPlayerSource, 12 8 externalEmbedLabels, 13 9 } from '#/lib/strings/embed-player' 14 10 import {useSetMinimalShellMode} from '#/state/shell' 15 - import {Trans} from '@lingui/macro' 16 - import {ScrollView} from '../com/util/Views' 11 + import {useAnalytics} from 'lib/analytics/analytics' 12 + import {usePalette} from 'lib/hooks/usePalette' 13 + import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' 14 + import {CommonNavigatorParams, NativeStackScreenProps} from 'lib/routes/types' 15 + import {s} from 'lib/styles' 17 16 import { 18 17 useExternalEmbedsPrefs, 19 18 useSetExternalEmbedPref, 20 19 } from 'state/preferences' 21 20 import {ToggleButton} from 'view/com/util/forms/ToggleButton' 22 21 import {SimpleViewHeader} from '../com/util/SimpleViewHeader' 22 + import {Text} from '../com/util/text/Text' 23 + import {ScrollView} from '../com/util/Views' 23 24 24 25 type Props = NativeStackScreenProps< 25 26 CommonNavigatorParams, ··· 74 75 <Text type="xl-bold" style={[pal.text, styles.heading]}> 75 76 <Trans>Enable media players for</Trans> 76 77 </Text> 77 - {Object.entries(externalEmbedLabels).map(([key, label]) => ( 78 - <PrefSelector 79 - source={key as EmbedPlayerSource} 80 - label={label} 81 - key={key} 82 - /> 83 - ))} 78 + {Object.entries(externalEmbedLabels) 79 + // TODO: Remove special case when we disable the old integration. 80 + .filter(([key]) => key !== 'tenor') 81 + .map(([key, label]) => ( 82 + <PrefSelector 83 + source={key as EmbedPlayerSource} 84 + label={label} 85 + key={key} 86 + /> 87 + ))} 84 88 </ScrollView> 85 89 </View> 86 90 )