Skip to content
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

📲 Convert Alkaa UI to Compose Multiplatform #597

Merged
merged 97 commits into from Jan 18, 2024

Conversation

igorescodro
Copy link
Owner

Now it's time to go to the latest layers and convert the UI from Jetpack Compose to Compose Multiplatform. Won't lie, it was easier than I thought even if the additional KMP libraries needed to be added.

Add new Moko dependencies to handle resource management on multiple
platforms
A new feature module was created to hold the "Home" UI code. In the
previous structure, this code was inside Android's `:app` but in order
to make it multiplatform, we need a dedicated module. We could put the
logic on `shared`, but my goal to that module is just to be a "umbrella"
with small setup.
In the previous structure, each module would have its own string
directory and localizations. However, the way that Moko is set up, this
is more difficult and will require constant changes in the iOS project
to compile for every single module. The alternative implemented here is
creating a single "Resources" module that holds all the string and every
UI module depends on it.
Simple update in the Shared module to expose the resources from the
"Resources" module.
New script added to copy all the resources from the KMP module (exposed
by "shared") and made them available for iOS.
Adding classpath dependencies and making sure all new modules are
registered.
In Kotlin 1.9.0, the following error occurs when trying to build the
project:

> Expected object 'MR' has no actual declaration in module
> <shared_debug> for JVM

Adding a explicit dependency fix the issue for now:
icerockdev/moko-resources#531
Basic setup for localization and the Brazilian Portuguese strings added
The app is working fine on both iOS and Android, but it fails for
implicit Gradle dependencies when building it. Adding even more explicit
setup then.

icerockdev/moko-resources#421
API module converted to KMP
API module converted to KMP
This is a kinda temporary change. In the end, the goal is having this
lean structure, but we are far from that. For now, having this setup
makes the testing easier to both platforms.
The Use Cases have a few Interactors that are only available in the
Android platform. We will also get there. For now, they are disabled.
Converting the feature module to KMP and moving all the possible parts
to be multiplatform. The things that can't be ported now are disabled
for future changes.
Converting the feature module to KMP and moving all the possible parts
to be multiplatform. The things that can't be ported now are disabled
for future changes.
Converting the feature module to KMP and moving all the possible parts
to be multiplatform. The things that can't be ported now are disabled
for future changes.
Now that Task and Category are ported to KMP, they can be used inside
the Home Composable
Koin helper updated to add the new ported DI graphs.
Since all the strings will be in a single module for now, all the
strings (including localization) were moved
The test module was broken in two modules, one for general unit testing,
and the other for Android-related testing. This change is required to
make sure we have the right separation and the KMP modules depends only
on the unit test one.
We are killing `libraries:core` step by step because it's a big utils
class (and heavily Android-dependant). At this time, we are moving the
color extension to `libraries:designsystem`.
Adding the appropriate escaping to make sure that it works properly with
Android Instrumented tests
Fix the broken unit tests after all the changes for the KMP modules.
Some parts will remain commented/disabled until the full migration is
done.
Fix the broken instrumented tests after all the changes for the KMP
modules. Some parts will remain commented/disabled until the full
migration is done.
Small changes based on self-review.
Fix ~annoying~ Lint issues 😇
The existing navigation module was revamped to be a KMP module and
starting using Voyager as the navigation framework. For now, only the
Task and Category flows were added. Future changes will add the
remaining ones and also we will investigate if it's worth it to move the
tab navigation to this library too.

Since the module was an Android library and still referenced, everything
was commented at this moment.
In order to make sure that iOS will keeping running, all the Interactors
that are not implemented will be disabled. In the future, a more
scalable solution will be implemented to handle both the cases where
iOS will have a dedicated implementation and also the ones that should
be ignored.
Replace the function ones with the regular comment to avoid crashes
while testing the DateTimePicker flow.
The following improvements were implemented:
- Use a default AlertDialog for the TimePicker to fit it better
- Replace hard-coded strings
- Update the picker states to show the time close to the current one
The intent was updated to use the new AndroidDestinations to open the
details screen with the reconstructed back stack.
The relative date formatter implementation was reintroduced to show
contextual time for the users. On Android, the implementation was
updated to be more sensitive.
Apparently, notifications won't show by default when the app is on
foreground on iOS. To do that, we need to have an AppDelegate class
to force it. A little of Swift code was needed for that.
The basic code to schedule and cancel a notification was implemented. On
iOS, the notification system already has a built-in scheduler, so only
one function is needed to do both. Next commits will improve the
notification details and refactor the notification interface that is
not needed for iOS.
In the iOS implementation, the notification can be scheduled in the same
API that builds it, extra information needs to be passed through the
scheduler and interactor.
For now, only the `dismiss()` function was implemented since iOS deals
with notifications in another way.
Now that the Alarm and Notification-related interactors are implemented
in all platforms, the injection can be non-nullable again. For the
Widget/Glance, future commits will hand that (or not).
A lot of oopsies fixed.
Since we are using more sensitive relative time strings, they will be
outdated if the screen is not updated (e.g. "4 minutes ago"). This new
effect refreshes the jey every minute and recomposes the data fetch. As
this is an UI-related change, the Composable is the one responsible, not
the data flow itself.
Put unused thing on fire!
Since iOS doesn't need this verification (and I just found out that
Android does not crash too), the verification was removed from the
interface and done by the notification manager itself in Android.
AGP updated to latest version!
⏰ Implement the alarm functionality back
Now that we are using Compose Multiplatform, a few Android-only
dependencies were removed.
New multiplatform module created to handle the possible app states. For
now, the only state will be related to the window size.
Bringing back WindowSizeClass to Alkaa KMP thanks to @chrisbanes's
library.
It's been a while since I create a module from scratch... Fixed the
naming confusion.
🪟 Re-enable WindowSizeClass to support multiple screen sizes
Core was a very nice module. At first, it held all the fun extension
functions for the Android application. However, core was greed. It
wanted to hold a lot of common logic, not allowing cleaner and more
focused modules to have their place in the project. Each day, it was
harder and harder to get rid of core. One day, Alkaa decided to go to
the realm of multiplatform, and of course, core didn't like the idea.
Core tried very hard to convince everyone that this was a bad idea, that
this was just a fling and, incredibly, even suggested... Flutter! But
it was too late, and all the other sibling modules were excited to be
converted to KMP and have different source sets. Core was losing its
power since it was impossible to migrate it, and it lost function after
function until it became useless... Today, it's the day we say
"goodbye" to core. And I hope that you find peace in the realm of the
deleted code.
We are getting closer! This change updates the version code to match the
new major version.
Are you happy now, CI?
# Conflicts:
#	gradle/libs.versions.toml
Small update to better support the recent changes (and Xcode was not
happy with the previous one_)
Small update to better support the recent changes (and Xcode was not
happy with the previous one_)
@igorescodro igorescodro merged commit 6e4e06d into main Jan 18, 2024
4 of 6 checks passed
@igorescodro igorescodro deleted the alkaa-compose-multiplatform branch January 18, 2024 15:16
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.

None yet

1 participant