-
-
Notifications
You must be signed in to change notification settings - Fork 79
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
[Push] Upon notification, only enqueue sync for the respective service type #1175
[Push] Upon notification, only enqueue sync for the respective service type #1175
Conversation
I have still not tried it, the emulator is not working on my laptop for some reason (not enough RAM I think). I will test this ASAP. |
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
d5be215
to
f3d8911
Compare
Since #1177, the sync workers are per @ArnyminerZ Can you please adapt the PR accordingly? It should be much shorter now. |
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
app/src/main/kotlin/at/bitfire/davdroid/push/UnifiedPushReceiver.kt
Outdated
Show resolved
Hide resolved
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
app/src/main/kotlin/at/bitfire/davdroid/push/UnifiedPushReceiver.kt
Outdated
Show resolved
Hide resolved
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just two style comments:
- In this project curly braces are usually not used for one-line statements. I know that usage of then-blocks with/out curly braces is a matter of dispute, but I generally prefer the variant without extra curly braces because it makes it more hard to read for me personally. Of course there may be some special cases where curly braces are useful to make clear what's going on even if not strictly necessary (nested
if
s etc). - Instead of
add
, we also can use+=
. Makes it a bit shorter.
…-sync-for-the-respective-service-type
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with an event and works very well!
Purpose
When receiving a push notification, do not enqueue sync for all authorities, schedule only for the collection type's authority.
Short description
After receiving a push notification, after the collection and service are loaded, the collection type is checked. Those authorities are scheduled depending on the type:
TYPE_ADDRESSBOOK
at.bitfire.davdroid.addressbooks
(R.string.address_books_authority
)TYPE_CALENDAR
CalendarContract.AUTHORITY
TYPE_WEBCAL
CalendarContract.AUTHORITY
Also, if the collection supports
VJOURNAL
orVTODO
, a sync is enqueued for the current tasks provider, if any.If the type received is unknown or invalid, no sync is scheduled. We could change this behavior to sync everything, whatever you think suits best.
Checklist