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

⏰ Implement the alarm functionality back #615

Merged
merged 21 commits into from Nov 8, 2023

Conversation

igorescodro
Copy link
Owner

@igorescodro igorescodro commented Oct 27, 2023

Bring the task alarm functionality back. It consists of the user choosing a date and time to be reminded about the task with a notification. Platform-specific and KMP libraries would be used to achieve this.

One more module converted to KMP, allowing to be reused with the
`:feature:task` module. Several key parts are platform-dependent will
are now on its own source. Future commits will connect and test
everything together.
@igorescodro igorescodro changed the title Integrate Moko Permissions to handle each platform 👮‍♀️ Integrate Moko Permissions to handle each platform Oct 27, 2023
A new Moko library was added to provide support for runtime permissions
on both platforms. The setup was straightforward and since we are here,
a small refactor was made to simplify the flow.
Base code introduced to enable notification permissions on iOS. Future
commits will schedule the notifications when appropriate.
In the database we are storing the time in milliseconds, however, the
encoder was wrongly set as "fromEpochSeconds". The function was updated
to use the appropriate API.
The AndroidManifest.xml for the alarm module was in the wrong place.
Because of that, the Broadcast Receiver was not working properly.
A new composable was created combining the DatePicker and TimePicker.
This composable open both in sequence and returns the value set on them.
Since the Kotlin DateTime does not support formatters yet, a
platform-specific code was implemented for Android and iOS.
Replace the function ones with the regular comment to avoid crashes
while testing the DateTimePicker flow.
@igorescodro igorescodro changed the title 👮‍♀️ Integrate Moko Permissions to handle each platform ⏰ Implement the alarm functionality back Nov 1, 2023
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!
@igorescodro igorescodro merged commit 71ac5f5 into alkaa-compose-multiplatform Nov 8, 2023
3 of 5 checks passed
@igorescodro igorescodro deleted the kmp/alarm branch November 8, 2023 15:50
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