feat: preview trending feed, resolve FOL-2267

This commit is contained in:
Stephen Zhou
2025-07-24 11:28:41 +08:00
parent 2c1e84faae
commit 308822a16d
4 changed files with 36 additions and 13 deletions
@@ -460,7 +460,7 @@
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = is.follow;
PRODUCT_NAME = "Folo";
PRODUCT_NAME = Folo;
SWIFT_OBJC_BRIDGING_HEADER = "Folo/Folo-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
@@ -492,7 +492,7 @@
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
PRODUCT_BUNDLE_IDENTIFIER = is.follow;
PRODUCT_NAME = "Folo";
PRODUCT_NAME = Folo;
SWIFT_OBJC_BRIDGING_HEADER = "Folo/Folo-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -13,6 +13,9 @@ import { Text } from "@/src/components/ui/typography/Text"
import type { apiClient } from "@/src/lib/api-fetch"
import { useNavigation } from "@/src/lib/navigation/hooks"
import { FollowScreen } from "@/src/screens/(modal)/FollowScreen"
import { FeedScreen } from "@/src/screens/(stack)/feeds/[feedId]/FeedScreen"
import { selectFeed } from "../screen/atoms"
type SearchResultItem = Awaited<ReturnType<typeof apiClient.discover.$post>>["data"][number]
export const FeedSummary = ({
@@ -34,9 +37,12 @@ export const FeedSummary = ({
itemStyle={ItemPressableStyle.UnStyled}
onPress={() => {
if (item.feed?.id) {
navigation.presentControllerView(FollowScreen, {
id: item.feed.id,
selectFeed({
type: "feed",
feedId: item.feed.id,
})
navigation.pushControllerView(FeedScreen, {
feedId: item.feed?.id,
})
} else if (item.feed?.url) {
navigation.presentControllerView(FollowScreen, {
@@ -1,20 +1,30 @@
import { FeedViewType } from "@follow/constants"
import { useFeedById } from "@follow/store/feed/hooks"
import { useIsSubscribed } from "@follow/store/subscription/hooks"
import { isBizId } from "@follow/utils"
import { useMemo } from "react"
import { useTranslation } from "react-i18next"
import { Pressable } from "react-native"
import { RootSiblingParent } from "react-native-root-siblings"
import { useSafeAreaInsets } from "react-native-safe-area-context"
import { BottomTabBarHeightContext } from "@/src/components/layouts/tabbar/contexts/BottomTabBarHeightContext"
import { Text } from "@/src/components/ui/typography/Text"
import { useNavigation } from "@/src/lib/navigation/hooks"
import type { NavigationControllerView } from "@/src/lib/navigation/types"
import { EntryListSelector } from "@/src/modules/entry-list/EntryListSelector"
import { EntryListContext, useEntries, useSelectedView } from "@/src/modules/screen/atoms"
import { TimelineHeader } from "@/src/modules/screen/TimelineSelectorProvider"
import { FollowScreen } from "@/src/screens/(modal)/FollowScreen"
export const FeedScreen: NavigationControllerView<{
feedId: string
}> = ({ feedId: feedIdentifier }) => {
const insets = useSafeAreaInsets()
const feed = useFeedById(feedIdentifier)
const navigation = useNavigation()
const isSubscribed = useIsSubscribed(feedIdentifier)
const { t } = useTranslation("common")
return (
<EntryListContext value={useMemo(() => ({ type: "feed" }), [])}>
@@ -22,6 +32,19 @@ export const FeedScreen: NavigationControllerView<{
<BottomTabBarHeightContext value={insets.bottom}>
<TimelineHeader feedId={feed?.id} />
<FeedScreenEntryList />
{!isSubscribed && isBizId(feedIdentifier) && (
<Pressable
className="bg-accent absolute bottom-10 left-1/2 z-10 m-2 mx-auto -translate-x-1/2 rounded-full px-4 py-2"
onPress={() => {
navigation.presentControllerView(FollowScreen, {
id: feedIdentifier,
type: "feed",
})
}}
>
<Text className="font-bold text-white">{t("words.follow")}</Text>
</Pressable>
)}
</BottomTabBarHeightContext>
</RootSiblingParent>
</EntryListContext>
@@ -3,7 +3,7 @@ import { SubscriptionService } from "@follow/database/services/subscription"
import { tracker } from "@follow/tracker"
import { omit } from "es-toolkit"
import { api } from "../context"
import { api, apiClient } from "../context"
import { invalidateEntriesQuery } from "../entry/hooks"
import { getFeedById } from "../feed/getter"
import { feedActions } from "../feed/store"
@@ -262,14 +262,8 @@ class SubscriptionSyncService {
}
async subscribe(subscription: SubscriptionForm) {
const { data } = await api().subscriptions.create({
url: subscription.url,
view: subscription.view,
category: subscription.category,
isPrivate: subscription.isPrivate,
title: subscription.title,
listId: subscription.listId,
const data = await apiClient().subscriptions.$post({
json: subscription,
})
if (data.feed) {