Skip to content

Remove sync parsing geojson option#699

Merged
kiryldz merged 14 commits intomainfrom
kdz-remove-sync-geojson-parse
Oct 2, 2021
Merged

Remove sync parsing geojson option#699
kiryldz merged 14 commits intomainfrom
kdz-remove-sync-geojson-parse

Conversation

@kiryldz
Copy link
Copy Markdown
Contributor

@kiryldz kiryldz commented Sep 30, 2021

PRs must be submitted under the terms of our Contributor License Agreement CLA.
Fixes: < Link to related issues that will be fixed by this pull request, if they exist >

Pull request checklist:

  • Briefly describe the changes in this PR.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality. If tests were not written, please explain why.
  • Optimize code for java consumption (@JvmOverloads, @file:JvmName, etc).
  • Add example if relevant.
  • Document any changes to public APIs.
  • Apply changelog label ('breaking change', 'bug 🪲', 'build', 'docs', 'feature 🍏', 'performance ⚡', 'testing 💯') or use the label 'skip changelog'
  • Add an entry inside this element for inclusion in the mapbox-maps-android changelog: <changelog>Applying geojson data (using data, url, feature, featureCollection, geometry functions) is fully async now.</changelog>.

Summary of changes

Synchronous API for parsing feature, featureCollection, geometry on UI thread was removed.

Now when passing any kind of data to geojson source with data, url, feature, featureCollection, geometry - this will get scheduled on a worker thread, parsed, passed to core, processed in core on a worker thread and finally applied to the map.

User impact (optional)

Following APIs are impacted:

  • GeoJsonSource.data(userData) is also setting data using worker thread meaning that if some featureCollection is already parsing - it will be parsed till end, applied to the map and replaced immediately by userData.
  • GeoJsonSource.url(userUrl) is also setting data using worker thread meaning that if some featureCollection is already parsing - it will be parsed till end, applied to the map and replaced immediately by userUrl.
  • Following APIs are changed:
GeoJsonSource.feature(value: Feature, onDataParsed: ((GeoJsonSource) -> Unit)? = null) => GeoJsonSource.feature(value: Feature)

GeoJsonSource.geometry(value: Geometry, onDataParsed: ((GeoJsonSource) -> Unit)? = null) => GeoJsonSource.geometry(value: Geometry)

GeoJsonSource.featureCollection(value: FeatureCollection, onDataParsed: ((GeoJsonSource) -> Unit)? = null) => GeoJsonSource.featureCollection(value: FeatureCollection)

@SourceDsl
class Builder(
  val sourceId: String,
  private val onGeoJsonParsed: OnGeoJsonParsed
)  =>
@SourceDsl
class Builder(
  val sourceId: String
)
  • Following APIs are removed:
interface OnGeoJsonParsed

GeoJsonSource.addOnGeoJsonParsedListener(listener: OnGeoJsonParsed)

GeoJsonSource.removeOnGeoJsonParsedListener(listener: OnGeoJsonParsed)

// DSL function removed
fun geoJsonSource(
  id: String,
  config: GeoJsonSource.Builder.() -> Unit,
  onGeoJsonParsed: OnGeoJsonParsed
): GeoJsonSource = GeoJsonSource.Builder(id, onGeoJsonParsed).apply(config).build()

@kiryldz kiryldz force-pushed the kdz-remove-sync-geojson-parse branch from 5730994 to cbee69b Compare October 1, 2021 10:21
@kiryldz kiryldz marked this pull request as ready for review October 1, 2021 14:13
@kiryldz kiryldz requested a review from a team as a code owner October 1, 2021 14:13
Comment thread sdk/src/main/java/com/mapbox/maps/MapboxMap.kt Outdated
Comment thread sdk/src/main/java/com/mapbox/maps/MapboxMap.kt Outdated
Comment thread sdk/src/main/java/com/mapbox/maps/MapboxMap.kt Outdated
@kiryldz kiryldz requested a review from ank27 October 1, 2021 15:15
@kiryldz kiryldz merged commit 4570c48 into main Oct 2, 2021
@kiryldz kiryldz deleted the kdz-remove-sync-geojson-parse branch October 2, 2021 19:48
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.

4 participants