import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {type NativeStackScreenProps} from '@react-navigation/native-stack' import {type CommonNavigatorParams} from '#/lib/routes/types' import {logEvent} from '#/lib/statsig/statsig' import {isNative} from '#/platform/detection' import {useAutoplayDisabled, useSetAutoplayDisabled} from '#/state/preferences' import { useInAppBrowser, useSetInAppBrowser, } from '#/state/preferences/in-app-browser' import { useTrendingSettings, useTrendingSettingsApi, } from '#/state/preferences/trending' import {useTrendingConfig} from '#/state/trending-config' import * as SettingsList from '#/screens/Settings/components/SettingsList' import * as Toggle from '#/components/forms/Toggle' import {Bubbles_Stroke2_Corner2_Rounded as BubblesIcon} from '#/components/icons/Bubble' import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo' import {Hashtag_Stroke2_Corner0_Rounded as HashtagIcon} from '#/components/icons/Hashtag' import {Home_Stroke2_Corner2_Rounded as HomeIcon} from '#/components/icons/Home' import {Macintosh_Stroke2_Corner2_Rounded as MacintoshIcon} from '#/components/icons/Macintosh' import {Play_Stroke2_Corner2_Rounded as PlayIcon} from '#/components/icons/Play' import {Trending2_Stroke2_Corner2_Rounded as Graph} from '#/components/icons/Trending' import {Window_Stroke2_Corner2_Rounded as WindowIcon} from '#/components/icons/Window' import * as Layout from '#/components/Layout' type Props = NativeStackScreenProps< CommonNavigatorParams, 'ContentAndMediaSettings' > export function ContentAndMediaSettingsScreen({}: Props) { const {_} = useLingui() const autoplayDisabledPref = useAutoplayDisabled() const setAutoplayDisabledPref = useSetAutoplayDisabled() const inAppBrowserPref = useInAppBrowser() const setUseInAppBrowser = useSetInAppBrowser() const {enabled: trendingEnabled} = useTrendingConfig() const {trendingDisabled, trendingVideoDisabled} = useTrendingSettings() const {setTrendingDisabled, setTrendingVideoDisabled} = useTrendingSettingsApi() return ( Content & Media Manage saved feeds Thread preferences Following feed preferences External media Your interests {isNative && ( setUseInAppBrowser(value)}> Use in-app browser to open links )} setAutoplayDisabledPref(!value)}> Autoplay videos and GIFs {trendingEnabled && ( <> { const hide = Boolean(!value) if (hide) { logEvent('trendingTopics:hide', {context: 'settings'}) } else { logEvent('trendingTopics:show', {context: 'settings'}) } setTrendingDisabled(hide) }}> Enable trending topics { const hide = Boolean(!value) if (hide) { logEvent('trendingVideos:hide', {context: 'settings'}) } else { logEvent('trendingVideos:show', {context: 'settings'}) } setTrendingVideoDisabled(hide) }}> Enable trending videos in your Discover feed )} ) }