Skip to content

Commit 308822a

Browse files
committed
feat: preview trending feed, resolve FOL-2267
1 parent 2c1e84f commit 308822a

4 files changed

Lines changed: 36 additions & 13 deletions

File tree

apps/mobile/ios/Folo.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@
460460
);
461461
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
462462
PRODUCT_BUNDLE_IDENTIFIER = is.follow;
463-
PRODUCT_NAME = "Folo";
463+
PRODUCT_NAME = Folo;
464464
SWIFT_OBJC_BRIDGING_HEADER = "Folo/Folo-Bridging-Header.h";
465465
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
466466
SWIFT_VERSION = 5.0;
@@ -492,7 +492,7 @@
492492
);
493493
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
494494
PRODUCT_BUNDLE_IDENTIFIER = is.follow;
495-
PRODUCT_NAME = "Folo";
495+
PRODUCT_NAME = Folo;
496496
SWIFT_OBJC_BRIDGING_HEADER = "Folo/Folo-Bridging-Header.h";
497497
SWIFT_VERSION = 5.0;
498498
TARGETED_DEVICE_FAMILY = "1,2";

apps/mobile/src/modules/discover/FeedSummary.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import { Text } from "@/src/components/ui/typography/Text"
1313
import type { apiClient } from "@/src/lib/api-fetch"
1414
import { useNavigation } from "@/src/lib/navigation/hooks"
1515
import { FollowScreen } from "@/src/screens/(modal)/FollowScreen"
16+
import { FeedScreen } from "@/src/screens/(stack)/feeds/[feedId]/FeedScreen"
17+
18+
import { selectFeed } from "../screen/atoms"
1619

1720
type SearchResultItem = Awaited<ReturnType<typeof apiClient.discover.$post>>["data"][number]
1821
export const FeedSummary = ({
@@ -34,9 +37,12 @@ export const FeedSummary = ({
3437
itemStyle={ItemPressableStyle.UnStyled}
3538
onPress={() => {
3639
if (item.feed?.id) {
37-
navigation.presentControllerView(FollowScreen, {
38-
id: item.feed.id,
40+
selectFeed({
3941
type: "feed",
42+
feedId: item.feed.id,
43+
})
44+
navigation.pushControllerView(FeedScreen, {
45+
feedId: item.feed?.id,
4046
})
4147
} else if (item.feed?.url) {
4248
navigation.presentControllerView(FollowScreen, {

apps/mobile/src/screens/(stack)/feeds/[feedId]/FeedScreen.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,50 @@
11
import { FeedViewType } from "@follow/constants"
22
import { useFeedById } from "@follow/store/feed/hooks"
3+
import { useIsSubscribed } from "@follow/store/subscription/hooks"
4+
import { isBizId } from "@follow/utils"
35
import { useMemo } from "react"
6+
import { useTranslation } from "react-i18next"
7+
import { Pressable } from "react-native"
48
import { RootSiblingParent } from "react-native-root-siblings"
59
import { useSafeAreaInsets } from "react-native-safe-area-context"
610

711
import { BottomTabBarHeightContext } from "@/src/components/layouts/tabbar/contexts/BottomTabBarHeightContext"
12+
import { Text } from "@/src/components/ui/typography/Text"
13+
import { useNavigation } from "@/src/lib/navigation/hooks"
814
import type { NavigationControllerView } from "@/src/lib/navigation/types"
915
import { EntryListSelector } from "@/src/modules/entry-list/EntryListSelector"
1016
import { EntryListContext, useEntries, useSelectedView } from "@/src/modules/screen/atoms"
1117
import { TimelineHeader } from "@/src/modules/screen/TimelineSelectorProvider"
18+
import { FollowScreen } from "@/src/screens/(modal)/FollowScreen"
1219

1320
export const FeedScreen: NavigationControllerView<{
1421
feedId: string
1522
}> = ({ feedId: feedIdentifier }) => {
1623
const insets = useSafeAreaInsets()
1724
const feed = useFeedById(feedIdentifier)
25+
const navigation = useNavigation()
26+
const isSubscribed = useIsSubscribed(feedIdentifier)
27+
const { t } = useTranslation("common")
1828

1929
return (
2030
<EntryListContext value={useMemo(() => ({ type: "feed" }), [])}>
2131
<RootSiblingParent>
2232
<BottomTabBarHeightContext value={insets.bottom}>
2333
<TimelineHeader feedId={feed?.id} />
2434
<FeedScreenEntryList />
35+
{!isSubscribed && isBizId(feedIdentifier) && (
36+
<Pressable
37+
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"
38+
onPress={() => {
39+
navigation.presentControllerView(FollowScreen, {
40+
id: feedIdentifier,
41+
type: "feed",
42+
})
43+
}}
44+
>
45+
<Text className="font-bold text-white">{t("words.follow")}</Text>
46+
</Pressable>
47+
)}
2548
</BottomTabBarHeightContext>
2649
</RootSiblingParent>
2750
</EntryListContext>

packages/internal/store/src/subscription/store.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { SubscriptionService } from "@follow/database/services/subscription"
33
import { tracker } from "@follow/tracker"
44
import { omit } from "es-toolkit"
55

6-
import { api } from "../context"
6+
import { api, apiClient } from "../context"
77
import { invalidateEntriesQuery } from "../entry/hooks"
88
import { getFeedById } from "../feed/getter"
99
import { feedActions } from "../feed/store"
@@ -262,14 +262,8 @@ class SubscriptionSyncService {
262262
}
263263

264264
async subscribe(subscription: SubscriptionForm) {
265-
const { data } = await api().subscriptions.create({
266-
url: subscription.url,
267-
268-
view: subscription.view,
269-
category: subscription.category,
270-
isPrivate: subscription.isPrivate,
271-
title: subscription.title,
272-
listId: subscription.listId,
265+
const data = await apiClient().subscriptions.$post({
266+
json: subscription,
273267
})
274268

275269
if (data.feed) {

0 commit comments

Comments
 (0)