From b1a411350c74a1113c2a59b99c1f5a6318f24e1c Mon Sep 17 00:00:00 2001 From: FireFistisDead Date: Mon, 25 Aug 2025 00:16:38 +0530 Subject: [PATCH 1/5] resolved the export csv for android 13+ --- .gitignore | 4 +++- src/utils/exportSchedule.ts | 27 +++++++++++++-------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index eff32d4..fdaf87a 100644 --- a/.gitignore +++ b/.gitignore @@ -101,4 +101,6 @@ android/app/release-key.jks !.yarn/releases !.yarn/sdks !.yarn/versions -yarn.lock \ No newline at end of file +yarn.lock + +.env \ No newline at end of file diff --git a/src/utils/exportSchedule.ts b/src/utils/exportSchedule.ts index 00b83b3..ecbf46a 100644 --- a/src/utils/exportSchedule.ts +++ b/src/utils/exportSchedule.ts @@ -40,12 +40,7 @@ export class ExportScheduleUtility { console.log('Starting export with selectedRegisters:', this.selectedRegisters); console.log('Available registers:', Object.keys(this.registers)); - // Check storage permission first - const hasPermission = await this.checkStoragePermission(); - if (!hasPermission) { - Alert.alert('Permission Denied', 'Storage permission is required to save CSV files.'); - return null; - } + // No permission needed for app-specific external storage on Android 13+ if (this.selectedRegisters.length === 0) { Alert.alert('Export Failed', 'No registers selected for export.'); @@ -86,16 +81,20 @@ export class ExportScheduleUtility { return null; } - const path = `${RNFS.DownloadDirectoryPath}/${fileName}`; - console.log('Export path:', path); - - // Ensure the directory exists - const dirPath = RNFS.DownloadDirectoryPath; - const dirExists = await RNFS.exists(dirPath); + // WhatsApp-like: Save in Android/media/com.schedulex/ScheduleX + console.log('RNFS.ExternalStorageDirectoryPath:', RNFS.ExternalStorageDirectoryPath); + const scheduleXDir = `${RNFS.ExternalStorageDirectoryPath}/Android/media/com.schedulex/ScheduleX`; + const dirExists = await RNFS.exists(scheduleXDir); if (!dirExists) { - await RNFS.mkdir(dirPath); + try { + await RNFS.mkdir(scheduleXDir); + console.log('Created folder:', scheduleXDir); + } catch (e) { + console.error('Error creating folder:', e); + } } - + const path = `${scheduleXDir}/${fileName}`; + console.log('Export path:', path); const exists = await RNFS.exists(path); if (checkOnly && exists) { From 2b6a51b364baa541f3883866c97e75359c005474 Mon Sep 17 00:00:00 2001 From: FireFistisDead Date: Mon, 25 Aug 2025 09:27:25 +0530 Subject: [PATCH 2/5] Made the downloads changes --- src/utils/exportSchedule.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/exportSchedule.ts b/src/utils/exportSchedule.ts index ecbf46a..57976ed 100644 --- a/src/utils/exportSchedule.ts +++ b/src/utils/exportSchedule.ts @@ -124,7 +124,7 @@ export class ExportScheduleUtility { if (result && result.exists) { Alert.alert( 'File Exists', - `File already exists in Downloads as ${result.fileName}. Download again?`, + `File already exists as ${result.fileName}. Download again?`, [ { text: 'Cancel', style: 'cancel' }, { @@ -132,7 +132,7 @@ export class ExportScheduleUtility { onPress: async () => { await this.exportSelectedRegistersCSV(false, true, customFileName); // force overwrite ToastAndroid.show( - `Saved to Downloads: ${result.fileName}`, + `Saved to Storage: ${result.fileName}`, ToastAndroid.SHORT ); } From 37a0ee63cd25f4bbf5ed7004dd73bdb861b3428f Mon Sep 17 00:00:00 2001 From: FireFistisDead Date: Mon, 25 Aug 2025 09:30:56 +0530 Subject: [PATCH 3/5] made the setting screen changes --- src/screens/user-settings/SettingsScreen.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/screens/user-settings/SettingsScreen.tsx b/src/screens/user-settings/SettingsScreen.tsx index a2779e4..52ec35f 100644 --- a/src/screens/user-settings/SettingsScreen.tsx +++ b/src/screens/user-settings/SettingsScreen.tsx @@ -357,7 +357,7 @@ const SettingsScreen: React.FC = () => { /> Save Schedule to Device - Save your schedule as CSV to Downloads + Save your schedule as CSV From a6341eb60d251da5ac23538d341e3fea298b6c7d Mon Sep 17 00:00:00 2001 From: FireFistisDead Date: Mon, 25 Aug 2025 10:58:33 +0530 Subject: [PATCH 4/5] made the path diplay changes --- src/utils/exportSchedule.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/exportSchedule.ts b/src/utils/exportSchedule.ts index 57976ed..d006860 100644 --- a/src/utils/exportSchedule.ts +++ b/src/utils/exportSchedule.ts @@ -132,16 +132,16 @@ export class ExportScheduleUtility { onPress: async () => { await this.exportSelectedRegistersCSV(false, true, customFileName); // force overwrite ToastAndroid.show( - `Saved to Storage: ${result.fileName}`, - ToastAndroid.SHORT - ); + `Saved: ${result.fileName}\nPath: ${result.path}`, + ToastAndroid.LONG + ); } } ] ); } else if (result) { ToastAndroid.show( - `Saved to Downloads: ${result.fileName}`, + `Saved to Storage: ${result.fileName}`, ToastAndroid.SHORT ); } From 36e454ae33df84732e8385831efcb5b24d1b4861 Mon Sep 17 00:00:00 2001 From: FireFistisDead Date: Mon, 25 Aug 2025 10:59:32 +0530 Subject: [PATCH 5/5] made the path diplay change --- src/utils/exportSchedule.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/exportSchedule.ts b/src/utils/exportSchedule.ts index d006860..41824ce 100644 --- a/src/utils/exportSchedule.ts +++ b/src/utils/exportSchedule.ts @@ -141,7 +141,7 @@ export class ExportScheduleUtility { ); } else if (result) { ToastAndroid.show( - `Saved to Storage: ${result.fileName}`, + `Saved: ${result.fileName}\nPath: ${result.path}`, ToastAndroid.SHORT ); }