-
Notifications
You must be signed in to change notification settings - Fork 170
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
Migrate Geocoder to coroutines #344
Conversation
} catch (exception: IOException) { | ||
emptyList() | ||
} | ||
override fun getFromLocationName(query: String): List<Address> { |
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.
geocoder.getFromLocationName(query, MAX_RESULTS) can block the thread? should getFromLocationName
be a suspend fun?
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.
I'm not sure about this, I think It should not be a problem because is always called under a suspend fun. And I also think that has a time out exception that raises the IOException.
.build() | ||
val results = geoDataClient.findAutocompletePredictions(findAutocompletePredictionsRequest) | ||
try { | ||
Tasks.await(results, PREDICTIONS_WAITING_TIME, TimeUnit.SECONDS) |
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.
What are you trying to achieve here?
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.
Here I only removed the Single.defer wrap. If I remember well this was a copy&paste from Google documentation.
🤔 Probably this must be reviewed later on.
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.
👍 with non-blocking comments
Description
In order to migrate all the library from RxJava to Kotlin Coroutines we have migrated the GeocoderRepository to Coroutines.
Screenshots
No screens
Mandatory GIF