test gemini
This commit is contained in:
@@ -1,22 +1,8 @@
|
|||||||
diff --git a/Dockerfile b/Dockerfile
|
|
||||||
index 371e8402c..2e139503e 100644
|
|
||||||
--- a/Dockerfile
|
|
||||||
+++ b/Dockerfile
|
|
||||||
@@ -66,7 +66,8 @@ RUN \. "$NVM_DIR/nvm.sh" && \
|
|
||||||
echo "EXPO_PUBLIC_BUNDLE_DATE=$(date -u +"%y%m%d%H")" >> .env && \
|
|
||||||
echo "EXPO_PUBLIC_SENTRY_DSN=$EXPO_PUBLIC_SENTRY_DSN" >> .env && \
|
|
||||||
npm install --global yarn && \
|
|
||||||
- yarn && \
|
|
||||||
+ yarn config set registry https://registry.npmjs.org/ && \
|
|
||||||
+ yarn install --frozen-lockfile --network-timeout 100000 && \
|
|
||||||
yarn intl:build 2>&1 | tee i18n.log && \
|
|
||||||
if grep -q "invalid syntax" "i18n.log"; then echo "\n\nFound compilation errors!\n\n" && exit 1; else echo "\n\nNo compile errors!\n\n"; fi && \
|
|
||||||
SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN SENTRY_RELEASE=$EXPO_PUBLIC_RELEASE_VERSION SENTRY_DIST=$EXPO_PUBLIC_BUNDLE_IDENTIFIER yarn build-web
|
|
||||||
diff --git a/app.config.js b/app.config.js
|
diff --git a/app.config.js b/app.config.js
|
||||||
index 246d8abd3..a6582864b 100644
|
index 246d8abd3..0e33bf6ac 100644
|
||||||
--- a/app.config.js
|
--- a/app.config.js
|
||||||
+++ b/app.config.js
|
+++ b/app.config.js
|
||||||
@@ -33,8 +33,8 @@ module.exports = function (_config) {
|
@@ -33,27 +33,32 @@ module.exports = function (_config) {
|
||||||
return {
|
return {
|
||||||
expo: {
|
expo: {
|
||||||
version: VERSION,
|
version: VERSION,
|
||||||
@@ -27,7 +13,11 @@ index 246d8abd3..a6582864b 100644
|
|||||||
scheme: 'bluesky',
|
scheme: 'bluesky',
|
||||||
owner: 'blueskysocial',
|
owner: 'blueskysocial',
|
||||||
runtimeVersion: {
|
runtimeVersion: {
|
||||||
@@ -45,15 +45,20 @@ module.exports = function (_config) {
|
policy: 'appVersion',
|
||||||
|
},
|
||||||
|
- icon: './assets/app-icons/ios_icon_default_next.png',
|
||||||
|
+ icon: './assets/icon.png',
|
||||||
|
userInterfaceStyle: 'automatic',
|
||||||
primaryColor: '#1083fe',
|
primaryColor: '#1083fe',
|
||||||
newArchEnabled: false,
|
newArchEnabled: false,
|
||||||
ios: {
|
ios: {
|
||||||
@@ -68,7 +58,17 @@ index 246d8abd3..a6582864b 100644
|
|||||||
intentFilters: [
|
intentFilters: [
|
||||||
{
|
{
|
||||||
action: 'VIEW',
|
action: 'VIEW',
|
||||||
@@ -220,7 +225,7 @@ module.exports = function (_config) {
|
@@ -213,19 +218,19 @@ module.exports = function (_config) {
|
||||||
|
: undefined,
|
||||||
|
codeSigningMetadata: UPDATES_ENABLED
|
||||||
|
? {
|
||||||
|
- keyid: 'main',
|
||||||
|
- alg: 'rsa-v1_5-sha256',
|
||||||
|
- }
|
||||||
|
+ keyid: 'main',
|
||||||
|
+ alg: 'rsa-v1_5-sha256',
|
||||||
|
+ }
|
||||||
|
: undefined,
|
||||||
checkAutomatically: 'NEVER',
|
checkAutomatically: 'NEVER',
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
@@ -77,6 +77,12 @@ index 246d8abd3..a6582864b 100644
|
|||||||
'expo-localization',
|
'expo-localization',
|
||||||
'expo-web-browser',
|
'expo-web-browser',
|
||||||
[
|
[
|
||||||
|
'react-native-edge-to-edge',
|
||||||
|
- {android: {enforceNavigationBarContrast: false}},
|
||||||
|
+ { android: { enforceNavigationBarContrast: false } },
|
||||||
|
],
|
||||||
|
USE_SENTRY && [
|
||||||
|
'@sentry/react-native/expo',
|
||||||
@@ -239,6 +244,11 @@ module.exports = function (_config) {
|
@@ -239,6 +244,11 @@ module.exports = function (_config) {
|
||||||
'expo-build-properties',
|
'expo-build-properties',
|
||||||
{
|
{
|
||||||
@@ -109,6 +115,15 @@ index 246d8abd3..a6582864b 100644
|
|||||||
enableFullScreenImage_legacy: true,
|
enableFullScreenImage_legacy: true,
|
||||||
backgroundColor: '#ffffff',
|
backgroundColor: '#ffffff',
|
||||||
image: './assets/splash.png',
|
image: './assets/splash.png',
|
||||||
|
@@ -386,7 +400,7 @@ module.exports = function (_config) {
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
- ['expo-screen-orientation', {initialOrientation: 'PORTRAIT_UP'}],
|
||||||
|
+ ['expo-screen-orientation', { initialOrientation: 'PORTRAIT_UP' }],
|
||||||
|
['expo-location'],
|
||||||
|
].filter(Boolean),
|
||||||
|
extra: {
|
||||||
@@ -394,29 +408,30 @@ module.exports = function (_config) {
|
@@ -394,29 +408,30 @@ module.exports = function (_config) {
|
||||||
build: {
|
build: {
|
||||||
experimental: {
|
experimental: {
|
||||||
|
|||||||
@@ -1,44 +1,8 @@
|
|||||||
diff --git a/src/Navigation.tsx b/src/Navigation.tsx
|
|
||||||
index fa33a9d56..13af087c2 100644
|
|
||||||
--- a/src/Navigation.tsx
|
|
||||||
+++ b/src/Navigation.tsx
|
|
||||||
@@ -62,6 +62,7 @@ import {NotFoundScreen} from '#/view/screens/NotFound'
|
|
||||||
import {NotificationsScreen} from '#/view/screens/Notifications'
|
|
||||||
import {PostThreadScreen} from '#/view/screens/PostThread'
|
|
||||||
import {PrivacyPolicyScreen} from '#/view/screens/PrivacyPolicy'
|
|
||||||
+import {LicenseScreen} from '#/view/screens/License'
|
|
||||||
import {ProfileScreen} from '#/view/screens/Profile'
|
|
||||||
import {ProfileFeedLikedByScreen} from '#/view/screens/ProfileFeedLikedBy'
|
|
||||||
import {Storybook} from '#/view/screens/Storybook'
|
|
||||||
@@ -335,6 +336,11 @@ function commonScreens(Stack: typeof Flat, unreadCountLabel?: string) {
|
|
||||||
getComponent={() => TermsOfServiceScreen}
|
|
||||||
options={{title: title(msg`Terms of Service`)}}
|
|
||||||
/>
|
|
||||||
+ <Stack.Screen
|
|
||||||
+ name="License"
|
|
||||||
+ getComponent={() => LicenseScreen}
|
|
||||||
+ options={{title: title(msg`License`)}}
|
|
||||||
+ />
|
|
||||||
<Stack.Screen
|
|
||||||
name="CommunityGuidelines"
|
|
||||||
getComponent={() => CommunityGuidelinesScreen}
|
|
||||||
diff --git a/src/lib/routes/types.ts b/src/lib/routes/types.ts
|
|
||||||
index c315a8341..9b2f50a83 100644
|
|
||||||
--- a/src/lib/routes/types.ts
|
|
||||||
+++ b/src/lib/routes/types.ts
|
|
||||||
@@ -39,6 +39,7 @@ export type CommonNavigatorParams = {
|
|
||||||
Support: undefined
|
|
||||||
PrivacyPolicy: undefined
|
|
||||||
TermsOfService: undefined
|
|
||||||
+ License: undefined
|
|
||||||
CommunityGuidelines: undefined
|
|
||||||
CopyrightPolicy: undefined
|
|
||||||
LanguageSettings: undefined
|
|
||||||
diff --git a/src/routes.ts b/src/routes.ts
|
diff --git a/src/routes.ts b/src/routes.ts
|
||||||
index 1ed913bb2..aa6fccc4e 100644
|
index 1ed913bb2..77ea6deca 100644
|
||||||
--- a/src/routes.ts
|
--- a/src/routes.ts
|
||||||
+++ b/src/routes.ts
|
+++ b/src/routes.ts
|
||||||
@@ -71,8 +71,9 @@ export const router = new Router<AllNavigatableRoutes>({
|
@@ -71,8 +71,8 @@ export const router = new Router<AllNavigatableRoutes>({
|
||||||
MiscellaneousNotificationSettings: '/settings/notifications/miscellaneous',
|
MiscellaneousNotificationSettings: '/settings/notifications/miscellaneous',
|
||||||
// support
|
// support
|
||||||
Support: '/support',
|
Support: '/support',
|
||||||
@@ -46,7 +10,6 @@ index 1ed913bb2..aa6fccc4e 100644
|
|||||||
- TermsOfService: '/support/tos',
|
- TermsOfService: '/support/tos',
|
||||||
+ PrivacyPolicy: 'https://syu.is/about/support/privacy-policy',
|
+ PrivacyPolicy: 'https://syu.is/about/support/privacy-policy',
|
||||||
+ TermsOfService: 'https://syu.is/about/support/tos',
|
+ TermsOfService: 'https://syu.is/about/support/tos',
|
||||||
+ License: '/support/license',
|
|
||||||
CommunityGuidelines: '/support/community-guidelines',
|
CommunityGuidelines: '/support/community-guidelines',
|
||||||
CopyrightPolicy: '/support/copyright',
|
CopyrightPolicy: '/support/copyright',
|
||||||
// hashtags
|
// hashtags
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
--- a/b/src/ageAssurance/index.tsx 2025-12-07 15:18:15
|
diff --git a/src/ageAssurance/index.tsx b/src/ageAssurance/index.tsx
|
||||||
+++ b/src/ageAssurance/index.tsx 2025-12-07 15:18:16
|
index 9a0a9c9d5..85d3c64ce 100644
|
||||||
|
--- a/src/ageAssurance/index.tsx
|
||||||
|
+++ b/src/ageAssurance/index.tsx
|
||||||
@@ -1,10 +1,10 @@
|
@@ -1,10 +1,10 @@
|
||||||
-import {createContext, useCallback, useContext, useEffect, useMemo} from 'react'
|
-import {createContext, useCallback, useContext, useEffect, useMemo} from 'react'
|
||||||
+import { createContext, useCallback, useContext, useEffect, useMemo } from 'react'
|
+import { createContext, useCallback, useContext, useEffect, useMemo } from 'react'
|
||||||
@@ -17,7 +19,7 @@
|
|||||||
import {
|
import {
|
||||||
useAgeAssuranceState,
|
useAgeAssuranceState,
|
||||||
useOnAgeAssuranceAccessUpdate,
|
useOnAgeAssuranceAccessUpdate,
|
||||||
@@ -14,7 +14,7 @@
|
@@ -14,7 +14,7 @@ import {
|
||||||
type AgeAssuranceState,
|
type AgeAssuranceState,
|
||||||
AgeAssuranceStatus,
|
AgeAssuranceStatus,
|
||||||
} from '#/ageAssurance/types'
|
} from '#/ageAssurance/types'
|
||||||
@@ -26,7 +28,7 @@
|
|||||||
|
|
||||||
export {
|
export {
|
||||||
prefetchConfig as prefetchAgeAssuranceConfig,
|
prefetchConfig as prefetchAgeAssuranceConfig,
|
||||||
@@ -23,7 +23,7 @@
|
@@ -23,7 +23,7 @@ export {
|
||||||
usePatchOtherRequiredData as usePatchAgeAssuranceOtherRequiredData,
|
usePatchOtherRequiredData as usePatchAgeAssuranceOtherRequiredData,
|
||||||
usePatchServerState as usePatchAgeAssuranceServerState,
|
usePatchServerState as usePatchAgeAssuranceServerState,
|
||||||
} from '#/ageAssurance/data'
|
} from '#/ageAssurance/data'
|
||||||
@@ -35,7 +37,7 @@
|
|||||||
|
|
||||||
const AgeAssuranceStateContext = createContext<{
|
const AgeAssuranceStateContext = createContext<{
|
||||||
Access: typeof AgeAssuranceAccess
|
Access: typeof AgeAssuranceAccess
|
||||||
@@ -56,7 +56,7 @@
|
@@ -56,7 +56,7 @@ export function useAgeAssurance() {
|
||||||
return useContext(AgeAssuranceStateContext)
|
return useContext(AgeAssuranceStateContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +46,7 @@
|
|||||||
return (
|
return (
|
||||||
<AgeAssuranceDataProvider>
|
<AgeAssuranceDataProvider>
|
||||||
<InnerProvider>
|
<InnerProvider>
|
||||||
@@ -66,9 +66,9 @@
|
@@ -66,9 +66,9 @@ export function Provider({children}: {children: React.ReactNode}) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +58,7 @@
|
|||||||
const getAndRegisterPushToken = useGetAndRegisterPushToken()
|
const getAndRegisterPushToken = useGetAndRegisterPushToken()
|
||||||
|
|
||||||
const handleAccessUpdate = useCallback(
|
const handleAccessUpdate = useCallback(
|
||||||
@@ -82,28 +82,25 @@
|
@@ -82,28 +82,25 @@ function InnerProvider({children}: {children: React.ReactNode}) {
|
||||||
useOnAgeAssuranceAccessUpdate(handleAccessUpdate)
|
useOnAgeAssuranceAccessUpdate(handleAccessUpdate)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
446
ios/patching/021-social-app-ios-clean-feed.patch
Normal file
446
ios/patching/021-social-app-ios-clean-feed.patch
Normal file
@@ -0,0 +1,446 @@
|
|||||||
|
diff --git a/src/view/screens/Home.tsx b/src/view/screens/Home.tsx
|
||||||
|
index e058e2883..a458ab3e1 100644
|
||||||
|
--- a/src/view/screens/Home.tsx
|
||||||
|
+++ b/src/view/screens/Home.tsx
|
||||||
|
@@ -1,342 +1,140 @@
|
||||||
|
import React from 'react'
|
||||||
|
-import {ActivityIndicator, StyleSheet} from 'react-native'
|
||||||
|
-import {useFocusEffect} from '@react-navigation/native'
|
||||||
|
-
|
||||||
|
-import {PROD_DEFAULT_FEED} from '#/lib/constants'
|
||||||
|
-import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
|
||||||
|
-import {useOTAUpdates} from '#/lib/hooks/useOTAUpdates'
|
||||||
|
-import {useSetTitle} from '#/lib/hooks/useSetTitle'
|
||||||
|
-import {useRequestNotificationsPermission} from '#/lib/notifications/notifications'
|
||||||
|
-import {
|
||||||
|
- type HomeTabNavigatorParams,
|
||||||
|
- type NativeStackScreenProps,
|
||||||
|
-} from '#/lib/routes/types'
|
||||||
|
-import {logEvent} from '#/lib/statsig/statsig'
|
||||||
|
-import {isWeb} from '#/platform/detection'
|
||||||
|
-import {emitSoftReset} from '#/state/events'
|
||||||
|
-import {
|
||||||
|
- type SavedFeedSourceInfo,
|
||||||
|
- usePinnedFeedsInfos,
|
||||||
|
-} from '#/state/queries/feed'
|
||||||
|
-import {type FeedDescriptor, type FeedParams} from '#/state/queries/post-feed'
|
||||||
|
-import {usePreferencesQuery} from '#/state/queries/preferences'
|
||||||
|
-import {type UsePreferencesQueryResponse} from '#/state/queries/preferences/types'
|
||||||
|
-import {useSession} from '#/state/session'
|
||||||
|
-import {useSetMinimalShellMode} from '#/state/shell'
|
||||||
|
-import {useLoggedOutViewControls} from '#/state/shell/logged-out'
|
||||||
|
-import {useSelectedFeed, useSetSelectedFeed} from '#/state/shell/selected-feed'
|
||||||
|
-import {FeedPage} from '#/view/com/feeds/FeedPage'
|
||||||
|
-import {HomeHeader} from '#/view/com/home/HomeHeader'
|
||||||
|
-import {
|
||||||
|
- Pager,
|
||||||
|
- type PagerRef,
|
||||||
|
- type RenderTabBarFnProps,
|
||||||
|
-} from '#/view/com/pager/Pager'
|
||||||
|
-import {CustomFeedEmptyState} from '#/view/com/posts/CustomFeedEmptyState'
|
||||||
|
-import {FollowingEmptyState} from '#/view/com/posts/FollowingEmptyState'
|
||||||
|
-import {FollowingEndOfFeed} from '#/view/com/posts/FollowingEndOfFeed'
|
||||||
|
-import {NoFeedsPinned} from '#/screens/Home/NoFeedsPinned'
|
||||||
|
+import { ActivityIndicator, StyleSheet } from 'react-native'
|
||||||
|
+import { useFocusEffect } from '@react-navigation/native'
|
||||||
|
+import { PROD_DEFAULT_FEED } from '#/lib/constants'
|
||||||
|
+import { useNonReactiveCallback } from '#/lib/hooks/useNonReactiveCallback'
|
||||||
|
+import { useOTAUpdates } from '#/lib/hooks/useOTAUpdates'
|
||||||
|
+import { useSetTitle } from '#/lib/hooks/useSetTitle'
|
||||||
|
+import { useRequestNotificationsPermission } from '#/lib/notifications/notifications'
|
||||||
|
+import { type HomeTabNavigatorParams, type NativeStackScreenProps } from '#/lib/routes/types'
|
||||||
|
+import { logEvent } from '#/lib/statsig/statsig'
|
||||||
|
+import { isWeb } from '#/platform/detection'
|
||||||
|
+import { emitSoftReset } from '#/state/events'
|
||||||
|
+import { type SavedFeedSourceInfo, usePinnedFeedsInfos } from '#/state/queries/feed'
|
||||||
|
+import { type FeedDescriptor, type FeedParams } from '#/state/queries/post-feed'
|
||||||
|
+import { usePreferencesQuery } from '#/state/queries/preferences'
|
||||||
|
+import { type UsePreferencesQueryResponse } from '#/state/queries/preferences/types'
|
||||||
|
+import { useSession } from '#/state/session'
|
||||||
|
+import { useSetMinimalShellMode } from '#/state/shell'
|
||||||
|
+import { useLoggedOutViewControls } from '#/state/shell/logged-out'
|
||||||
|
+import { useSelectedFeed, useSetSelectedFeed } from '#/state/shell/selected-feed'
|
||||||
|
+import { FeedPage } from '#/view/com/feeds/FeedPage'
|
||||||
|
+import { HomeHeader } from '#/view/com/home/HomeHeader'
|
||||||
|
+import { Pager, type PagerRef, type RenderTabBarFnProps } from '#/view/com/pager/Pager'
|
||||||
|
+import { CustomFeedEmptyState } from '#/view/com/posts/CustomFeedEmptyState'
|
||||||
|
+import { FollowingEmptyState } from '#/view/com/posts/FollowingEmptyState'
|
||||||
|
+import { FollowingEndOfFeed } from '#/view/com/posts/FollowingEndOfFeed'
|
||||||
|
+import { NoFeedsPinned } from '#/screens/Home/NoFeedsPinned'
|
||||||
|
import * as Layout from '#/components/Layout'
|
||||||
|
-import {useDemoMode} from '#/storage/hooks/demo-mode'
|
||||||
|
+import { useDemoMode } from '#/storage/hooks/demo-mode'
|
||||||
|
+
|
||||||
|
+const DEFAULT_PINNED_FEEDS = [{
|
||||||
|
+ feedDescriptor: 'following',
|
||||||
|
+ displayName: 'Following',
|
||||||
|
+ id: 'following',
|
||||||
|
+ type: 'feed',
|
||||||
|
+ savedFeed: undefined,
|
||||||
|
+ pinned: true,
|
||||||
|
+}]
|
||||||
|
|
||||||
|
type Props = NativeStackScreenProps<HomeTabNavigatorParams, 'Home' | 'Start'>
|
||||||
|
export function HomeScreen(props: Props) {
|
||||||
|
- const {setShowLoggedOut} = useLoggedOutViewControls()
|
||||||
|
- const {data: preferences} = usePreferencesQuery()
|
||||||
|
- const {currentAccount} = useSession()
|
||||||
|
- const {data: pinnedFeedInfos, isLoading: isPinnedFeedsLoading} =
|
||||||
|
- usePinnedFeedsInfos()
|
||||||
|
+ const { setShowLoggedOut } = useLoggedOutViewControls()
|
||||||
|
+ const { data: preferences } = usePreferencesQuery()
|
||||||
|
+ const { currentAccount } = useSession()
|
||||||
|
+ const { data: pinnedFeedInfos } = usePinnedFeedsInfos()
|
||||||
|
+
|
||||||
|
+ const safePreferences = preferences || { feedViewPrefs: { lab_mergeFeedEnabled: false }, savedFeeds: [] } as any
|
||||||
|
+ // Force only Following feed to be pinned/visible
|
||||||
|
+ const safePinnedFeedInfos = [{
|
||||||
|
+ feedDescriptor: 'following',
|
||||||
|
+ displayName: 'Following',
|
||||||
|
+ id: 'following',
|
||||||
|
+ type: 'feed',
|
||||||
|
+ savedFeed: undefined,
|
||||||
|
+ pinned: true,
|
||||||
|
+ }]
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (isWeb && !currentAccount) {
|
||||||
|
const getParams = new URLSearchParams(window.location.search)
|
||||||
|
const splash = getParams.get('splash')
|
||||||
|
- if (splash === 'true') {
|
||||||
|
- setShowLoggedOut(true)
|
||||||
|
- return
|
||||||
|
- }
|
||||||
|
+ if (splash === 'true') { setShowLoggedOut(true); return }
|
||||||
|
}
|
||||||
|
-
|
||||||
|
const params = props.route.params
|
||||||
|
- if (
|
||||||
|
- currentAccount &&
|
||||||
|
- props.route.name === 'Start' &&
|
||||||
|
- params?.name &&
|
||||||
|
- params?.rkey
|
||||||
|
- ) {
|
||||||
|
- props.navigation.navigate('StarterPack', {
|
||||||
|
- rkey: params.rkey,
|
||||||
|
- name: params.name,
|
||||||
|
- })
|
||||||
|
+ if (currentAccount && props.route.name === 'Start' && params?.name && params?.rkey) {
|
||||||
|
+ props.navigation.navigate('StarterPack', { rkey: params.rkey, name: params.name })
|
||||||
|
}
|
||||||
|
- }, [
|
||||||
|
- currentAccount,
|
||||||
|
- props.navigation,
|
||||||
|
- props.route.name,
|
||||||
|
- props.route.params,
|
||||||
|
- setShowLoggedOut,
|
||||||
|
- ])
|
||||||
|
+ }, [currentAccount, props.navigation, props.route.name, props.route.params, setShowLoggedOut])
|
||||||
|
|
||||||
|
- if (preferences && pinnedFeedInfos && !isPinnedFeedsLoading) {
|
||||||
|
- return (
|
||||||
|
- <Layout.Screen testID="HomeScreen">
|
||||||
|
- <HomeScreenReady
|
||||||
|
- {...props}
|
||||||
|
- preferences={preferences}
|
||||||
|
- pinnedFeedInfos={pinnedFeedInfos}
|
||||||
|
- />
|
||||||
|
- </Layout.Screen>
|
||||||
|
- )
|
||||||
|
- } else {
|
||||||
|
- return (
|
||||||
|
- <Layout.Screen>
|
||||||
|
- <Layout.Center style={styles.loading}>
|
||||||
|
- <ActivityIndicator size="large" />
|
||||||
|
- </Layout.Center>
|
||||||
|
- </Layout.Screen>
|
||||||
|
- )
|
||||||
|
- }
|
||||||
|
+ return (
|
||||||
|
+ <Layout.Screen testID="HomeScreen">
|
||||||
|
+ <HomeScreenReady {...props} preferences={safePreferences} pinnedFeedInfos={safePinnedFeedInfos as any} />
|
||||||
|
+ </Layout.Screen>
|
||||||
|
+ )
|
||||||
|
}
|
||||||
|
|
||||||
|
-function HomeScreenReady({
|
||||||
|
- preferences,
|
||||||
|
- pinnedFeedInfos,
|
||||||
|
-}: Props & {
|
||||||
|
- preferences: UsePreferencesQueryResponse
|
||||||
|
- pinnedFeedInfos: SavedFeedSourceInfo[]
|
||||||
|
-}) {
|
||||||
|
- const allFeeds = React.useMemo(
|
||||||
|
- () => pinnedFeedInfos.map(f => f.feedDescriptor),
|
||||||
|
- [pinnedFeedInfos],
|
||||||
|
- )
|
||||||
|
- const maybeRawSelectedFeed: FeedDescriptor | undefined =
|
||||||
|
- useSelectedFeed() ?? allFeeds[0]
|
||||||
|
+function HomeScreenReady({ preferences, pinnedFeedInfos }: any) {
|
||||||
|
+ const allFeeds = React.useMemo(() => pinnedFeedInfos.map(f => f.feedDescriptor), [pinnedFeedInfos])
|
||||||
|
+ const maybeRawSelectedFeed = useSelectedFeed() ?? allFeeds[0]
|
||||||
|
const setSelectedFeed = useSetSelectedFeed()
|
||||||
|
const maybeFoundIndex = allFeeds.indexOf(maybeRawSelectedFeed)
|
||||||
|
const selectedIndex = Math.max(0, maybeFoundIndex)
|
||||||
|
- const maybeSelectedFeed: FeedDescriptor | undefined = allFeeds[selectedIndex]
|
||||||
|
+ const maybeSelectedFeed = allFeeds[selectedIndex]
|
||||||
|
const requestNotificationsPermission = useRequestNotificationsPermission()
|
||||||
|
|
||||||
|
useSetTitle(pinnedFeedInfos[selectedIndex]?.displayName)
|
||||||
|
useOTAUpdates()
|
||||||
|
-
|
||||||
|
- React.useEffect(() => {
|
||||||
|
- requestNotificationsPermission('Home')
|
||||||
|
- }, [requestNotificationsPermission])
|
||||||
|
+ React.useEffect(() => { requestNotificationsPermission('Home') }, [requestNotificationsPermission])
|
||||||
|
|
||||||
|
const pagerRef = React.useRef<PagerRef>(null)
|
||||||
|
const lastPagerReportedIndexRef = React.useRef(selectedIndex)
|
||||||
|
React.useLayoutEffect(() => {
|
||||||
|
- // Since the pager is not a controlled component, adjust it imperatively
|
||||||
|
- // if the selected index gets out of sync with what it last reported.
|
||||||
|
- // This is supposed to only happen on the web when you use the right nav.
|
||||||
|
if (selectedIndex !== lastPagerReportedIndexRef.current) {
|
||||||
|
lastPagerReportedIndexRef.current = selectedIndex
|
||||||
|
pagerRef.current?.setPage(selectedIndex)
|
||||||
|
}
|
||||||
|
}, [selectedIndex])
|
||||||
|
|
||||||
|
- const {hasSession} = useSession()
|
||||||
|
+ const { hasSession } = useSession()
|
||||||
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
|
- useFocusEffect(
|
||||||
|
- React.useCallback(() => {
|
||||||
|
- setMinimalShellMode(false)
|
||||||
|
- }, [setMinimalShellMode]),
|
||||||
|
- )
|
||||||
|
-
|
||||||
|
- useFocusEffect(
|
||||||
|
- useNonReactiveCallback(() => {
|
||||||
|
- if (maybeSelectedFeed) {
|
||||||
|
- logEvent('home:feedDisplayed', {
|
||||||
|
- index: selectedIndex,
|
||||||
|
- feedType: maybeSelectedFeed.split('|')[0],
|
||||||
|
- feedUrl: maybeSelectedFeed,
|
||||||
|
- reason: 'focus',
|
||||||
|
- })
|
||||||
|
- }
|
||||||
|
- }),
|
||||||
|
- )
|
||||||
|
+ useFocusEffect(React.useCallback(() => { setMinimalShellMode(false) }, [setMinimalShellMode]))
|
||||||
|
|
||||||
|
- const onPageSelected = React.useCallback(
|
||||||
|
- (index: number) => {
|
||||||
|
- setMinimalShellMode(false)
|
||||||
|
- const maybeFeed = allFeeds[index]
|
||||||
|
-
|
||||||
|
- // Mutate the ref before setting state to avoid the imperative syncing effect
|
||||||
|
- // above from starting a loop on Android when swiping back and forth.
|
||||||
|
- lastPagerReportedIndexRef.current = index
|
||||||
|
- setSelectedFeed(maybeFeed)
|
||||||
|
-
|
||||||
|
- if (maybeFeed) {
|
||||||
|
- logEvent('home:feedDisplayed', {
|
||||||
|
- index,
|
||||||
|
- feedType: maybeFeed.split('|')[0],
|
||||||
|
- feedUrl: maybeFeed,
|
||||||
|
- })
|
||||||
|
- }
|
||||||
|
- },
|
||||||
|
- [setSelectedFeed, setMinimalShellMode, allFeeds],
|
||||||
|
- )
|
||||||
|
+ const onPageSelected = React.useCallback((index) => {
|
||||||
|
+ setMinimalShellMode(false)
|
||||||
|
+ const maybeFeed = allFeeds[index]
|
||||||
|
+ lastPagerReportedIndexRef.current = index
|
||||||
|
+ setSelectedFeed(maybeFeed)
|
||||||
|
+ }, [setSelectedFeed, setMinimalShellMode, allFeeds])
|
||||||
|
|
||||||
|
- const onPressSelected = React.useCallback(() => {
|
||||||
|
- emitSoftReset()
|
||||||
|
- }, [])
|
||||||
|
-
|
||||||
|
- const onPageScrollStateChanged = React.useCallback(
|
||||||
|
- (state: 'idle' | 'dragging' | 'settling') => {
|
||||||
|
- 'worklet'
|
||||||
|
- if (state === 'dragging') {
|
||||||
|
- setMinimalShellMode(false)
|
||||||
|
- }
|
||||||
|
- },
|
||||||
|
- [setMinimalShellMode],
|
||||||
|
- )
|
||||||
|
+ const onPressSelected = React.useCallback(() => { emitSoftReset() }, [])
|
||||||
|
+ const onPageScrollStateChanged = React.useCallback((state) => {
|
||||||
|
+ 'worklet'
|
||||||
|
+ if (state === 'dragging') setMinimalShellMode(false)
|
||||||
|
+ }, [setMinimalShellMode])
|
||||||
|
|
||||||
|
const [demoMode] = useDemoMode()
|
||||||
|
-
|
||||||
|
- const renderTabBar = React.useCallback(
|
||||||
|
- (props: RenderTabBarFnProps) => {
|
||||||
|
- if (demoMode) {
|
||||||
|
- return (
|
||||||
|
- <HomeHeader
|
||||||
|
- key="FEEDS_TAB_BAR"
|
||||||
|
- {...props}
|
||||||
|
- testID="homeScreenFeedTabs"
|
||||||
|
- onPressSelected={onPressSelected}
|
||||||
|
- // @ts-ignore
|
||||||
|
- feeds={[{displayName: 'Following'}, {displayName: 'Discover'}]}
|
||||||
|
- />
|
||||||
|
- )
|
||||||
|
- }
|
||||||
|
- return (
|
||||||
|
- <HomeHeader
|
||||||
|
- key="FEEDS_TAB_BAR"
|
||||||
|
- {...props}
|
||||||
|
- testID="homeScreenFeedTabs"
|
||||||
|
- onPressSelected={onPressSelected}
|
||||||
|
- feeds={pinnedFeedInfos}
|
||||||
|
- />
|
||||||
|
- )
|
||||||
|
- },
|
||||||
|
- [onPressSelected, pinnedFeedInfos, demoMode],
|
||||||
|
- )
|
||||||
|
-
|
||||||
|
- const renderFollowingEmptyState = React.useCallback(() => {
|
||||||
|
- return <FollowingEmptyState />
|
||||||
|
- }, [])
|
||||||
|
-
|
||||||
|
- const renderCustomFeedEmptyState = React.useCallback(() => {
|
||||||
|
- return <CustomFeedEmptyState />
|
||||||
|
- }, [])
|
||||||
|
-
|
||||||
|
- const homeFeedParams = React.useMemo<FeedParams>(() => {
|
||||||
|
- return {
|
||||||
|
- mergeFeedEnabled: Boolean(preferences.feedViewPrefs.lab_mergeFeedEnabled),
|
||||||
|
- mergeFeedSources: preferences.feedViewPrefs.lab_mergeFeedEnabled
|
||||||
|
- ? preferences.savedFeeds
|
||||||
|
- .filter(f => f.type === 'feed' || f.type === 'list')
|
||||||
|
- .map(f => f.value)
|
||||||
|
- : [],
|
||||||
|
- }
|
||||||
|
- }, [preferences])
|
||||||
|
-
|
||||||
|
- if (demoMode) {
|
||||||
|
- return (
|
||||||
|
- <Pager
|
||||||
|
- ref={pagerRef}
|
||||||
|
- testID="homeScreen"
|
||||||
|
- onPageSelected={onPageSelected}
|
||||||
|
- onPageScrollStateChanged={onPageScrollStateChanged}
|
||||||
|
- renderTabBar={renderTabBar}
|
||||||
|
- initialPage={selectedIndex}>
|
||||||
|
- <FeedPage
|
||||||
|
- testID="demoFeedPage"
|
||||||
|
- isPageFocused
|
||||||
|
- isPageAdjacent={false}
|
||||||
|
- feed="demo"
|
||||||
|
- renderEmptyState={renderCustomFeedEmptyState}
|
||||||
|
- feedInfo={pinnedFeedInfos[0]}
|
||||||
|
- />
|
||||||
|
- <FeedPage
|
||||||
|
- testID="customFeedPage"
|
||||||
|
- isPageFocused
|
||||||
|
- isPageAdjacent={false}
|
||||||
|
- feed={`feedgen|${PROD_DEFAULT_FEED('whats-hot')}`}
|
||||||
|
- renderEmptyState={renderCustomFeedEmptyState}
|
||||||
|
- feedInfo={pinnedFeedInfos[0]}
|
||||||
|
- />
|
||||||
|
- </Pager>
|
||||||
|
- )
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- return hasSession ? (
|
||||||
|
- <Pager
|
||||||
|
- key={allFeeds.join(',')}
|
||||||
|
- ref={pagerRef}
|
||||||
|
- testID="homeScreen"
|
||||||
|
- initialPage={selectedIndex}
|
||||||
|
- onPageSelected={onPageSelected}
|
||||||
|
- onPageScrollStateChanged={onPageScrollStateChanged}
|
||||||
|
- renderTabBar={renderTabBar}>
|
||||||
|
- {pinnedFeedInfos.length ? (
|
||||||
|
- pinnedFeedInfos.map((feedInfo, index) => {
|
||||||
|
- const feed = feedInfo.feedDescriptor
|
||||||
|
- if (feed === 'following') {
|
||||||
|
- return (
|
||||||
|
- <FeedPage
|
||||||
|
- key={feed}
|
||||||
|
- testID="followingFeedPage"
|
||||||
|
- isPageFocused={maybeSelectedFeed === feed}
|
||||||
|
- isPageAdjacent={Math.abs(selectedIndex - index) === 1}
|
||||||
|
- feed={feed}
|
||||||
|
- feedParams={homeFeedParams}
|
||||||
|
- renderEmptyState={renderFollowingEmptyState}
|
||||||
|
- renderEndOfFeed={FollowingEndOfFeed}
|
||||||
|
- feedInfo={feedInfo}
|
||||||
|
- />
|
||||||
|
- )
|
||||||
|
- }
|
||||||
|
- const savedFeedConfig = feedInfo.savedFeed
|
||||||
|
- return (
|
||||||
|
- <FeedPage
|
||||||
|
- key={feed}
|
||||||
|
- testID="customFeedPage"
|
||||||
|
- isPageFocused={maybeSelectedFeed === feed}
|
||||||
|
- isPageAdjacent={Math.abs(selectedIndex - index) === 1}
|
||||||
|
- feed={feed}
|
||||||
|
- renderEmptyState={renderCustomFeedEmptyState}
|
||||||
|
- savedFeedConfig={savedFeedConfig}
|
||||||
|
- feedInfo={feedInfo}
|
||||||
|
- />
|
||||||
|
- )
|
||||||
|
- })
|
||||||
|
- ) : (
|
||||||
|
- <NoFeedsPinned preferences={preferences} />
|
||||||
|
- )}
|
||||||
|
- </Pager>
|
||||||
|
- ) : (
|
||||||
|
- <Pager
|
||||||
|
- testID="homeScreen"
|
||||||
|
- onPageSelected={onPageSelected}
|
||||||
|
- onPageScrollStateChanged={onPageScrollStateChanged}
|
||||||
|
- renderTabBar={renderTabBar}>
|
||||||
|
- <FeedPage
|
||||||
|
- testID="customFeedPage"
|
||||||
|
- isPageFocused
|
||||||
|
- isPageAdjacent={false}
|
||||||
|
- feed={`feedgen|${PROD_DEFAULT_FEED('whats-hot')}`}
|
||||||
|
- renderEmptyState={renderCustomFeedEmptyState}
|
||||||
|
- feedInfo={pinnedFeedInfos[0]}
|
||||||
|
- />
|
||||||
|
+ const renderTabBar = React.useCallback((props) => {
|
||||||
|
+ return <HomeHeader key="FEEDS_TAB_BAR" {...props} testID="homeScreenFeedTabs" onPressSelected={onPressSelected} feeds={pinnedFeedInfos} />
|
||||||
|
+ }, [onPressSelected, pinnedFeedInfos])
|
||||||
|
+
|
||||||
|
+ const renderFollowingEmptyState = React.useCallback(() => <FollowingEmptyState />, [])
|
||||||
|
+ const renderCustomFeedEmptyState = React.useCallback(() => <CustomFeedEmptyState />, [])
|
||||||
|
+
|
||||||
|
+ const homeFeedParams = React.useMemo(() => ({
|
||||||
|
+ mergeFeedEnabled: false, mergeFeedSources: []
|
||||||
|
+ }), [preferences])
|
||||||
|
+
|
||||||
|
+ return (
|
||||||
|
+ <Pager ref={pagerRef} testID="homeScreen" initialPage={selectedIndex} onPageSelected={onPageSelected} onPageScrollStateChanged={onPageScrollStateChanged} renderTabBar={renderTabBar}>
|
||||||
|
+ {pinnedFeedInfos.map((feedInfo, index) => {
|
||||||
|
+ const feed = feedInfo.feedDescriptor
|
||||||
|
+ if (feed === 'following') {
|
||||||
|
+ return <FeedPage key={feed} testID="followingFeedPage" isPageFocused={maybeSelectedFeed === feed} isPageAdjacent={Math.abs(selectedIndex - index) === 1} feed={feed} feedParams={homeFeedParams} renderEmptyState={renderFollowingEmptyState} renderEndOfFeed={FollowingEndOfFeed} feedInfo={feedInfo} />
|
||||||
|
+ }
|
||||||
|
+ return <FeedPage key={feed} testID="customFeedPage" isPageFocused={maybeSelectedFeed === feed} isPageAdjacent={Math.abs(selectedIndex - index) === 1} feed={feed} renderEmptyState={renderCustomFeedEmptyState} savedFeedConfig={feedInfo.savedFeed} feedInfo={feedInfo} />
|
||||||
|
+ })}
|
||||||
|
</Pager>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
-
|
||||||
|
-const styles = StyleSheet.create({
|
||||||
|
- loading: {
|
||||||
|
- height: '100%',
|
||||||
|
- alignContent: 'center',
|
||||||
|
- justifyContent: 'center',
|
||||||
|
- paddingBottom: 100,
|
||||||
|
- },
|
||||||
|
-})
|
||||||
|
+const styles = StyleSheet.create({ loading: { height: '100%', alignContent: 'center', justifyContent: 'center', paddingBottom: 100 } })
|
||||||
Reference in New Issue
Block a user