Skip to content

Enable Backup & Restore setting in Settings screen #199

Description

@Noro18

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

  1. Uncomment the SettingsItem(Backup & Restore, ...) entry in supportItems.
  2. 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.
  3. 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).
  4. Show progress indicators during backup/restore operations.
  5. Add error handling for corrupted files, incompatible versions, and permission denials.
  6. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions