Added automatic push distributor selection#1774
Conversation
adfee4b to
09f359d
Compare
|
I will change to draft for now and we can reopen when we want to merge it - that is when we know in which version it will be added. |
d4c00a0 to
6e0cde7
Compare
rfc2822
left a comment
There was a problem hiding this comment.
I think it will finally be time 😄
As I understand it, the basic idea is to check/update the push distributor whenever the PushRegistrationWorker is run, instead of setting it explicitly from the UI.
This sounds good to me! However some notes.
(Also please fix conflicts)
app/src/main/kotlin/at/bitfire/davdroid/push/PushRegistrationManager.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/at/bitfire/davdroid/push/PushRegistrationManager.kt
Outdated
Show resolved
Hide resolved
# Conflicts: # app/src/ose/kotlin/at/bitfire/davdroid/di/OseFlavorModule.kt
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
|
As agreed on the meeting, FCM pre-selection for gplay variant is kept. So this should be ready for now. We can keep it improving later (actual distributor pinging to make sure it's available) Note: The gplay preference should be established on the private repo |
# Conflicts: # core/src/androidTest/kotlin/at/bitfire/davdroid/di/TestFlavorModule.kt # core/src/main/kotlin/at/bitfire/davdroid/push/PushDistributorManager.kt # core/src/main/kotlin/at/bitfire/davdroid/push/PushRegistrationManager.kt # core/src/main/kotlin/at/bitfire/davdroid/ui/AppSettingsModel.kt
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
…ble-push-by-default
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
- Simplify push disable setting from `EXPLICIT_PUSH_DISABLE` to `PUSH_DISABLE` - Improve push distributor list UI with better labels and icons - Remove unused imports and `AppTheme` wrapper from previews
- Refactor `PushRegistrationManager.update()` to explicitly handle distributor, subscriptions, and worker updates - Add thread-safety documentation for `update()` and `update(serviceId)` - Fix push distributor preference comparison in `AppSettingsModel`
There was a problem hiding this comment.
Pull request overview
Adds automatic UnifiedPush distributor selection with an opt-out flag, and updates the settings UI to surface a “Recommended” distributor.
Changes:
- Introduces
PushDistributorManagerto auto-select a distributor (preferred/first available) unless the user explicitly disabled push. - Adds
Settings.PUSH_DISABLEto prevent auto-selection after the user disables push. - Updates distributor selection UI to show a “Recommended” label and adjusts how distributor icons/names are derived.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| core/src/main/res/values/strings.xml | Adds “Recommended” label string for the distributor picker UI. |
| core/src/main/kotlin/at/bitfire/davdroid/ui/AppSettingsScreen.kt | Updates distributor picker list rendering to display “Recommended” and simplifies icon handling. |
| core/src/main/kotlin/at/bitfire/davdroid/ui/AppSettingsModel.kt | Switches to PushDistributorManager, computes preferred flag per distributor, and persists PUSH_DISABLE when user disables push. |
| core/src/main/kotlin/at/bitfire/davdroid/settings/Settings.kt | Adds PUSH_DISABLE setting key with documentation. |
| core/src/main/kotlin/at/bitfire/davdroid/push/PushRegistrationManager.kt | Delegates distributor selection to PushDistributorManager during update flows and updates docs. |
| core/src/main/kotlin/at/bitfire/davdroid/push/PushDistributorManager.kt | New: centralizes distributor selection and opt-out behavior via settings. |
| core/src/main/kotlin/at/bitfire/davdroid/push/PushDistributorDefaults.kt | New: interface for build-variant preferred distributor selection. |
| core/src/main/kotlin/at/bitfire/davdroid/di/PushDistributorDefaultsModule.kt | New: Hilt optional binding for PushDistributorDefaults. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
core/src/main/kotlin/at/bitfire/davdroid/push/PushDistributorManager.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/at/bitfire/davdroid/push/PushRegistrationManager.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/at/bitfire/davdroid/di/PushDistributorDefaultsModule.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/at/bitfire/davdroid/push/PushDistributorDefaults.kt
Show resolved
Hide resolved
- Move push disable setting logic to `PushDistributorManager.setPushDistributor()` - Update comments and docstrings for clarity - Rename `pushDistributorPreferences` to `pushDistributorDefaults` in DI module
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
core/src/main/kotlin/at/bitfire/davdroid/ui/AppSettingsModel.kt
Outdated
Show resolved
Hide resolved
- Cache icon bitmap in `AppSettingsScreen` to avoid recomputation - Add `PushRegistrationManager` to `AppSettingsModel` and update registrations on distributor change - Improve `PushDistributorManager.getCurrentDistributor()` docs to clarify behavior when distributor is uninstalled
- Rename `update()` to `updateDistributor()` for consistency - Improve comments and docstrings in `PushRegistrationManager` - Add documentation for UnifiedPush callback behavior
- Add `CollectionDao.invalidatePushSubscriptions()` to clear push subscription expires - Update `PushDistributorManager` to invalidate subscriptions when distributor changes - Use application scope in `AppSettingsModel` to prevent interruption during push distributor updates
0bca3ed to
8d7d49f
Compare
There was a problem hiding this comment.
So this will do nothing in davx5-ose, because there is no hradcoded/injected preference?
Also, sounds like this implementation will be superseeded by: #2091 (comment) so maybe we should do that instead of merging something unfinished?
I am not quite sure what the requirements for accepting an implementation are. The issue #1737 does not really look agreed and settled yet.
Also, since we need to work on the flavors across repos, maybe some sub-issues would be good?
|
I'd discuss this further after seeing #2091 and the official guide. |
Purpose
See #1737, but basically, Push is basically stable enough to at least select a distributor by default.
In any case, if one doesn't trust it, the server admin should simply not install support for push on the server, and the distributor will be unused.
Short description
Added automatic push distributor selection
PushDistributorDefaults. It contains a preferred distributor.DistributorPreferencesimplementation.Added a new settings entry which will be set to true whenever the user manually disables push (because it will be enabled by default). If this setting is true, no push distributor will be automatically selected.
On the push distributor selection dialog, the preferred distributor, if any, is marked with "Recommended"
Screenshot
We still have to add the individual implementations for each flavor on bitfireAt/davx5.
Checklist