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

Fixed crash in Mapbox #3482

Merged
merged 1 commit into from
Dec 2, 2019
Merged

Conversation

grzesiek2010
Copy link
Member

@grzesiek2010 grzesiek2010 commented Nov 29, 2019

Closes #3479

What has been done to verify that this works as intended?

I reproduced the crash and confirmed the pr fixes the issue. I also debugged the code to confirm that the code I removes was redundant.

Why is this the best possible solution? Were any other approaches considered?

Just to clarify: the issue is not related to changing the layer to None but generally to changing any layers.

The crash was caused here because we tried to remove a layer that doesn't exist. It didn't cause a problem when we had mapbxox v8.3.0 but since we updated to 8.4.0 it's been crashing.

I removed the code because as I said above it always tried to remove a layer that didn't exist. The code was redundant. It was called just in loadReferenceOverlay() which is called in two places:
https://github.com/opendatakit/collect/blob/master/collect_app/src/main/java/org/odk/collect/android/geo/MapboxMapFragment.java#L208
https://github.com/opendatakit/collect/blob/master/collect_app/src/main/java/org/odk/collect/android/geo/MapboxMapFragment.java#L161
in both cases after we call: map.setStyle what clears layers we then again tried to remove.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

Testing changing layers in Mapbox would be enough. Nothing else should be affected.

Do we need any specific form for testing your changes? If so, please attach one.

Any form with geo widgets.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No.

Before submitting this PR, please make sure you have:

  • run ./gradlew checkAll and confirmed all checks still pass OR confirm CircleCI build passes and run ./gradlew connectedDebugAndroidTest locally.
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

@grzesiek2010 grzesiek2010 changed the title Removed redundant code Fixed crash in Mapbox Nov 29, 2019
Copy link
Member

@lognaturel lognaturel left a comment

Choose a reason for hiding this comment

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

I think that this was added in preparation for multiple user-selected layers. When that does happen, there will need to be a list of layers to manage but until then I agree it makes sense to remove.

@mmarciniak90
Copy link
Contributor

Tested with success

Verified on Android: 10.0, 9.0, 7.0, 6.0, 5.1, 4.4, 4.2

Verified cases:

  • changing layers on GeoPoint, GeoTrace, and GeoShape widgets
  • Light/dark mode
  • English/Spanish language

@opendatakit-bot unlabel "needs testing"
@opendatakit-bot label "behavior verified"

@grzesiek2010 grzesiek2010 merged commit ae0a721 into getodk:master Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Collect crashes when the offline layer is changed to 'None'
4 participants