fix(mobile): fix file sharing deep-link conflicts and add MIME type inference
- Skip known deep-link paths (qr-login, callback) in makeUrlHandler to prevent docuelevate://qr-login URLs from being treated as shared files and creating phantom upload errors - Infer MIME type from file extension for files shared via iOS Share Sheet / "Open In…" so the server receives correct Content-Type instead of application/octet-stream - Default login screen server URL to https://app.docuelevate.org Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -28,7 +28,7 @@ import { useAuth } from "../context/AuthContext";
|
||||
export default function LoginScreen() {
|
||||
const { signIn, signInWithQR } = useAuth();
|
||||
const router = useRouter();
|
||||
const [serverUrl, setServerUrl] = useState("");
|
||||
const [serverUrl, setServerUrl] = useState("https://app.docuelevate.org");
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [qrLoading, setQrLoading] = useState(false);
|
||||
|
||||
|
||||
@@ -16,9 +16,12 @@ import {
|
||||
} from "react-native";
|
||||
import { useAuth } from "../context/AuthContext";
|
||||
|
||||
const DEFAULT_SERVER_URL = "https://app.docuelevate.org";
|
||||
|
||||
export default function ProfileScreen() {
|
||||
const { user, signOut, baseUrl } = useAuth();
|
||||
|
||||
const effectiveBaseUrl = baseUrl || DEFAULT_SERVER_URL;
|
||||
const appVersion = Constants.expoConfig?.version ?? "1.0.0";
|
||||
|
||||
function handleSignOut() {
|
||||
@@ -33,10 +36,6 @@ export default function ProfileScreen() {
|
||||
}
|
||||
|
||||
function handleDeleteAccount() {
|
||||
if (!baseUrl) {
|
||||
Alert.alert("Not Connected", "Cannot reach server. Please sign in again.");
|
||||
return;
|
||||
}
|
||||
Alert.alert(
|
||||
"Delete Account",
|
||||
"This will permanently delete your account and all associated data. This action cannot be undone.",
|
||||
@@ -46,7 +45,7 @@ export default function ProfileScreen() {
|
||||
text: "Delete Account",
|
||||
style: "destructive",
|
||||
onPress: () => {
|
||||
Linking.openURL(`${baseUrl}/account/delete`);
|
||||
Linking.openURL(`${effectiveBaseUrl}/account/delete`);
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -54,19 +53,11 @@ export default function ProfileScreen() {
|
||||
}
|
||||
|
||||
function openPrivacyPolicy() {
|
||||
if (!baseUrl) {
|
||||
Alert.alert("Not Connected", "Cannot reach server. Please sign in again.");
|
||||
return;
|
||||
}
|
||||
Linking.openURL(`${baseUrl}/privacy`);
|
||||
Linking.openURL(`${effectiveBaseUrl}/privacy`);
|
||||
}
|
||||
|
||||
function openTermsOfService() {
|
||||
if (!baseUrl) {
|
||||
Alert.alert("Not Connected", "Cannot reach server. Please sign in again.");
|
||||
return;
|
||||
}
|
||||
Linking.openURL(`${baseUrl}/terms`);
|
||||
Linking.openURL(`${effectiveBaseUrl}/terms`);
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
@@ -105,7 +96,7 @@ export default function ProfileScreen() {
|
||||
<View style={styles.row}>
|
||||
<Text style={styles.rowLabel}>Server</Text>
|
||||
<Text style={styles.rowValue} numberOfLines={1}>
|
||||
{baseUrl || "–"}
|
||||
{effectiveBaseUrl}
|
||||
</Text>
|
||||
</View>
|
||||
<View style={styles.row}>
|
||||
|
||||
Reference in New Issue
Block a user