Skip to content

Conversation

@AlphaSweater
Copy link
Owner

Pull Request Title

What’s this PR about? 🤔

Describe briefly what this Pull Request is doing. Explain the problem it solves or the feature it adds to the project.

  • Description:
  • What did you change? - (e.g., added a new feature, fixed a bug, updated something)

Why are we doing this? 💡

Explain why these changes are necessary.

  • Reason: - (e.g., fixing a bug, improving functionality, adding a new feature)

Type of Change 🛠️

What kind of change does this Pull Request introduce? Check the box that applies.

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 📚 Documentation update (non-code changes, such as readme or comments)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🧹 Code clean-up/refactoring (basic code cleaning and or variable renaming)

How did you test it? 🧪

Explain how you tested your changes.

  • What did you test?
    • Tested locally
    • Wrote automated tests
    • I ran the code and it didn't break
    • Other: ______

Screenshots (if helpful) 📸

If your changes include something visual, like UI changes, add screenshots here!

Checklist ✅

Make sure you’ve done these things before submitting.

  • Code is running without errors
  • Everything works as expected
  • No unnecessary files or code
  • Documentation is updated if necessary
  • Pull Request title is clear and makes sense
  • All checkboxes are checked off!

Anything else? 💬

Any extra notes, questions, or concerns for your partner or reviewers?

AlphaSweater and others added 15 commits June 9, 2025 20:59
This commit adds functionality to navigate from the `HomeMainFragment` to the `GeneralReportsFragment` and pass the selected wallet's ID.

- In `HomeMainFragment`, when a wallet is clicked, it now navigates to the `reportNavigationGraph` with a bundle containing `startDestination` set to `generalReportsFragment` and the `walletId`.
- In `GeneralViewModel`, it now checks the `savedStateHandle` for a `walletId`. If found, it waits for the wallets to load and then selects the corresponding wallet.
- Prioritize wallet ID from fragment arguments for initial selection.
- Fallback to persisted `viewModel.selectedWallet` if no argument is present.
- Ensure correct spinner position when a wallet is pre-selected.
- Update `report_navigation_graph.xml`:
    - Add a new action `action_generalReportsFragment_to_generalTransactionsFragment_withAnimation` to navigate from `GeneralReportsFragment` to `GeneralTransactionsFragment` with animations.
    - Add global actions `action_global_generalTransactionsFragment` and `action_global_generalReportsFragment` for easier navigation to these destinations.
- Modify `GeneralViewModel`:
    - Handle `startDestination` from `savedStateHandle` to determine the initial fragment to display.
    - If `walletId` is provided but the wallet is not found, select "All Wallets" by default.
- Adjust `GeneralTransactionsFragment`:
    - Prioritize `walletId` from arguments for initial wallet selection. If not found, fall back to the persisted wallet. If still not found, select "All Wallets".
- Update `GeneralReportsFragment`:
    - Check for `startDestination` in arguments; if it's `generalTransactionsFragment`, navigate there with the new animated action.
    - When selecting a wallet based on `walletId` from arguments, if the wallet is not found, default to selecting "All Wallets".
- Refine `HomeMainFragment`:
    - Include an empty `walletId` when navigating to the report navigation graph from "See All Categories" and "See All Transactions" to ensure "All Wallets" is selected by default in the report screens.
- Add `GetImageUseCase` to `AppModule` for fetching images from URLs.
- Implement `loadImageFromUrl` function in `TransactionAddViewModel` to:
    - Use `getImageUseCase` to fetch a bitmap from a given URL.
    - Convert the bitmap to a byte array.
    - Update the `_imageBytes` LiveData with the fetched image data.
    - Handle potential errors during image loading.
- In `TransactionAddFragment`:
    - Observe the `transaction` LiveData.
    - If a transaction has a `photoUrl`, call `loadImageFromUrl` in the ViewModel.
    - Update the visibility of `imagePreview` and `imagePreviewContainer` based on whether `imageBytes` is null or not.
- Modified `invoke` function in `BudgetCalculationUseCase` to accurately map budget categories.
  - Created a `categoryMap` for quick category lookup by ID.
  - Ensured budgets are mapped using only the categories present in the budget document.
- Updated `calculateTotalSummary` in `BudgetCalculationUseCase`:
  - Retrieves categories that are actually stored within the budget documents.
  - Filters these categories to include only "expense" types.
  - Filters transactions to include only those associated with the identified budget expense categories.
  - Added detailed logging for budget details, budget expense categories, all transactions, and filtered transactions to aid in debugging and understanding the calculation flow.
- Re-attach click listeners in `TransactionAddFragment`'s `enableFields()` method to ensure UI elements are interactive after being enabled.
- Implement navigation to individual transaction view from `GeneralTransactionsFragment` when a transaction is clicked.
- Handle `Flow was aborted` exceptions in `InsertDefaultsUseCase` by ignoring them, as they are expected in certain scenarios.
- In `TransactionAddViewModel`:
    - Upon successful transaction update, the ViewModel now updates its internal transaction state with the new values.
    - Switched to `VIEW` mode after a successful update.
    - Reset the validation state after a successful update.
- In `GeneralTransactionsFragment`:
    - Updated navigation to `ind_transaction_navigation_graph` to pass `screenMode` as `TransactionAddViewModel.ScreenMode.VIEW` and `transactionId`.
- Removed the navigation action `action_budgetMainFragment_to_budgetReportFragment` from `BudgetMainFragment` when a budget item is clicked.
- Set the visibility of the navigation arrow (`ic_arrow_open_24`) in `item_current_budget.xml` to `invisible`.
@AlphaSweater AlphaSweater self-assigned this Jun 9, 2025
@AlphaSweater AlphaSweater merged commit c716128 into development Jun 9, 2025
1 check passed
@AlphaSweater AlphaSweater deleted the feature/home/chad branch June 9, 2025 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants