Fix localization for Following and Discover feed names (#11572)
This commit is contained in:
@@ -4,9 +4,14 @@ import {
|
||||
Reanimated3DefaultSpringConfig,
|
||||
withSpring,
|
||||
} from 'react-native-reanimated'
|
||||
import {useLingui} from '@lingui/react/macro'
|
||||
import {useFocusEffect} from '@react-navigation/native'
|
||||
|
||||
import {PROD_DEFAULT_FEED} from '#/lib/constants'
|
||||
import {
|
||||
DISCOVER_FEED_URI,
|
||||
PROD_DEFAULT_FEED,
|
||||
TIMELINE_SAVED_FEED,
|
||||
} from '#/lib/constants'
|
||||
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
|
||||
import {useOTAUpdates} from '#/lib/hooks/useOTAUpdates'
|
||||
import {useSetTitle} from '#/lib/hooks/useSetTitle'
|
||||
@@ -15,6 +20,7 @@ import {
|
||||
type HomeTabNavigatorParams,
|
||||
type NativeStackScreenProps,
|
||||
} from '#/lib/routes/types'
|
||||
import {getLocalizedFeedName} from '#/lib/strings/feed-names'
|
||||
import {emitSoftReset} from '#/state/events'
|
||||
import {
|
||||
type SavedFeedSourceInfo,
|
||||
@@ -114,6 +120,7 @@ function HomeScreenReady({
|
||||
preferences: UsePreferencesQueryResponse
|
||||
pinnedFeedInfos: SavedFeedSourceInfo[]
|
||||
}) {
|
||||
const {i18n} = useLingui()
|
||||
const ax = useAnalytics()
|
||||
const allFeeds = useMemo(
|
||||
() => pinnedFeedInfos.map(f => f.feedDescriptor),
|
||||
@@ -125,13 +132,14 @@ function HomeScreenReady({
|
||||
const maybeFoundIndex = allFeeds.indexOf(maybeRawSelectedFeed)
|
||||
const selectedIndex = Math.max(0, maybeFoundIndex)
|
||||
const maybeSelectedFeed: FeedDescriptor | undefined = allFeeds[selectedIndex]
|
||||
const selectedFeedInfo = pinnedFeedInfos[selectedIndex]
|
||||
const requestNotificationsPermission = useRequestNotificationsPermission()
|
||||
|
||||
useSetTitle(pinnedFeedInfos[selectedIndex]?.displayName)
|
||||
useSetTitle(selectedFeedInfo && getLocalizedFeedName(selectedFeedInfo, i18n))
|
||||
useOTAUpdates()
|
||||
|
||||
useEffect(() => {
|
||||
requestNotificationsPermission('Home')
|
||||
void requestNotificationsPermission('Home')
|
||||
}, [requestNotificationsPermission])
|
||||
|
||||
const pagerRef = useRef<PagerRef>(null)
|
||||
@@ -223,8 +231,13 @@ function HomeScreenReady({
|
||||
{...props}
|
||||
testID="homeScreenFeedTabs"
|
||||
onPressSelected={onPressSelected}
|
||||
// @ts-expect-error
|
||||
feeds={[{displayName: 'Following'}, {displayName: 'Discover'}]}
|
||||
feeds={[
|
||||
{
|
||||
displayName: 'Following',
|
||||
uri: TIMELINE_SAVED_FEED.value,
|
||||
},
|
||||
{displayName: 'Discover', uri: DISCOVER_FEED_URI},
|
||||
]}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user