-
Notifications
You must be signed in to change notification settings - Fork 120
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
Conversation
This file contains 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
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
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.
igorescodro
force-pushed
the
kmp/alarm
branch
from
October 27, 2023 20:33
cbdd649
to
1528a3f
Compare
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
force-pushed
the
kmp/alarm
branch
from
November 1, 2023 14:23
1528a3f
to
5b646de
Compare
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.
igorescodro
force-pushed
the
kmp/alarm
branch
from
November 8, 2023 15:12
212c143
to
0a43f5e
Compare
AGP updated to latest version!
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.
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.