8000 🛤️ Migrate to the Compose Multiplatform Navigation by igorescodro · Pull Request #779 · igorescodro/alkaa · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

🛤️ Migrate to the Compose Multiplatform Navigation #779

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 24 commits into from
Feb 8, 2025

Conversation

igorescodro
Copy link
Owner
@igorescodro igorescodro commented Oct 9, 2024

Migrating to the new Compose Multiplatform Navigation library and implementing a new navigation system based on events.

Fix #661

@igorescodro igorescodro force-pushed the update/navigation branch 3 times, most recently from f2fa0d4 to adafe7d Compare January 18, 2025 22:00
@igorescodro igorescodro force-pushed the update/navigation branch 6 times, most recently from 59f1d60 to c7453d8 Compare January 24, 2025 01:42
@igorescodro igorescodro force-pushed the update/navigation branch 7 times, most recently from a13211a to 229880c Compare February 5, 2025 23:30
A new Compose Navigation dependency was added once Voyager doesn't seem
to be maintained anymore.
New destinations and events were created to represent all the app's
screens and how to interact between them.
Initial structure connecting the AndroidX Navigation with our custom
implementation created.
All the existing destinations were migrated from Voyager to the new
navigation system. Future commits will handle the deep links and port
more destinations (such as confirmation dialogs) to this system.
Bye, bye, my friend!
Since Compose Multiplatform does not fully support deep links, the
initial implementation was created, and it will be updated when the
support is ready. For now, every deep link will simply open Alkaa's main
screen.
A new module and a  Wrapper to provide the `PermissionsController`
instance. This class holds a single instance of `PermissionsController`
since Moko does not allow `BindEffect` to be called outside an Activity
context (Alkaa uses in a `dialog` destination).
The behavior for keep the tab state after rotating the screen was
re-introduced. Small changes were needed to ensure the data can be
properly stored in the `Bundle`.
After the recent updates, the `rememberSaveable` for the `LocalDateTime`
was not working properly. For now, the value will be stored as a `Long`
and converted to DateTime as needed.
Adding ModalBottomSheet implementations to show the content in a
BottomSheet for the Category Edit/Add and Task Add.
Additional functions called to improve the navigation. The improvements
are:
- Avoid navigating to the same place if it's already on top
- Save and restore state for the TopLevel destinations
New module created to avoid circular dependencies. Ideally, the
interfaces from `navigation` should be moved here. For now, it is what
it is. 😀
A new structure was created to emit the changes in the Top Level
destinations and update the Bottom Navigation (or NavRail) and the Top
App Bar. The solution is based on the official Navigation Compose
documents and Now in Android project.
The build task is failing even though the app is working fine. Time to
fix.
The `HomeScreenTest` was updated to add test case for tab change after
back button:
- Added a test that checks if when the tab is changed and back button is
pressed, the title updates correctly.
- Modified the existing title verification to ensure the correct element
is asserted for being selected.
After further investigation, I found out that the iOS tests doesn't have
`LocalLifecycleOwner` by design, apparently since the "actual"
implementation simply throws an exception. The solution was to create a
fake `LifecycleOwner` to be used on the tests.

In addition, a test in `CategoryFlowTest` was update to not be flaky on
iOS.
Previously, the code was defaulting to Task if the destination was not
found as a TopLevel. This creates problems when the Top App Bar is
visible and a non top-level is the current destination. In these cases,
it would show the "About" screen with the "Tasks" title.

To fix this the find will return null if it's not a TopLevel and
`filterNotNull` was added to ensure there will be no emission on this
case, leaving the current title active.
The following changes were proposed in this commit:

- Add a marker interface to check if the TopAppBar should be visible.
- Implement the state control for the TopAppBar visibility.
- Add a list of all destinations that the TopAppBar should be visible.
- Update the home screen to animate the visibility of the TopAppBar.
- Add transition animation for TaskDetail screen.
More files were moved to make most of the clients depend only on in the
API module instead.
The Navigation modules (both the implementation and the API) were
moved from the 'libraries' folder to the 'features' folder.
There was a bug when switching TopLevel destinations with saved
backstack. Since the `currentTopDestination` was only returning the
current entry, it was not possible to get the TopLevel where this
destination was started, making the Bottom Bar icon not updating
correctly.

The top level destination is now obtained from the backstack, instead of
only from the current entry. This allows the app to properly detect the
correct top level screen when navigating back.
To be more aligned with other apps, a new behavior was introduced where
the stack is clear when the current BottomBar item (TopLevel) is
clicked. This required not only a change in how to save and restore but
additional work to ensure the navigation won't blink when this happens.
Improve the animations for the transition between destinations and the
TopBar.
@igorescodro igorescodro merged commit a51bd37 into main Feb 8, 2025
5 checks passed
@igorescodro igorescodro deleted the update/navigation branch February 8, 2025 18:07
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.

App Theme is not working
1 participant
0