diff --git a/lib/screens/AddNoteScreen.tsx b/lib/screens/AddNoteScreen.tsx index d42aded..1f2411f 100644 --- a/lib/screens/AddNoteScreen.tsx +++ b/lib/screens/AddNoteScreen.tsx @@ -178,20 +178,30 @@ const AddNoteScreen: React.FC = ({ navigation, route }) => { const saveNote = async () => { const locationPermissionGranted = await checkLocationPermission(); if (titleText === "") { - if (!promptedMissingTitle) { - setPromptedMissingTitle(true); - Alert.alert( - "Title is empty", - "Please enter a title to save the note, or press back again to confirm not saving the note.", - ); - return; - } else { - navigation.goBack(); - return; - } + Alert.alert( + "Title is empty", + "Please enter a title to save the note.", + ); + return; } if (!locationPermissionGranted) { - return; // Stop saving the note if location permission is not granted + Alert.alert( + "Delete Note", + "Location permissions required to save. Are you sure you want to delete this note?", + [ + { + text: "Cancel", + onPress: () => console.log("Cancel Pressed"), + style: "cancel" + }, + { + text: "Delete", + onPress: () => navigation.goBack() + } + ], + { cancelable: false } + ); + return; } else { try { @@ -200,8 +210,8 @@ const AddNoteScreen: React.FC = ({ navigation, route }) => { let latitude, longitude; if (Platform.OS === 'ios') { - latitude = location?.latitude.toString(); - longitude = location?.longitude.toString(); + latitude = userLocation.coords.latitude.toString(); + longitude = userLocation.coords.longitude.toString(); } else if (Platform.OS === 'android') { latitude = userLocation.coords.latitude.toString(); longitude = userLocation.coords.longitude.toString(); diff --git a/lib/utils/S3_proxy.ts b/lib/utils/S3_proxy.ts index 65f052e..2ad4ddd 100644 --- a/lib/utils/S3_proxy.ts +++ b/lib/utils/S3_proxy.ts @@ -41,7 +41,7 @@ async function uploadMedia(uri: string, mediaType: string): Promise { console.log("File size:", file.size); data.append("file", file); - } else { + } else if(Platform.OS == "ios") { let base64 = await FileSystem.readAsStringAsync(uri, { encoding: FileSystem.EncodingType.Base64, }); @@ -57,6 +57,13 @@ async function uploadMedia(uri: string, mediaType: string): Promise { name: uniqueName, }); } + else if (Platform.OS == "android"){ + data.append("file", { + uri: uri, + type: "video/mp4", + name: uniqueName, + }); + } return fetch(S3_PROXY_PREFIX + "uploadFile", { method: "POST",