refactor(mobile): extract shared MIME type utility and improve error handling
- Extract EXT_TO_MIME map and mimeTypeFromFilename to shared module at mobile/src/utils/mimeTypes.ts (used by _layout.tsx and +not-found.tsx) - Add error logging to ensureLocalUri catch block for debugging - Add error handling to Linking.openURL calls in ProfileScreen - Fix incorrect LSSupportsOpeningDocumentsInPlace docs in audit report Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -45,7 +45,9 @@ export default function ProfileScreen() {
|
||||
text: "Delete Account",
|
||||
style: "destructive",
|
||||
onPress: () => {
|
||||
Linking.openURL(`${effectiveBaseUrl}/account/delete`);
|
||||
Linking.openURL(`${effectiveBaseUrl}/account/delete`).catch(() => {
|
||||
Alert.alert("Error", "Could not open the account deletion page. Please try again.");
|
||||
});
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -53,11 +55,15 @@ export default function ProfileScreen() {
|
||||
}
|
||||
|
||||
function openPrivacyPolicy() {
|
||||
Linking.openURL(`${effectiveBaseUrl}/privacy`);
|
||||
Linking.openURL(`${effectiveBaseUrl}/privacy`).catch(() => {
|
||||
Alert.alert("Error", "Could not open the privacy policy. Please try again.");
|
||||
});
|
||||
}
|
||||
|
||||
function openTermsOfService() {
|
||||
Linking.openURL(`${effectiveBaseUrl}/terms`);
|
||||
Linking.openURL(`${effectiveBaseUrl}/terms`).catch(() => {
|
||||
Alert.alert("Error", "Could not open the terms of service. Please try again.");
|
||||
});
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
|
||||
Reference in New Issue
Block a user