Skip to content
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

fix: Administrative area in Location Detection #2637

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

dheerajkotwani
Copy link
Member

Fixes #2459 The location is not displayed properly

Changes:
Previously on clicking on detect my location it showed the Administrative Area made it to display the City Name as it would be more specific.

Screenshots for the change:

Previously
loc_prev

After Changing
loc_new

@auto-label auto-label bot added the fix label Feb 4, 2020
@dheerajkotwani dheerajkotwani changed the title fix: Administrative area in Location Detection fix: Administrative area in Location Detection (WIP) Feb 5, 2020
@dheerajkotwani dheerajkotwani changed the title fix: Administrative area in Location Detection (WIP) fix: Administrative area in Location Detection Feb 5, 2020
object : LocationListener {
override fun onLocationChanged(location: Location?) {
if (location == null) {
emitter.onError(java.lang.IllegalStateException())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What IllegalState?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given for the condition if incase it fails to update location to the variable then it gives the error for it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see that message in IllegalStateException constructor. How would I know?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should I remove the it? or I had a question is there need of AdminArea if we are implementing it using cityName if not then should I change the method for calling the admin area with the city name as it will also save from creating another function for it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, you should throw error with a proper message

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, I will fix it soon

?: return Single.error(IllegalStateException())
val geoCoder = Geocoder(context, Locale.getDefault())

return Single.create { emitter ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add single cancel handler

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will create a memory leak when Single is cancelled. Add logic to handle the cancellation

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The location isn't working properly.
2 participants