-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/home/chad #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Feature/home/chad #164
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
# Conflicts: # app/src/main/assets/version.txt
- 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`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why are we doing this? 💡
Explain why these changes are necessary.
Type of Change 🛠️
What kind of change does this Pull Request introduce? Check the box that applies.
How did you test it? 🧪
Explain how you tested your changes.
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.
Anything else? 💬
Any extra notes, questions, or concerns for your partner or reviewers?