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 Copilot unrecognized fields serialization #6821

Merged
merged 1 commit into from
Jan 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ import android.content.pm.ApplicationInfo
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.ProcessLifecycleOwner
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.mapbox.api.directions.v5.DirectionsAdapterFactory
import com.mapbox.common.UploadOptions
import com.mapbox.geojson.Point
import com.mapbox.geojson.PointAsCoordinatesTypeAdapter
import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI
import com.mapbox.navigation.base.route.NavigationRoute
import com.mapbox.navigation.copilot.HistoryAttachmentsUtils.copyToAndRemove
Expand Down Expand Up @@ -397,7 +400,10 @@ internal class MapboxCopilotImpl(

internal companion object {

internal val gson = Gson()
internal val gson = GsonBuilder()
.registerTypeAdapterFactory(DirectionsAdapterFactory.create())
.registerTypeAdapter(Point::class.java, PointAsCoordinatesTypeAdapter())
Comment on lines +404 to +405
Copy link
Contributor

@VysotskiVadim VysotskiVadim Jan 12, 2023

Choose a reason for hiding this comment

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

I think it would be nice if mapbox-java exposed a single point for adapter, so that:

  1. other users could use it in their projects with 1 extra line of code
  2. if we add new adapters, we don't need to add them to copilot too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great idea! Could you cut a ticket in mapbox-java when you have a chance? 🙏

.create()
internal const val GZ = "gz"
internal const val ZIP = "zip"
internal const val MEDIA_TYPE_ZIP = "application/zip"
Expand Down