Skip to content

Conversation

@DennisBauer
Copy link
Owner

When creating a new expense or editing an existing one clicking back doesn't require any additional confirmation by the user. This way changes might be lost even though the user wanted to save them.

fixes: #746

@DennisBauer DennisBauer requested a review from Copilot October 17, 2025 19:52
@DennisBauer DennisBauer added the feature New feature or request label Oct 17, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a confirmation dialog when users attempt to navigate back from the edit expense screen with unsaved changes, preventing accidental data loss. The implementation tracks changes to all expense fields and compares them against the original database values (for existing expenses) or checks for any entered data (for new expenses).

Key changes:

  • Added unsaved changes detection logic that compares current form state with database values
  • Implemented a BackHandler to intercept back navigation and show a confirmation dialog when changes exist
  • Added comprehensive test coverage for various change scenarios (name, price, recurrence, notifications, reminders)

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
gradle/libs.versions.toml Added dependency for compose-ui-backhandler library
app/build.gradle.kts Added compose-ui-backhandler implementation to dependencies
EditRecurringExpenseViewModel.kt Implemented unsaved changes detection, back press handling, and dialog state management
EditRecurringExpenseScreen.kt Integrated BackHandler and added unsaved changes confirmation dialog UI
strings.xml Added English strings for unsaved changes dialog
strings-de.xml Added German translations for unsaved changes dialog
EditRecurringExpenseViewModelTest.kt Added 13 test cases covering unsaved changes detection scenarios

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

When creating a new expense or editing an existing one clicking back
doesn't require any additional confirmation by the user. This way
changes might be lost even though the user wanted to save them.

fixes: #746
@DennisBauer DennisBauer merged commit 10fb225 into main Oct 18, 2025
3 checks passed
@DennisBauer DennisBauer deleted the feat_confirm_back branch October 18, 2025 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Confirm back action when changes were done to an expense without saving

2 participants