Description
The Backup & Restore setting allows users to export/import their order data. Currently commented out and only shows a Toast - not actually functional.
File: app/src/main/java/com/example/ordermanagementcake/ui/settings/SettingsScreen.kt (lines 121-123)
Expected Behavior
Users can back up all app data (orders, clients, cakes) to a file and restore from a previously saved backup file.
Implementation
- Uncomment the SettingsItem(Backup & Restore, ...) entry in supportItems.
- Backup: Export all Room database tables (orders, clients, cakes, etc.) to a JSON or SQLite file.
- Use SAF (Storage Access Framework) to let the user pick a save location.
- Serialize data using Gson/Moshi or copy the Room database file directly.
- Restore: Import data from a backup file.
- Use SAF to let the user pick a file.
- Parse and insert data back into the Room database (handle conflicts, offer overwrite/skip options).
- Show progress indicators during backup/restore operations.
- Add error handling for corrupted files, incompatible versions, and permission denials.
- Consider adding a confirmation dialog before overwriting existing data on restore.
Additional Context
- BackupRestoreSheet exists at app/src/main/java/com/example/ordermanagementcake/ui/setting_options/BackupRestoreSheet.kt - review and update as needed.
- Room database entities are likely in the data/ package - check for Order, Client, Cake entities.
Description
The Backup & Restore setting allows users to export/import their order data. Currently commented out and only shows a Toast - not actually functional.
File: app/src/main/java/com/example/ordermanagementcake/ui/settings/SettingsScreen.kt (lines 121-123)
Expected Behavior
Users can back up all app data (orders, clients, cakes) to a file and restore from a previously saved backup file.
Implementation
Additional Context