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

Add reminder notifications #2659

Open
OmarNofal opened this issue Apr 9, 2024 · 7 comments
Open

Add reminder notifications #2659

OmarNofal opened this issue Apr 9, 2024 · 7 comments

Comments

@OmarNofal
Copy link

It would be great if the app had the ability to send reminders to do the daily werd. Also would be great to have the app remind you to read surah Al-Kahf every Friday.

There is already feature request open but it is too old (2011).

I can start working right away to implement this feature. Please tell me if it is ok.

@OmarNofal OmarNofal closed this as not planned Won't fix, can't repro, duplicate, stale Apr 18, 2024
@ahmedre ahmedre reopened this Apr 18, 2024
@ahmedre
Copy link
Contributor

ahmedre commented Apr 18, 2024

It's planned in sha' Allah, just that unfortunately, life gets in the way sometimes.

@OmarNofal
Copy link
Author

No, it is okay. I understand.

I can work on this feature, would that be okay with you?

@ahmedre
Copy link
Contributor

ahmedre commented Apr 18, 2024

sure, no problem. let's start with a reminders panel in settings, with some defaults that are there but disabled by default (reminder on Friday to read sura Kahf, reminder each day to read wird).

person using the app can edit the times of those and enable/disable them. Let's build it using Compose and make sure the code is in a new module. in phase 2 we can allow adding custom reminders, deleting reminders, etc.

@OmarNofal
Copy link
Author

OmarNofal commented Apr 18, 2024

Great.

So I have come up with the following steps:

  1. Create a module :feature:reminders:
  2. Create a worker inside the module which sends the notification depending on the reminder type (wird or surah Al-Kahf)
  3. Create an Activity containing the UI (compose) along with its presenter
  4. When the user toggles any of the 2 reminders, the presenter cancels the existing Worker of that reminder type and creates a new PeriodicWorker
  5. Add the preference key inside the PrefsFragment to open the new Activity

There are still some missing pieces that I am thinking about:

  1. How do I connect this to the exisitng shared prefs file that is created by the PreferencesFragment
  2. Should I create the Worker inside the new module or in the app module?

Also I am getting the following error when building, should I download something?
java.nio.file.AccessDeniedException: C:\Windows\sqlite-3.45.2.0-7930c5d7-092c-43ed-987f-7a80973d6eee-sqlitejdbc.dll.lck

(never mind, I fixed this error by running as administrator)

@ahmedre
Copy link
Contributor

ahmedre commented Apr 19, 2024

No need for a worker also - you can just request alarms permission when someone goes to enable the setting and set a precise alarm.

@OmarNofal
Copy link
Author

Don't you think requesting the alarms permission to send basic notifications would be too much?
I though using a worker would make it easier to handle stuff like persisting Workers when the device reboots and also observing the Worker states using flows which makes it easier to work with in Compose. We can also use setExpedited to make it behave like an exact alarm too

@ahmedre
Copy link
Contributor

ahmedre commented Apr 19, 2024

A worker would do the job but this is literally an alarm so using alarms makes sense to me for it.

We can avoid the permission request if we make the time approximate instead of exact, within a 15 minute window.

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

No branches or pull requests

2 participants