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

WIP: Customizable alarms per subscription #78

Merged
merged 34 commits into from
Dec 14, 2022

Conversation

ArnyminerZ
Copy link
Member

@ArnyminerZ ArnyminerZ commented Dec 2, 2022

Closes #1

Bugs:

  • The alerts removal for when the "ignore embed alarms" option is checked only works the first time you add the calendar. This is caused by ProcessEventsTask:
    Log.i(Constants.TAG, "Calendar has not been modified since last sync")

    Since the calendar is technically not modified, only locally, onNotModified is called. There should be logic to handle changes to the ignore embed alarms switch, which add back again all the alarms.

TODO:

  • Custom reminders only get stored for the synchronization, they don't get added to the events.

Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
@ArnyminerZ ArnyminerZ added the enhancement New feature or request label Dec 2, 2022
@ArnyminerZ ArnyminerZ self-assigned this Dec 2, 2022
@ArnyminerZ ArnyminerZ linked an issue Dec 2, 2022 that may be closed by this pull request
8 tasks
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
@ArnyminerZ ArnyminerZ marked this pull request as draft December 2, 2022 11:03
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
@ArnyminerZ ArnyminerZ marked this pull request as ready for review December 5, 2022 11:07
@rfc2822 rfc2822 force-pushed the 1-customizable-alarms-per-subscription branch from 28ead2c to b45f78c Compare December 6, 2022 19:38
Copy link
Member

@rfc2822 rfc2822 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder whether we should use queryEvents, which puts all events as data objects into memory. There may be 100.000 events, then we'd have 100.000 objects in the list.


I suggest to move the "default alarm" processing from LocalCalendar (which I think should just store the setting and handle putting Events into the Android calendar without further logic) to ProcessEventsTask. We could use an alarm algorithm like this in ProcessEventsTask.processEvents():

  • Call a new method updateAlarms(event) before LocalEvent(calendar, event).add() and before localEvent.update(event).
  • updateAlarms(event):
    1. If neither ignoreEmbeddedAlerts nor defaultAlarmMinutes is set, do nothing.
    2. Otherwise:
    • If ignoreEmbeddedAlerts is set, remove existing alarms from the event.
    • If defaultAlarmMinutes is set, add an alarm to the event.

With this algorithm we wouldn't have to look for already existing alarms and rewrite them. Instead we would update alarms only when downloaded events are processed; and changing the settings would force downloading the events again.

What do you think?

Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
…iption' into 1-customizable-alarms-per-subscription
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
@ArnyminerZ
Copy link
Member Author

@rfc2822 Take a look at it, haven't tested it, but should work

ArnyminerZ and others added 2 commits December 8, 2022 10:57
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Copy link
Member

@rfc2822 rfc2822 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I have tested it and it seems to work fine. :) Definitely something users (including myself) can use.

Can we get rid of the firstCheck thing somehow? Looks like there should be a more clean solution for that.

ArnyminerZ and others added 3 commits December 11, 2022 20:12
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Copy link
Member

@rfc2822 rfc2822 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks, lets try it out :)

@rfc2822 rfc2822 merged commit 19934b1 into dev Dec 14, 2022
@rfc2822 rfc2822 deleted the 1-customizable-alarms-per-subscription branch December 14, 2022 14:58
rfc2822 pushed a commit that referenced this pull request Feb 25, 2024
* Note

Signed-off-by: Arnau Mora <arnyminerz@proton.me>

* Migrate to Kotlin DSL (#19)

Signed-off-by: Arnau Mora <arnyminerz@proton.me>

* Upgrade all dependencies (#22)

* Upgrade to Android 14 (#21)

Signed-off-by: Arnau Mora <arnyminerz@proton.me>

* Rewrite CredentialsFragment to compose (#26)

* Update import (#27)

* Update README.md

* Fix NPE on adding subscription (#33)

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Co-authored-by: Arnau Mora <arnyminerz@proton.me>

* Make CredentialsFragment into a composable (#35)

* Using regular ubuntu image

Signed-off-by: Arnau Mora <arnyminerz@proton.me>

* Migrate SubscriptionSettingsFragment to compose (#29)

* Migrate `AddCalendarValidationFragment` to Jetpack Compose (#31)

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Co-authored-by: Sunik Kupfer <kupfer@bitfire.at>

* Migrate `AddCalendarEnterUrlFragment` to Jetpack Compose (#38)

Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Co-authored-by: Sunik Kupfer <kupfer@bitfire.at>

* Migrate AddCalendarDetailsFragment to compose (#40)

* Upgrade AGP to 8.2.1 (#42)

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>

* Upgrade Kotlin, KSP, Compose and others (#43)

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Co-authored-by: Sunik Kupfer <kupfer@bitfire.at>

* Migrate `AddCalendarActivity` to Jetpack Compose (#45)

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Co-authored-by: Sunik Kupfer <kupfer@bitfire.at>

* Added missing line break (#52)

* Remove unused view and layout (#54)

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>

* Added Dependabot (#51)

* Bump github/codeql-action from 2 to 3 (#62)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump actions/checkout from 3 to 4 (#61)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump actions/setup-java from 3 to 4 (#58)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump joda-time:joda-time from 2.12.5 to 2.12.6 (#56)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump androidx.work:work-testing from 2.8.1 to 2.9.0 (#60)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Using BOM for OkHttp and downgrade to stable (#64)

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>

* Migrate EditCalendarActivity to jetpack compose (#46)

* Bump actions/cache from 3 to 4 (#65)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump com.android.tools.build:gradle from 8.2.1 to 8.2.2 (#66)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump androidx.compose.runtime:runtime-livedata from 1.5.4 to 1.6.0 (#78)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump androidx.compose:compose-bom from 2023.10.01 to 2024.01.00 (#79)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump com.google.accompanist:accompanist-themeadapter-material from 0.32.0 to 0.34.0 (#80)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Arnau Mora <arnyminerz@proton.me>

* Bump gradle/gradle-build-action from 2 to 3 (#82)

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Arnau Mora <arnyminerz@proton.me>

* Fix: Can't add subscription after going back once (#83)

* Update ical4android and cert4android (#73)

Signed-off-by: Arnau Mora <arnyminerz@proton.me>

* Cleanup of Dialogs (#67)

Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>

* Bump actions/upload-artifact from 2 to 4 (#63)

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Arnau Mora <arnyminerz@proton.me>

* Migrate `DonateDialogFragment` to Jetpack Compose (#75)

Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Co-authored-by: Sunik Kupfer <kupfer@bitfire.at>

* Final layout cleanup (#68)

Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Co-authored-by: Sunik Kupfer <kupfer@bitfire.at>

* Ensured toast error is never null (#91)

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>

* Crash when going back into `CalendarListActivity` (standard flavour) (#90)

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>

* Migrate ColorPickerActivity to Jetpack Compose (closes #53, #87) (#94)

* Bump androidx.compose:compose-bom from 2024.01.00 to 2024.02.00 (#96)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump androidx.compose.runtime:runtime-livedata from 1.6.0 to 1.6.1 (#95)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump joda-time:joda-time from 2.12.6 to 2.12.7 (#93)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Edit Subscription: requires-auth toggle and credential fields trigger save-dismiss mechanism (#92)

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Co-authored-by: Arnau Mora Gras <arnyminerz@proton.me>

* Removed package definition from manifest (#101)

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>

* Bump com.maxkeppeler.sheets-compose-dialogs:core from 1.2.1 to 1.3.0 (#103)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Use compose theming engine, (drop compatibility MdcTheming etc) (#48)

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Co-authored-by: Sunik Kupfer <kupfer@bitfire.at>

* Migrated to Gradle Version Catalog (#99)

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>

* Check if we can reuse more composables and improve project structure (#106)

* Bump aboutLibs from 10.7.0 to 10.10.0 (#108)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump org.jetbrains.kotlinx:kotlinx-coroutines-android from 1.7.3 to 1.8.0 (#110)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Migrate to Material 3 (#109)

* Bump compose-ui from 1.6.1 to 1.6.2 (#111)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump androidx.compose.material:material-icons-extended from 1.6.1 to 1.6.2 (#112)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump androidx.compose.runtime:runtime-livedata from 1.6.1 to 1.6.2 (#113)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Arnau Mora <arnyminerz@proton.me>

* Quickfix for pull to refresh (#114)

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Co-authored-by: Sunik Kupfer <kupfer@bitfire.at>

* Fix warnings (#115)

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Co-authored-by: Sunik Kupfer <kupfer@bitfire.at>

---------

Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Sunik Kupfer <kupfer@bitfire.at>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Customizable alarms per subscription
2 participants