mirror of
https://github.com/movie-web/native-app.git
synced 2025-09-13 16:33:26 +00:00
feat: gate download behind development certificate on iOS
This commit is contained in:
@@ -1,18 +1,25 @@
|
||||
import type { Asset } from "expo-media-library";
|
||||
import React from "react";
|
||||
import { Alert, Platform } from "react-native";
|
||||
import { ScrollView } from "react-native-gesture-handler";
|
||||
import { useRouter } from "expo-router";
|
||||
import { useFocusEffect, useRouter } from "expo-router";
|
||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||
import { isDevelopmentProvisioningProfile } from "modules/check-ios-certificate";
|
||||
import { useTheme, YStack } from "tamagui";
|
||||
|
||||
|
||||
|
||||
import type { ScrapeMedia } from "@movie-web/provider-utils";
|
||||
|
||||
|
||||
|
||||
import { DownloadItem } from "~/components/DownloadItem";
|
||||
import ScreenLayout from "~/components/layout/ScreenLayout";
|
||||
import { MWButton } from "~/components/ui/Button";
|
||||
import { useDownloadManager } from "~/hooks/DownloadManagerContext";
|
||||
import { usePlayerStore } from "~/stores/player/store";
|
||||
|
||||
|
||||
const DownloadsScreen: React.FC = () => {
|
||||
const { startDownload, downloads } = useDownloadManager();
|
||||
const resetVideo = usePlayerStore((state) => state.resetVideo);
|
||||
@@ -20,6 +27,23 @@ const DownloadsScreen: React.FC = () => {
|
||||
const router = useRouter();
|
||||
const theme = useTheme();
|
||||
|
||||
useFocusEffect(
|
||||
React.useCallback(() => {
|
||||
if (Platform.OS === "ios" && !isDevelopmentProvisioningProfile()) {
|
||||
Alert.alert(
|
||||
"Production Certificate",
|
||||
"Download functionality is not available when the application is signed with a distribution certificate.",
|
||||
[
|
||||
{
|
||||
text: "OK",
|
||||
onPress: () => router.back(),
|
||||
},
|
||||
],
|
||||
);
|
||||
}
|
||||
}, [router]),
|
||||
);
|
||||
|
||||
const handlePress = (asset?: Asset) => {
|
||||
if (!asset) return;
|
||||
resetVideo();
|
||||
@@ -44,6 +68,9 @@ const DownloadsScreen: React.FC = () => {
|
||||
tmdbId: "98765",
|
||||
},
|
||||
};
|
||||
|
||||
console.log(isDevelopmentProvisioningProfile());
|
||||
|
||||
return (
|
||||
<ScreenLayout>
|
||||
<YStack gap={2} style={{ padding: 10 }}>
|
||||
@@ -101,4 +128,4 @@ const DownloadsScreen: React.FC = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default DownloadsScreen;
|
||||
export default DownloadsScreen;
|
Reference in New Issue
Block a user