-
-
Notifications
You must be signed in to change notification settings - Fork 84
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 Push Subscription Management #800
Conversation
913551d
to
0099ca6
Compare
So now that we have a proof 😃 we should do this properly. The first and most important issue I see now is that we when syncable collections change, the
What do you think of it? Or do you think there's an easier / better solution? If we use this solution, I suggest to create a separate issue/PR for the observer and then only do point 3 in this PR. |
0099ca6
to
5355a37
Compare
Yes, makes sense in any case.
I think the observer pattern is the cleanest solution in terms of separation of concerns. But instead of implementing the whole observer pattern ourselves (as in SettingsManager), would it not be easier to collect a flow of sync- and push-enabled collections? A changing value of
Regardless of whether we observe/listen to the collection change in the traditional way or (mis-?) use the Flow API, the question for me remains where to do that? It works just fine to do it in I have updated the PR with said changes. Collecting the flow could of course go into it's own class which then gets called from |
That was my first idea, too. However I'm not convinced that it's very proper
However I'm still open for arguments why it's OK to use the flow instead ;)
My idea was a list of observers in |
We are not bypassing the repository. The repository we call to get the flow, gets it from the DAO.
Yes, I was wondering wether we could collect from somewhere else, but I guess not.
Not sure that would be too big of an issue, but it's nicer of course if we don't have to do that.
Right, I tried that now. It works well and is not too much code either - as long as you don't remove the observers. Do we have to? They would be garbage collected with
Let me correct that. I don't think anymore that using the repository for all collection access makes sense. It would mean to duplicate all the methods in collectionDao inside the collection repo, which seems like an anti pattern. Is that really what you intended? If we really need to ensure all collection changes are being noticed, I think we should observe the source directly via flows. We could do that in the repository and then notify the subrlisteners of the repository. |
As discussed in the call I will:
|
This PR/issue depends on: |
…in UI Signed-off-by: Arnau Mora Gras <[email protected]>
Signed-off-by: Arnau Mora Gras <[email protected]>
cb68abf
to
ae8a87e
Compare
90bfe18
to
cf8d4b4
Compare
cf8d4b4
to
2538b83
Compare
2538b83
to
fc4fbac
Compare
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!
I have added code to store the URL/timestamp of the registration in the database. Later we can decide not to repeat recent registrations.
app/src/androidTest/kotlin/at/bitfire/davdroid/servicedetection/CollectionListRefresherTest.kt
Outdated
Show resolved
Hide resolved
f147ea9
to
6c786b7
Compare
cd3d885
to
0b793f7
Compare
app/src/androidTest/kotlin/at/bitfire/davdroid/servicedetection/CollectionListRefresherTest.kt
Outdated
Show resolved
Hide resolved
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.
Thanks, looks good :)
Depends on #829