fix(mobile): keine Foto-Freigabe mehr anfragen, kein „Überspringen“ vor Berechtigungen
Apple 5.1.1(iv): Der Onboarding-Schritt „Profilfoto hinzufügen“ mit „Jetzt überspringen“ wurde als Vorab-Hinweis gewertet, der die Berechtigungsabfrage aufschieben lässt. - requestMediaLibraryPermissionsAsync an allen vier Stellen entfernt (Beitrag, Story, Meilenstein, Onboarding): der System-Bildwähler (iOS PHPicker, Android Photo Picker) braucht keine Freigabe der Mediathek. - AvatarStep ohne „Jetzt überspringen“-Link; „Fertig“ führt auch ohne Foto weiter. Kamera fragt weiter erst beim Tippen auf „Kamera“. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
32ed02d153
commit
0023ef98b5
6 files changed
+13
-35
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
import { View, Text, Image as RNImage, Pressable, ScrollView, ActivityIndicator, StyleSheet, Alert } from "react-native";
|
||||
import { View, Text, Image as RNImage, Pressable, ScrollView, ActivityIndicator, StyleSheet } from "react-native";
|
||||
import { useRouter } from "expo-router";
|
||||
import * as ImagePicker from "expo-image-picker";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -49,11 +49,8 @@ export default function NewMilestoneScreen() {
|
||||
);
|
||||
|
||||
const pickImage = useCallback(async () => {
|
||||
const permission = await ImagePicker.requestMediaLibraryPermissionsAsync();
|
||||
if (!permission.granted) {
|
||||
Alert.alert(t("onboarding.galleryPermissionDenied"));
|
||||
return;
|
||||
}
|
||||
// Kein Berechtigungsdialog: der System-Bildwähler (iOS PHPicker, Android Photo Picker)
|
||||
// braucht keine Freigabe der Fotomediathek (Apple 5.1.1(iv), 07.10.).
|
||||
const result = await ImagePicker.launchImageLibraryAsync({ mediaTypes: ["images"], quality: 0.8 });
|
||||
if (!result.canceled) setAsset(result.assets[0]);
|
||||
}, []);
|
||||
|
||||
@@ -119,11 +119,8 @@ export default function NewPostScreen() {
|
||||
);
|
||||
|
||||
const pickFromGallery = useCallback(async () => {
|
||||
const permission = await ImagePicker.requestMediaLibraryPermissionsAsync();
|
||||
if (!permission.granted) {
|
||||
Alert.alert(t("onboarding.galleryPermissionDenied"));
|
||||
return;
|
||||
}
|
||||
// Kein Berechtigungsdialog: der System-Bildwähler (iOS PHPicker, Android Photo Picker)
|
||||
// braucht keine Freigabe der Fotomediathek (Apple 5.1.1(iv), 07.10.).
|
||||
const result = await ImagePicker.launchImageLibraryAsync({
|
||||
mediaTypes: ["images"],
|
||||
allowsMultipleSelection: true,
|
||||
|
||||
@@ -46,11 +46,8 @@ export default function NewStoryScreen() {
|
||||
);
|
||||
|
||||
const pickFromGallery = useCallback(async () => {
|
||||
const permission = await ImagePicker.requestMediaLibraryPermissionsAsync();
|
||||
if (!permission.granted) {
|
||||
Alert.alert(t("onboarding.galleryPermissionDenied"));
|
||||
return;
|
||||
}
|
||||
// Kein Berechtigungsdialog: der System-Bildwähler (iOS PHPicker, Android Photo Picker)
|
||||
// braucht keine Freigabe der Fotomediathek (Apple 5.1.1(iv), 07.10.).
|
||||
const result = await ImagePicker.launchImageLibraryAsync({ mediaTypes: ["images", "videos"], quality: 0.8 });
|
||||
if (result.canceled) return;
|
||||
|
||||
|
||||
@@ -22,8 +22,9 @@ type Props = {
|
||||
* Port of web's onboarding avatar step (AvatarUpload, invoked from
|
||||
* onboarding/pet/page.tsx once createdPetId exists). Uses the media router
|
||||
* (not posts/stories) — media.getPresignedUrl scopes keys to `avatars/`.
|
||||
* "Skip for now" is always available, matching web: an avatar is never
|
||||
* required to finish onboarding.
|
||||
* An avatar is never required: "Done" finishes onboarding with or without a
|
||||
* photo. No separate "Skip for now" link — Apple (5.1.1(iv)) read it as a
|
||||
* way to dodge a permission prompt.
|
||||
*/
|
||||
export function AvatarStep({ petId, petName, onDone }: Props) {
|
||||
const { t } = useTranslation();
|
||||
@@ -31,7 +32,6 @@ export function AvatarStep({ petId, petName, onDone }: Props) {
|
||||
const styles = useMemo(() => makeStyles(colors), [colors]);
|
||||
const trpc = useTRPC();
|
||||
const [asset, setAsset] = useState<ImagePicker.ImagePickerAsset | null>(null);
|
||||
const [uploadedKey, setUploadedKey] = useState<string | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const getPresignedUrlMutation = useMutation(trpc.media.getPresignedUrl.mutationOptions());
|
||||
@@ -54,7 +54,6 @@ export function AvatarStep({ petId, petName, onDone }: Props) {
|
||||
});
|
||||
await uploadImageToSupabase(resized.uri, presignedUrl, resized.mimeType);
|
||||
await confirmUploadMutation.mutateAsync({ petId, key });
|
||||
setUploadedKey(key);
|
||||
} catch {
|
||||
setError(t("onboarding.uploadError"));
|
||||
}
|
||||
@@ -63,11 +62,8 @@ export function AvatarStep({ petId, petName, onDone }: Props) {
|
||||
);
|
||||
|
||||
const pickFromGallery = useCallback(async () => {
|
||||
const permission = await ImagePicker.requestMediaLibraryPermissionsAsync();
|
||||
if (!permission.granted) {
|
||||
Alert.alert(t("onboarding.galleryPermissionDenied"));
|
||||
return;
|
||||
}
|
||||
// Kein Berechtigungsdialog: der System-Bildwähler (iOS PHPicker, Android Photo Picker)
|
||||
// braucht keine Freigabe der Fotomediathek (Apple 5.1.1(iv), 07.10.).
|
||||
await pickAndUpload(() => ImagePicker.launchImageLibraryAsync({ mediaTypes: ["images"], quality: 0.8 }));
|
||||
}, [pickAndUpload]);
|
||||
|
||||
@@ -113,12 +109,8 @@ export function AvatarStep({ petId, petName, onDone }: Props) {
|
||||
</Pressable>
|
||||
</View>
|
||||
|
||||
{/* Ohne „Überspringen“-Link (Apple 5.1.1(iv)): „Fertig“ führt auch ohne Foto weiter. */}
|
||||
<Button title={t("common.done")} onPress={onDone} disabled={isUploading} style={styles.cta} />
|
||||
{!uploadedKey && (
|
||||
<Pressable onPress={onDone} disabled={isUploading} hitSlop={8}>
|
||||
<Text style={styles.skipLink}>{t("onboarding.skipLink")}</Text>
|
||||
</Pressable>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -156,6 +148,5 @@ function makeStyles(colors: ColorTokens) {
|
||||
},
|
||||
pickerText: { ...typography.body, color: colors.ink },
|
||||
cta: { marginTop: 20, alignSelf: "stretch" },
|
||||
skipLink: { ...typography.label, textTransform: "none", letterSpacing: 0, color: colors.quietGray, marginTop: 12 },
|
||||
});
|
||||
}
|
||||
@@ -292,9 +292,7 @@
|
||||
"avatarSubtitle": "Gib deinem Tier ein Gesicht auf PawFeed. Du kannst das jederzeit ändern.",
|
||||
"galleryButton": "Galerie",
|
||||
"cameraButton": "Kamera",
|
||||
"skipLink": "Jetzt überspringen",
|
||||
"uploadError": "Upload fehlgeschlagen — bitte erneut versuchen.",
|
||||
"galleryPermissionDenied": "Zugriff auf Fotos wurde nicht erlaubt.",
|
||||
"cameraPermissionDenied": "Zugriff auf die Kamera wurde nicht erlaubt."
|
||||
},
|
||||
"petForm": {
|
||||
|
||||
@@ -292,9 +292,7 @@
|
||||
"avatarSubtitle": "Give your pet a face on PawFeed. You can change this anytime.",
|
||||
"galleryButton": "Gallery",
|
||||
"cameraButton": "Camera",
|
||||
"skipLink": "Skip for now",
|
||||
"uploadError": "Upload failed — please try again.",
|
||||
"galleryPermissionDenied": "Access to photos was not granted.",
|
||||
"cameraPermissionDenied": "Access to the camera was not granted."
|
||||
},
|
||||
"petForm": {
|
||||
|
||||
Reference in new issue
Block a user