Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91f28f16 authored by Guillaume Jacquart's avatar Guillaume Jacquart
Browse files

1167: replace Mapbox with maplibre 10.0.2

parent a0ee04ea
Loading
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@ stages:
# By default load dev keys.
variables:
  MAPBOX_KEY: $MAPBOX_KEY_DEV
  MAPBOX_SECRET_KEY: $MAPBOX_SECRET_KEY_DEV
  SENTRY_DSN: $SENTRY_DSN

workflow:
@@ -99,12 +98,10 @@ build-full:
    - if: '$CI_COMMIT_BRANCH == "main"'
      variables:
          MAPBOX_KEY: $MAPBOX_KEY_PROD
          MAPBOX_SECRET_KEY: $MAPBOX_SECRET_KEY_PROD
      when: always
    - if: '$CI_COMMIT_REF_PROTECTED == "true"'
      variables:
          MAPBOX_KEY: $MAPBOX_KEY_PROD
          MAPBOX_SECRET_KEY: $MAPBOX_SECRET_KEY_PROD
      when: always
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"'
      when: always
+0 −2
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ This project uses [Sentry](https://sentry.io) for telemetry and crash reports,
You can set them in local.properties
```
MAPBOX_KEY=<insert mapbox public key>
MAPBOX_SECRET_KEY=<insert mapbox secret key>
SENTRY_DSN=<insert sentry dsn>
```
**IMP: Never add this file to version control.**
@@ -57,7 +56,6 @@ SENTRY_DSN=<insert sentry dsn>
When building in CI environment, we don't have local.properties file. So the following environment variables must be set:
```
export MAPBOX_KEY=<insert mapbox public key>
export MAPBOX_SECRET_KEY=<insert mapbox secret key>
export SENTRY_DSN=<insert sentry dsn>
```

+1 −1
Original line number Diff line number Diff line
@@ -150,7 +150,7 @@ dependencies {
        Libs.Retrofit.retrofit,
        Libs.Retrofit.scalars,

        Libs.MapBox.sdk,
        Libs.maplibre,
        Libs.mpAndroidCharts,

        Libs.telemetry,
+0 −2
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@
package foundation.e.privacycentralapp

import android.app.Application
import com.mapbox.mapboxsdk.Mapbox
import foundation.e.lib.telemetry.Telemetry

class PrivacyCentralApplication : Application() {
@@ -29,7 +28,6 @@ class PrivacyCentralApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        Telemetry.init(BuildConfig.SENTRY_DSN, this, true)
        Mapbox.getTelemetry()?.setUserTelemetryRequestState(false)

        dependencyContainer.initBackgroundSingletons()
    }
+10 −10
Original line number Diff line number Diff line
@@ -38,11 +38,12 @@ import com.google.android.material.textfield.TextInputLayout
import com.google.android.material.textfield.TextInputLayout.END_ICON_CUSTOM
import com.google.android.material.textfield.TextInputLayout.END_ICON_NONE
import com.mapbox.mapboxsdk.Mapbox
import com.mapbox.mapboxsdk.WellKnownTileServer
import com.mapbox.mapboxsdk.camera.CameraPosition
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory
import com.mapbox.mapboxsdk.geometry.LatLng
import com.mapbox.mapboxsdk.location.LocationComponent
import com.mapbox.mapboxsdk.location.LocationComponentActivationOptions
import com.mapbox.mapboxsdk.location.LocationUpdate
import com.mapbox.mapboxsdk.location.modes.CameraMode
import com.mapbox.mapboxsdk.location.modes.RenderMode
import com.mapbox.mapboxsdk.maps.MapboxMap
@@ -91,11 +92,12 @@ class FakeLocationFragment : NavToolbarFragment(R.layout.fragment_fake_location)

    companion object {
        private const val DEBOUNCE_PERIOD = 1000L
        private const val MAP_STYLE = "mapbox://styles/mapbox/outdoors-v12"
    }

    override fun onAttach(context: Context) {
        super.onAttach(context)
        Mapbox.getInstance(requireContext(), getString(R.string.mapbox_key))
        Mapbox.getInstance(requireContext(), getString(R.string.mapbox_key), WellKnownTileServer.Mapbox)
    }

    override fun getTitle(): String = getString(R.string.location_title)
@@ -112,12 +114,11 @@ class FakeLocationFragment : NavToolbarFragment(R.layout.fragment_fake_location)
        binding.mapView.setup(savedInstanceState) { mapboxMap ->
            this.mapboxMap = mapboxMap
            mapboxMap.uiSettings.isRotateGesturesEnabled = false
            mapboxMap.setStyle(Style.MAPBOX_STREETS) { style ->
            mapboxMap.setStyle(MAP_STYLE) { style ->
                enableLocationPlugin(style)

                mapboxMap.addOnCameraMoveListener {
                    if (binding.mapView.isEnabled) {
                        mapboxMap.cameraPosition.target.let {
                        mapboxMap.cameraPosition.target?.let {
                            viewModel.submitAction(
                                Action.SetSpecificLocationAction(
                                    it.latitude.toFloat(),
@@ -127,6 +128,9 @@ class FakeLocationFragment : NavToolbarFragment(R.layout.fragment_fake_location)
                        }
                    }
                }

                mapboxMap.cameraPosition = CameraPosition.Builder().zoom(8.0).build()

                // Bind click listeners once map is ready.
                bindClickListeners()

@@ -294,11 +298,7 @@ class FakeLocationFragment : NavToolbarFragment(R.layout.fragment_fake_location)
    private fun updateLocation(lastLocation: Location?, mode: LocationMode) {
        lastLocation?.let { location ->
            locationComponent?.isLocationComponentEnabled = true
            val locationUpdate = LocationUpdate.Builder()
                .location(location)
                .animationDuration(100)
                .build()
            locationComponent?.forceLocationUpdate(locationUpdate)
            locationComponent?.forceLocationUpdate(location)

            if (mode == LocationMode.REAL_LOCATION) {
                binding.mapLoader.isVisible = false
Loading