Skip to content

Commit

Permalink
Backport #6821 and #6762 to release-v2.7 (#6822)
Browse files Browse the repository at this point in the history
* fix copilot unrecognized fields serialization (#6821)

* [copilot] add proguard rule to prevent obfuscation of route properties (#6762)
  • Loading branch information
Guardiola31337 authored Jan 12, 2023
1 parent 0ce5f63 commit d5b6731
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions libnavigation-copilot/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-keepnames class com.mapbox.api.directions.v5.models.** {*;}
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())
.create()
internal const val GZ = "gz"
internal const val ZIP = "zip"
internal const val MEDIA_TYPE_ZIP = "application/zip"
Expand Down

0 comments on commit d5b6731

Please sign in to comment.