-
-
Notifications
You must be signed in to change notification settings - Fork 97
Extract discoverHomesets()
to ServiceRefresher
#1604
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
Extract discoverHomesets()
to ServiceRefresher
#1604
Conversation
Signed-off-by: Sunik Kupfer <[email protected]>
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.
Pull Request Overview
This PR extracts service detection functionality from CollectionListRefresher
into a new dedicated ServiceRefresher
class to improve code organization and maintainability. The main changes separate concerns by moving home set discovery logic into its own specialized class.
- Extract
discoverHomesets()
method and related properties fromCollectionListRefresher
to newServiceRefresher
class - Update
RefreshCollectionsWorker
to use the newServiceRefresher
via dependency injection - Move corresponding tests from
CollectionListRefresherTest
to newServiceRefresherTest
class
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
ServiceRefresher.kt | New class containing extracted home set discovery logic with assisted injection factory |
RefreshCollectionsWorker.kt | Updated to inject and use ServiceRefresher.Factory instead of calling CollectionListRefresher directly |
CollectionListRefresher.kt | Removed discoverHomesets() method and related properties/imports that were moved to ServiceRefresher |
ServiceRefresherTest.kt | New test class with extracted home set discovery tests |
CollectionListRefresherTest.kt | Removed testDiscoverHomesets() test method that was moved to ServiceRefresherTest |
app/src/main/kotlin/at/bitfire/davdroid/servicedetection/ServiceRefresher.kt
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.
Looks good, only small comments
app/src/androidTest/kotlin/at/bitfire/davdroid/servicedetection/ServiceRefresherTest.kt
Outdated
Show resolved
Hide resolved
app/src/androidTest/kotlin/at/bitfire/davdroid/servicedetection/ServiceRefresherTest.kt
Outdated
Show resolved
Hide resolved
Signed-off-by: Sunik Kupfer <[email protected]>
Signed-off-by: Sunik Kupfer <[email protected]>
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.
Nice :)
Purpose
Refactor to make service detection and collection list refresh easier to understand.
Short description
No code has been changed besides moving it around.
discoverHomesets()
method fromCollectionListRefresher
to newServiceRefresher
classRefreshCollectionsWorker
Note that we duplicate
TestDispatcher
on purpose (instead of extracting it to separate file and reusing it) in order to further isolate the tests and make the smaller TestDispatcher occurrences easier to understand.Checklist