Skip to content

Commit

Permalink
2.3.0 release cherry-picks (#714)
Browse files Browse the repository at this point in the history
* Improve style image error reporting (#700)

* Report error when image cannot be added to the style

* Use dedicated method to check for style image

* Typed `RendredQueryGeometry` (#707)

* Typed `RenderedQueryGeometry`

* lint

* Pass job name and commit hash to firebase matrix labels

* bump gcloud version

* Remove unnecessary android apk build in CI

* lint

* Bump Maps SDK to 11.7.0 (#709)

* Fix AGP 7 compatibility (#712)

* Downgrade androidx.lifecycle to 2.6.2 for AGP 7

* Downgrade androidx.annotation to 1.5.0

* Downgrade AGP to 7.3.0, Gradle to 7.4.2

* Use minimum supported AGP and gradle in examples project

* Downgrade CI android image to one that has Java 17 for Gradle 7.5 compatibility

* Updage lockfile

* Prepare 2.3.0 (#713)

* Update changelog

* Bump SDK version
  • Loading branch information
evil159 authored Oct 1, 2024
1 parent 1ce5151 commit 0a5b625
Show file tree
Hide file tree
Showing 23 changed files with 148 additions and 97 deletions.
11 changes: 6 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ commands:
setup-gcloud:
steps:
- gcp-cli/setup:
version: 489.0.0
version: 494.0.0
gcloud_service_key: GCLOUD_SERVICE_ACCOUNT_JSON

add-mapbox-submodules-key:
Expand All @@ -35,7 +35,7 @@ jobs:
type: string
default: example/build/app/outputs/apk
docker:
- image: cimg/android:2024.09.1
- image: cimg/android:2024.01.1
resource_class: 2xlarge
steps:
- checkout
Expand All @@ -53,7 +53,6 @@ jobs:
name: "Build Android integration tests"
working_directory: example/android
command: |
flutter build apk
./gradlew app:assembleAndroidTest --stacktrace
./gradlew app:assembleDebug -Ptarget=integration_test/all_test.dart -Pdart-defines="$(echo -n "ACCESS_TOKEN=$MAPBOX_ACCESS_TOKEN" | base64 -w 0)" --stacktrace
- persist_to_workspace:
Expand Down Expand Up @@ -85,7 +84,8 @@ jobs:
--use-orchestrator \
--num-flaky-test-attempts 3 \
--no-record-video \
--no-performance-metrics
--no-performance-metrics \
--client-details matrixLabel="${CIRCLE_JOB}-${CIRCLE_SHA1:0:6}"
build-ios:
parameters:
Expand Down Expand Up @@ -146,7 +146,8 @@ jobs:
--test << parameters.workspace-path >>/build_products.zip \
--device model=iphone13pro,version=15.7 \
--timeout 5m \
--num-flaky-test-attempts 3 2>&1 | tee firebase_test_lab_run.log
--num-flaky-test-attempts 3 \
--client-details matrixLabel="${CIRCLE_JOB}-${CIRCLE_SHA1:0:6}" 2>&1 | tee firebase_test_lab_run.log
- run:
name: Download XCResults
command: |
Expand Down
26 changes: 19 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
### 2.3.0-rc.1
# 2.3.0

* Deprecate untyped default constructor of `RenderedQueryGeometry` with typed constructors: `RenderedQueryGeometry.fromList()/fromScreenBox()/fromScreenCoordinate()`.

This change improves type safety and clarity in the code. By using specific constructors, you can ensure that the `RenderedQueryGeometry` is created with the correct type of data, reducing the risk of runtime errors and making the code easier to understand and maintain.

**Example:**

*Before:*
```dart
// Using the untyped default constructor
final geometry = RenderedQueryGeometry(type: Type.SCREEN_COORDINATE, value jsonEncode(screenCoordinate.encode()));
```

*After:*
```dart
// Using a typed constructor
final geometry = RenderedQueryGeometry.fromScreenCoordinate(screenCoordinate);
```
* Expose API to clear map data, and to set options to `TileStore`.

You can now clear temporary map data from the data path defined in the given resource options, which is useful when you want reduce the disk usage or in case the disk cache contains invalid data.
Expand All @@ -13,7 +30,6 @@ And you can now set additional options to a `TileStore`, for example, a maximum
// This removes the tiles from the predictive cache.
tileStore.setDiskQuota(0);
```

* Add support for partial GeoJSON updates.

Instead of setting a whole new GeoJSON object anew every time a single feature has changed, now you can apply more granular, partial GeoJSON updates.
Expand Down Expand Up @@ -51,13 +67,9 @@ circleAnnotationManager.setCircleColor(Colors.blue.value);
* Expose experimental `lineTrimColor` and `lineTrimFadeRange` on `LineLayer` which allow to set custom color for trimmed line and fade effect for trim.
* Add experimental `FillExtrusionLayer.fillExtrusionLineWidth` that can switch fill extrusion rendering into wall rendering mode. Use this property to render the feature with the given width over the outlines of the geometry.
* Add experimental `MapboxMap.setSnapshotLegacyMode()` to help avoiding `MapboxMap.snapshot()` native crash on some Samsung devices running Android 14. `MapboxMap.setSnapshotLegacyMode()` has no effect on iOS.
* Bump Maps SDK to 11.7.0-rc.1

### 2.3.0-beta.1

* Fix build errors when using Flutter SDK 3.24.
* Add `GestureState` to `MapContentGestureContext` to indicate whether gesture has been started, its touches have changed or it has ended.
* Bump Maps SDK to 11.7.0-beta.1
* Bump Maps SDK to 11.7.0.

### 2.2.0

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Mapbox Maps SDK Flutter SDK

The Mapbox Maps SDK Flutter SDK is an officially developed solution from Mapbox that enables use of our latest Maps SDK product (v11.7.0-rc.1). The SDK allows developers to embed highly-customized maps using a Flutter widget on Android and iOS.
The Mapbox Maps SDK Flutter SDK is an officially developed solution from Mapbox that enables use of our latest Maps SDK product (v11.7.0). The SDK allows developers to embed highly-customized maps using a Flutter widget on Android and iOS.

Web and desktop are not supported.

Expand Down Expand Up @@ -113,7 +113,7 @@ To use the Maps Flutter SDK add the git dependency to the pubspec.yaml:

```
dependencies:
mapbox_maps_flutter: ^2.3.0-rc.1
mapbox_maps_flutter: ^2.3.0
```

### Configure permissions
Expand Down Expand Up @@ -160,7 +160,7 @@ The `MapboxMap` controller instance is provided with `MapWidget.onMapCreated` ca
`MapboxMap` exposes an entry point to the most of the APIs Maps Flutter SDK provides. It allows to control the map, camera, styles, observe map events,
query rendered features, etc.

It's organized similarly to the [Android](https://docs.mapbox.com/android/maps/api/11.5.0/mapbox-maps-android/com.mapbox.maps/-mapbox-map/) and [iOS](https://docs.mapbox.com/ios/maps/api/11.5.0/documentation/mapboxmaps/mapboxmap) counterparts.
It's organized similarly to the [Android](https://docs.mapbox.com/android/maps/api/11.7.0/mapbox-maps-android/com.mapbox.maps/-mapbox-map/) and [iOS](https://docs.mapbox.com/ios/maps/api/11.7.0/documentation/mapboxmaps/mapboxmap) counterparts.

To interact with the map after it's created store the MapboxMap object somewhere :
```
Expand Down
8 changes: 4 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down Expand Up @@ -78,8 +78,8 @@ if (file("$rootDir/gradle/ktlint.gradle").exists() && file("$rootDir/gradle/lint
}

dependencies {
implementation "com.mapbox.maps:android:11.7.0-rc.1"
implementation "com.mapbox.maps:android:11.7.0"

implementation "androidx.annotation:annotation:1.8.2"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.8.4"
implementation "androidx.annotation:annotation:1.5.0"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.6.2"
}
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import com.mapbox.maps.EdgeInsets
import com.mapbox.maps.StylePackError
import com.mapbox.maps.applyDefaultParams
import com.mapbox.maps.debugoptions.MapViewDebugOptions
import com.mapbox.maps.extension.style.expressions.dsl.generated.min
import com.mapbox.maps.extension.style.layers.properties.generated.ProjectionName
import com.mapbox.maps.extension.style.light.LightPosition
import com.mapbox.maps.extension.style.light.generated.ambientLight
Expand Down Expand Up @@ -235,7 +234,7 @@ fun SourceQueryOptions.toSourceQueryOptions(): com.mapbox.maps.SourceQueryOption
return com.mapbox.maps.SourceQueryOptions(sourceLayerIds, filter.toValue())
}

fun RenderedQueryGeometry.toRenderedQueryGeometry(context: Context): com.mapbox.maps.RenderedQueryGeometry {
fun _RenderedQueryGeometry.toRenderedQueryGeometry(context: Context): com.mapbox.maps.RenderedQueryGeometry {
return when (type) {
Type.SCREEN_BOX -> com.mapbox.maps.RenderedQueryGeometry.valueOf(
Gson().fromJson(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import com.mapbox.maps.mapbox_maps.pigeons.MapOptions
import com.mapbox.maps.mapbox_maps.pigeons.NorthOrientation
import com.mapbox.maps.mapbox_maps.pigeons.QueriedRenderedFeature
import com.mapbox.maps.mapbox_maps.pigeons.QueriedSourceFeature
import com.mapbox.maps.mapbox_maps.pigeons.RenderedQueryGeometry
import com.mapbox.maps.mapbox_maps.pigeons.RenderedQueryOptions
import com.mapbox.maps.mapbox_maps.pigeons.Size
import com.mapbox.maps.mapbox_maps.pigeons.SourceQueryOptions
Expand All @@ -26,6 +25,7 @@ import com.mapbox.maps.mapbox_maps.pigeons.TileCoverOptions
import com.mapbox.maps.mapbox_maps.pigeons.ViewportMode
import com.mapbox.maps.mapbox_maps.pigeons._MapInterface
import com.mapbox.maps.mapbox_maps.pigeons._MapWidgetDebugOptionsBox
import com.mapbox.maps.mapbox_maps.pigeons._RenderedQueryGeometry
import com.mapbox.maps.plugin.delegates.listeners.OnMapLoadErrorListener

class MapInterfaceController(
Expand Down Expand Up @@ -142,7 +142,7 @@ class MapInterfaceController(
}

override fun queryRenderedFeatures(
geometry: RenderedQueryGeometry,
geometry: _RenderedQueryGeometry,
options: RenderedQueryOptions,
callback: (Result<List<QueriedRenderedFeature?>>) -> Unit
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1378,18 +1378,18 @@ data class QueriedFeature(
*
* Generated class from Pigeon that represents data sent in messages.
*/
data class RenderedQueryGeometry(
data class _RenderedQueryGeometry(
/** ScreenCoordinate/List<ScreenCoordinate>/ScreenBox in Json mode. */
val value: String,
val type: Type

) {
companion object {
@Suppress("LocalVariableName")
fun fromList(__pigeon_list: List<Any?>): RenderedQueryGeometry {
fun fromList(__pigeon_list: List<Any?>): _RenderedQueryGeometry {
val value = __pigeon_list[0] as String
val type = __pigeon_list[1] as Type
return RenderedQueryGeometry(value, type)
return _RenderedQueryGeometry(value, type)
}
}
fun toList(): List<Any?> {
Expand Down Expand Up @@ -2005,7 +2005,7 @@ private object MapInterfacesPigeonCodec : StandardMessageCodec() {
}
156.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
RenderedQueryGeometry.fromList(it)
_RenderedQueryGeometry.fromList(it)
}
}
157.toByte() -> {
Expand Down Expand Up @@ -2296,7 +2296,7 @@ private object MapInterfacesPigeonCodec : StandardMessageCodec() {
stream.write(155)
writeValue(stream, value.toList())
}
is RenderedQueryGeometry -> {
is _RenderedQueryGeometry -> {
stream.write(156)
writeValue(stream, value.toList())
}
Expand Down Expand Up @@ -3211,7 +3211,7 @@ interface _MapInterface {
* @param completion The `query features completion` called when the query completes.
* @return A `cancelable` object that could be used to cancel the pending query.
*/
fun queryRenderedFeatures(geometry: RenderedQueryGeometry, options: RenderedQueryOptions, callback: (Result<List<QueriedRenderedFeature?>>) -> Unit)
fun queryRenderedFeatures(geometry: _RenderedQueryGeometry, options: RenderedQueryOptions, callback: (Result<List<QueriedRenderedFeature?>>) -> Unit)
/**
* Queries the map for source features.
*
Expand Down Expand Up @@ -3678,7 +3678,7 @@ interface _MapInterface {
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val geometryArg = args[0] as RenderedQueryGeometry
val geometryArg = args[0] as _RenderedQueryGeometry
val optionsArg = args[1] as RenderedQueryOptions
api.queryRenderedFeatures(geometryArg, optionsArg) { result: Result<List<QueriedRenderedFeature?>> ->
val error = result.exceptionOrNull()
Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Apr 30 20:27:36 EEST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion example/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.3.2" apply false
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
}

Expand Down
18 changes: 7 additions & 11 deletions example/integration_test/map_interface_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -326,27 +326,23 @@ void main() {
var screenBox = ScreenBox(
min: ScreenCoordinate(x: 0.0, y: 0.0),
max: ScreenCoordinate(x: 500.0, y: 1000.0));
var renderedQueryGeometry = RenderedQueryGeometry(
value: json.encode(screenBox.toJson()), type: Type.SCREEN_BOX);
var renderedQueryGeometry = RenderedQueryGeometry.fromScreenBox(screenBox);
var query = await mapboxMap.queryRenderedFeatures(renderedQueryGeometry,
RenderedQueryOptions(layerIds: ['points'], filter: null));
expect(query.length, greaterThan(0));
expect(query[0]!.queriedFeature.source, 'source');
expect(query[0]!.queriedFeature.feature['id'], 'point');

query = await mapboxMap.queryRenderedFeatures(
RenderedQueryGeometry(
value: json.encode(ScreenCoordinate(x: 0.0, y: 0.0).toJson()),
type: Type.SCREEN_COORDINATE),
RenderedQueryGeometry.fromScreenCoordinate(
ScreenCoordinate(x: 0.0, y: 0.0)),
RenderedQueryOptions(layerIds: ['points'], filter: null));
expect(query.length, 0);
query = await mapboxMap.queryRenderedFeatures(
RenderedQueryGeometry(
value: json.encode([
ScreenCoordinate(x: 0.0, y: 0.0).toJson(),
ScreenCoordinate(x: 1.0, y: 1.0).toJson()
]),
type: Type.LIST),
RenderedQueryGeometry.fromList([
ScreenCoordinate(x: 0.0, y: 0.0),
ScreenCoordinate(x: 1.0, y: 1.0),
]),
RenderedQueryOptions(layerIds: ['points'], filter: null));
expect(query.length, 0);
});
Expand Down
24 changes: 12 additions & 12 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ PODS:
- Flutter (1.0.0)
- integration_test (0.0.1):
- Flutter
- mapbox_maps_flutter (2.3.0-beta.1):
- mapbox_maps_flutter (2.3.0):
- Flutter
- MapboxMaps (~> 11.7.0-rc.1)
- MapboxMaps (~> 11.7.0)
- Turf (= 3.0.0)
- MapboxCommon (24.7.0-rc.2)
- MapboxCoreMaps (11.7.0-rc.2):
- MapboxCommon (~> 24.7.0-rc)
- MapboxMaps (11.7.0-rc.1):
- MapboxCommon (= 24.7.0-rc.2)
- MapboxCoreMaps (= 11.7.0-rc.2)
- MapboxCommon (24.7.0)
- MapboxCoreMaps (11.7.0):
- MapboxCommon (~> 24.7)
- MapboxMaps (11.7.0):
- MapboxCommon (= 24.7.0)
- MapboxCoreMaps (= 11.7.0)
- Turf (= 3.0.0)
- path_provider_foundation (0.0.1):
- Flutter
Expand Down Expand Up @@ -49,10 +49,10 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573
mapbox_maps_flutter: 0c0afaaa72413cb02b70126646d79bfff9094ca0
MapboxCommon: 85c133c17aa073d6d57a14ee5676a2236d3df35a
MapboxCoreMaps: 35061f7cacdfc22accd89b2218bc66af1939f380
MapboxMaps: 1ab65689c868ac0c1065342ba840818087f1486b
mapbox_maps_flutter: fb6e57802405af69ecd96a9a2c7cdf9c756c4985
MapboxCommon: fbc1138a831f4c1b728167c3f49701fe3a9aeed1
MapboxCoreMaps: 8946c9fa51e588d594ee6ebf192d9942368abb6a
MapboxMaps: bf9f775d921ed357ae642c379ebad90550cdb9de
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
Turf: a1604e74adce15c58462c9ae2acdbf049d5be35e
Expand Down
6 changes: 3 additions & 3 deletions example/lib/cluster.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ class StyleClustersPageBodyState extends State<StyleClustersPageBody> {
return TextButton(
child: Text('queryRenderedFeatures'),
onPressed: () {
var screenBox = ScreenBox(
final screenBox = ScreenBox(
min: ScreenCoordinate(x: 0.0, y: 0.0),
max: ScreenCoordinate(x: 150.0, y: 510.0));
var renderedQueryGeometry = RenderedQueryGeometry(
value: json.encode(screenBox.toJson()), type: Type.SCREEN_BOX);
final renderedQueryGeometry =
RenderedQueryGeometry.fromScreenBox(screenBox);
mapboxMap
?.queryRenderedFeatures(renderedQueryGeometry,
RenderedQueryOptions(layerIds: ['clusters'], filter: null))
Expand Down
6 changes: 3 additions & 3 deletions example/lib/map_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,11 @@ class MapInterfacePageBodyState extends State<MapInterfacePageBody> {
return TextButton(
child: Text('queryRenderedFeatures'),
onPressed: () {
var screenBox = ScreenBox(
final screenBox = ScreenBox(
min: ScreenCoordinate(x: 0.0, y: 0.0),
max: ScreenCoordinate(x: 150.0, y: 510.0));
var renderedQueryGeometry = RenderedQueryGeometry(
value: json.encode(screenBox.toJson()), type: Type.SCREEN_BOX);
final renderedQueryGeometry =
RenderedQueryGeometry.fromScreenBox(screenBox);
mapboxMap
?.queryRenderedFeatures(
renderedQueryGeometry,
Expand Down
Loading

0 comments on commit 0a5b625

Please sign in to comment.