diff --git a/apps/mobile/native/ios/Modules/SharedWebView/FOWebView.swift b/apps/mobile/native/ios/Modules/SharedWebView/FOWebView.swift index 91f95f1c2..f548d0f6d 100644 --- a/apps/mobile/native/ios/Modules/SharedWebView/FOWebView.swift +++ b/apps/mobile/native/ios/Modules/SharedWebView/FOWebView.swift @@ -39,7 +39,7 @@ class FOWebView: WKWebView { navigationDelegate = self uiDelegate = self } - + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } diff --git a/apps/mobile/native/ios/Modules/SharedWebView/SharedWebView.swift b/apps/mobile/native/ios/Modules/SharedWebView/SharedWebView.swift index 6766883c5..f621082d8 100644 --- a/apps/mobile/native/ios/Modules/SharedWebView/SharedWebView.swift +++ b/apps/mobile/native/ios/Modules/SharedWebView/SharedWebView.swift @@ -6,13 +6,10 @@ import WebKit class WebViewView: ExpoView { private var cancellable: AnyCancellable? - private let rctView = RCTView(frame: .zero) required init(appContext: AppContext? = nil) { super.init(appContext: appContext) - addSubview(rctView) - - rctView.addSubview(SharedWebViewModule.sharedWebView!) + addSubview(SharedWebViewModule.sharedWebView!) clipsToBounds = true cancellable = WebViewManager.state.$contentHeight @@ -21,7 +18,7 @@ class WebViewView: ExpoView { self?.layoutSubviews() } } - + deinit { cancellable?.cancel() } @@ -40,7 +37,6 @@ class WebViewView: ExpoView { webView.scrollView.frame = rect frame = rect - rctView.frame = rect onContentHeightChange(["height": Float(rect.height)]) } diff --git a/apps/mobile/src/components/layouts/tabbar/Tabbar.tsx b/apps/mobile/src/components/layouts/tabbar/Tabbar.tsx index e49601bca..ad73ae76b 100644 --- a/apps/mobile/src/components/layouts/tabbar/Tabbar.tsx +++ b/apps/mobile/src/components/layouts/tabbar/Tabbar.tsx @@ -252,7 +252,7 @@ const TabBarBackground = () => { ) : ( ))} diff --git a/apps/mobile/src/modules/settings/routes/ManageList.tsx b/apps/mobile/src/modules/settings/routes/ManageList.tsx index d3962ac5f..2d47a57e7 100644 --- a/apps/mobile/src/modules/settings/routes/ManageList.tsx +++ b/apps/mobile/src/modules/settings/routes/ManageList.tsx @@ -114,7 +114,7 @@ const ListImpl: React.FC<{ id: string }> = ({ id }) => { const SeparatorComponent = () => { return ( diff --git a/apps/mobile/src/modules/settings/routes/Profile.tsx b/apps/mobile/src/modules/settings/routes/Profile.tsx deleted file mode 100644 index 43aba8e31..000000000 --- a/apps/mobile/src/modules/settings/routes/Profile.tsx +++ /dev/null @@ -1,278 +0,0 @@ -import type { FeedViewType } from "@follow/constants" -import { cn } from "@follow/utils" -import { Fragment, useCallback, useEffect, useMemo } from "react" -import { - ActivityIndicator, - FlatList, - Image, - Share, - StyleSheet, - Text, - TouchableOpacity, - View, -} from "react-native" -import Animated, { useAnimatedScrollHandler, useSharedValue } from "react-native-reanimated" -import { useSafeAreaInsets } from "react-native-safe-area-context" - -import { ReAnimatedScrollView } from "@/src/components/common/AnimatedComponents" -import { BlurEffect } from "@/src/components/common/BlurEffect" -import { FallbackIcon } from "@/src/components/ui/icon/fallback-icon" -import type { FeedIconRequiredFeed } from "@/src/components/ui/icon/feed-icon" -import { FeedIcon } from "@/src/components/ui/icon/feed-icon" -import { MingcuteLeftLineIcon } from "@/src/icons/mingcute_left_line" -import { Share3CuteReIcon } from "@/src/icons/share_3_cute_re" -import type { apiClient } from "@/src/lib/api-fetch" -import { useNavigation } from "@/src/lib/navigation/hooks" -import { toast } from "@/src/lib/toast" -import type { FeedModel } from "@/src/store/feed/types" -import type { ListModel } from "@/src/store/list/store" -import { useWhoami } from "@/src/store/user/hooks" -import { useColor } from "@/src/theme/colors" - -import { ItemSeparator } from "../../subscription/ItemSeparator" -import { useShareSubscription } from "../hooks/useShareSubscription" -import { UserHeaderBanner } from "../UserHeaderBanner" - -type Subscription = Awaited>["data"][number] -/** - * @deprecated - */ -export const ProfileScreen = () => { - const scrollY = useSharedValue(0) - const whoami = useWhoami() - const { - data: subscriptions, - isLoading, - isError, - } = useShareSubscription({ - userId: whoami?.id!, - }) - - const headerOpacity = useSharedValue(0) - const scrollHandler = useAnimatedScrollHandler((event) => { - scrollY.value = event.contentOffset.y - headerOpacity.value = scrollY.value / 100 - }) - - useEffect(() => { - if (isError) { - toast.error("Failed to fetch subscriptions") - } - }, [isError]) - - const insets = useSafeAreaInsets() - - const textLabelColor = useColor("label") - const openShareUrl = useCallback(() => { - if (!whoami?.id) return - Share.share({ - url: `https://app.follow.is/share/users/${whoami.id}`, - title: `Folo | ${whoami.name}'s Profile`, - }) - }, [whoami?.id, whoami?.name]) - - const navigation = useNavigation() - return ( - - - {!!whoami?.id && } - - {isLoading && } - {!isLoading && subscriptions && } - - {/* Top transparent header buttons */} - navigation.back()} - className="absolute left-4" - style={{ top: insets.top }} - > - - - - - - - {/* Header */} - - - navigation.back()}> - - - - - {whoami?.name}'s Profile - - - - - - - - ) -} - -type PickedListModel = Pick & { - customTitle?: string | null -} -type PickedFeedModel = Pick< - FeedModel, - "id" | "title" | "description" | "siteUrl" | "url" | "image" -> & { - customTitle?: string | null - view: FeedViewType -} -const SubscriptionList = ({ subscriptions }: { subscriptions: Subscription[] }) => { - const { lists, feeds, groupedFeeds } = useMemo(() => { - const lists = [] as PickedListModel[] - const feeds = [] as PickedFeedModel[] - - const groupedFeeds = {} as Record - - for (const subscription of subscriptions) { - if ("listId" in subscription) { - lists.push({ - id: subscription.listId, - title: subscription.lists.title!, - image: subscription.lists.image!, - description: subscription.lists.description!, - view: subscription.lists.view, - customTitle: subscription.title, - }) - continue - } - - if ("feedId" in subscription && "feeds" in subscription) { - const feed = { - id: subscription.feedId, - title: subscription.feeds.title!, - image: subscription.feeds.image!, - description: subscription.feeds.description!, - siteUrl: subscription.feeds.siteUrl!, - url: subscription.feeds.url!, - view: subscription.view as FeedViewType, - customTitle: subscription.title, - } - - if (subscription.category) { - groupedFeeds[subscription.category] = [ - ...(groupedFeeds[subscription.category] || []), - feed, - ] - } else { - feeds.push(feed) - } - } - } - return { lists, feeds, groupedFeeds } - }, [subscriptions]) - - const hasFeeds = Object.keys(groupedFeeds).length > 0 || feeds.length > 0 - return ( - - {lists.length > 0 && ( - - - - - - )} - {hasFeeds && ( - - - {Object.entries(groupedFeeds).map(([category, feeds], index) => ( - - - {category} - - - - ))} - - - Uncategorized Feeds - - - - )} - - ) -} -const renderListItems = ({ item }: { item: PickedListModel }) => ( - - - {!!item.image && ( - - )} - {!item.image && } - - - {item.title} - -) - -const renderFeedItems = ({ item }: { item: PickedFeedModel }) => ( - - - - - {item.title} - -) - -const SectionHeader = ({ title }: { title: string }) => ( - - - {title} - - -) diff --git a/apps/mobile/src/screens/(modal)/profile.tsx b/apps/mobile/src/screens/(modal)/profile.tsx index 279757e74..68ad150fd 100644 --- a/apps/mobile/src/screens/(modal)/profile.tsx +++ b/apps/mobile/src/screens/(modal)/profile.tsx @@ -11,11 +11,20 @@ import { TouchableOpacity, View, } from "react-native" -import Animated, { useAnimatedScrollHandler, useSharedValue } from "react-native-reanimated" +import Animated, { + interpolate, + useAnimatedScrollHandler, + useAnimatedStyle, + useSharedValue, +} from "react-native-reanimated" import { useSafeAreaFrame, useSafeAreaInsets } from "react-native-safe-area-context" import { ReAnimatedScrollView } from "@/src/components/common/AnimatedComponents" import { BlurEffect } from "@/src/components/common/BlurEffect" +import { + InternalNavigationHeader, + UINavigationHeaderActionButton, +} from "@/src/components/layouts/header/NavigationHeader" import { getDefaultHeaderHeight } from "@/src/components/layouts/utils" import { FallbackIcon } from "@/src/components/ui/icon/fallback-icon" import type { FeedIconRequiredFeed } from "@/src/components/ui/icon/feed-icon" @@ -84,6 +93,21 @@ function ProfileScreenImpl(props: { userId: string }) { return ( + + + + + + } + /> + } - ({ + opacity: interpolate(headerOpacity.value, [0, 1], [1, 0]), + }))} + className="absolute top-5 w-full flex-row items-center justify-between px-4" > - - {/* Header */} - - - - - {user?.name}'s Profile - - - - - ) diff --git a/apps/mobile/src/screens/(stack)/(tabs)/settings.tsx b/apps/mobile/src/screens/(stack)/(tabs)/settings.tsx index 0248af95f..f2434dfb0 100644 --- a/apps/mobile/src/screens/(stack)/(tabs)/settings.tsx +++ b/apps/mobile/src/screens/(stack)/(tabs)/settings.tsx @@ -34,7 +34,6 @@ export function Settings() { <>