From 44b56a8245501e1a2d1454f568028de7eac07423 Mon Sep 17 00:00:00 2001 From: Thomas Irvine Date: Mon, 19 Feb 2024 15:29:58 -0600 Subject: [PATCH 1/3] delete button addition to note --- lib/screens/AddNoteScreen.tsx | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/lib/screens/AddNoteScreen.tsx b/lib/screens/AddNoteScreen.tsx index daee072..44d1972 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 { From 40e430cc60e7402ad16ef429cac60e814a6f8cea Mon Sep 17 00:00:00 2001 From: Thomas Irvine Date: Sun, 25 Feb 2024 19:07:08 -0600 Subject: [PATCH 2/3] yash....... --- lib/screens/AddNoteScreen.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/screens/AddNoteScreen.tsx b/lib/screens/AddNoteScreen.tsx index 44d1972..022faec 100644 --- a/lib/screens/AddNoteScreen.tsx +++ b/lib/screens/AddNoteScreen.tsx @@ -210,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(); From d7deb46b926977646aa05921af3b83e714a1ade7 Mon Sep 17 00:00:00 2001 From: Thomas Irvine Date: Tue, 27 Feb 2024 16:47:05 -0600 Subject: [PATCH 3/3] converted the format of ios from mov to mp4, for android mp4 remains the same --- lib/utils/S3_proxy.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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",