mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-10-15 19:45:42 -04:00
fix(native): skip recently-viewed and theming in link previews
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2 files changed
+9
-5
No files matched your search
@@ -8,7 +8,7 @@ import {
|
||||
IconUser,
|
||||
} from "@tabler/icons-react-native";
|
||||
import { useInfiniteQuery } from "@tanstack/react-query";
|
||||
import { useLocalSearchParams, useRouter } from "expo-router";
|
||||
import { useIsPreview, useLocalSearchParams, useRouter } from "expo-router";
|
||||
import { useHeaderHeight } from "expo-router/react-navigation";
|
||||
import { useCallback, useEffect, useMemo } from "react";
|
||||
import { Pressable, useWindowDimensions, View } from "react-native";
|
||||
@@ -68,6 +68,7 @@ export default function PersonDetailScreen() {
|
||||
}),
|
||||
);
|
||||
|
||||
const isPreview = useIsPreview();
|
||||
const person = data?.pages[0]?.person;
|
||||
const filmography = useMemo(() => data?.pages.flatMap((p) => p.filmography) ?? [], [data?.pages]);
|
||||
const userStatuses = useMemo(
|
||||
@@ -84,6 +85,7 @@ export default function PersonDetailScreen() {
|
||||
const personDepartment = person?.knownForDepartment ?? null;
|
||||
|
||||
useEffect(() => {
|
||||
if (isPreview) return;
|
||||
if (personName) {
|
||||
addRecentlyViewed({
|
||||
id,
|
||||
@@ -93,7 +95,7 @@ export default function PersonDetailScreen() {
|
||||
subtitle: personDepartment,
|
||||
});
|
||||
}
|
||||
}, [id, personName, personProfilePath, personDepartment]);
|
||||
}, [isPreview, id, personName, personProfilePath, personDepartment]);
|
||||
|
||||
const renderFilmographyItem = useCallback(
|
||||
({ item: credit }: { item: (typeof filmography)[number] }) => (
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { GlassView, isLiquidGlassAvailable } from "expo-glass-effect";
|
||||
import { LinearGradient } from "expo-linear-gradient";
|
||||
import { Link, useLocalSearchParams, useRouter } from "expo-router";
|
||||
import { Link, useIsPreview, useLocalSearchParams, useRouter } from "expo-router";
|
||||
import { useHeaderHeight } from "expo-router/react-navigation";
|
||||
import * as WebBrowser from "expo-web-browser";
|
||||
import { useCallback, useEffect, useMemo } from "react";
|
||||
@@ -94,6 +94,7 @@ const titleDetailStyles = StyleSheet.create({
|
||||
export default function TitleDetailScreen() {
|
||||
const { t } = useLingui();
|
||||
const { id } = useLocalSearchParams<{ id: string }>();
|
||||
const isPreview = useIsPreview();
|
||||
const insets = useSafeAreaInsets();
|
||||
const headerHeight = useHeaderHeight();
|
||||
const { back } = useRouter();
|
||||
@@ -126,7 +127,7 @@ export default function TitleDetailScreen() {
|
||||
const title = detail.data?.title;
|
||||
const detailErrorCode = getAppErrorCode(detail.error);
|
||||
const palette = title?.colorPalette ?? null;
|
||||
useTitleTheme(palette);
|
||||
useTitleTheme(isPreview ? null : palette);
|
||||
const providerIcon = process.env.EXPO_OS === "ios" ? IconBrandAppstore : IconBrandGooglePlay;
|
||||
|
||||
const titleName = title?.title;
|
||||
@@ -135,6 +136,7 @@ export default function TitleDetailScreen() {
|
||||
const titleYear = (title?.releaseDate ?? title?.firstAirDate)?.slice(0, 4) ?? null;
|
||||
|
||||
useEffect(() => {
|
||||
if (isPreview) return;
|
||||
if (titleName && titleType) {
|
||||
addRecentlyViewed({
|
||||
id,
|
||||
@@ -144,7 +146,7 @@ export default function TitleDetailScreen() {
|
||||
subtitle: titleYear,
|
||||
});
|
||||
}
|
||||
}, [id, titleName, titleType, titlePosterPath, titleYear]);
|
||||
}, [isPreview, id, titleName, titleType, titlePosterPath, titleYear]);
|
||||
|
||||
const seasons = detail.data?.seasons ?? [];
|
||||
const cast = detail.data?.cast ?? [];
|
||||
|
||||
Reference in new issue
Block a user