Skip to content

Commit

Permalink
Port changes for release v2.0.0 (#569)
Browse files Browse the repository at this point in the history
* Map feature telemetry (#553)

* Bump maps sdk to 11.4.0 (#566)

* Bump Maps SDK to 11.4.0

* Add changelog entry

* Remove camera debug overlay from iOS code (#563)

* Add raster array source tests to the default test suite (#562)

* Bump plugin version to 2.0.0 (#567)

---------

Co-authored-by: Roman Laitarenko <[email protected]>
  • Loading branch information
maios and evil159 authored May 30, 2024
1 parent 75c8ad4 commit f07098b
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 85 deletions.
124 changes: 59 additions & 65 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,4 @@
### main

### 2.0.0-rc.1

* Update Maps SDK to 11.4.0-rc.2.

### 2.0.0-beta.1

* Introduce experimental `RasterArraySource`, note that `rasterLayers` is a get-only property and cannot be set.
* Introduce `TileCacheBudget`, a property to set per-source cache budgets in either megabytes or tiles.
* Expose `iconColorSaturation`, `rasterArrayBand`, `rasterElevation`, `rasterEmissiveStrength`, `hillshadeEmissiveStrength`, and `fillExtrusionEmissiveStrength` on their respective layers.
* Mark `MapboxMapsOptions.get/setWorldview()` and `MapboxMapsOptions.get/setLanguage()` as experimental.
* Bump Pigeon to 17.1.2
* [iOS] Fix crash in `onStyleImageMissingListener`.
* Deprecate `cameraForCoordinates`, please use `cameraForCoordinatesPadding` instead.
* Add a way to disable default puck's image(s) when using `DefaultLocationPuck2D`. By passing an empty byte array, for example, the following code shows a puck 2D with custom top image, default bearing image and no shadow image.
```
mapboxMap?.location.updateSettings(LocationComponentSettings(
enabled: true,
puckBearingEnabled: true,
locationPuck:
LocationPuck(locationPuck2D: DefaultLocationPuck2D(topImage: list, shadowImage: Uint8List.fromList([]))))
);
```
##### Snapshots

###### Standalone snapshotter

Show multiple maps at the same time with no performance penalty. With the all new `Snapshotter` you can get image snapshots of the map, styled the same way as `MapWidget`.

The `Snapshotter` class is highly configurable. You can set the final result at the time of construction using the `MapSnapshotOptions`. Once you've configured your snapshot, you can start the snapshotting process.

One of the key features of the `Snapshotter` class is the `style` object. This object can be manipulated to set different styles for your snapshot, as well as to apply runtime styling to the style, giving you the flexibility to create a snapshot that fits your needs.

```dart
final snapshotter = await Snapshotter.create(
options: MapSnapshotOptions(
size: Size(width: 400, height: 400),
pixelRatio: MediaQuery.of(context).devicePixelRatio),
onStyleLoadedListener: (_) {
// apply runtime styling
final layer = CircleLayer(id: "circle-layer", sourceId: "poi-source");
snapshotter?.style.addLayer(layer);
},
);
snapshotter.style.setStyleURI(MapboxStyles.STANDARD);
snapshotter.setCamera(CameraOptions(center: Point(...)));
...
final snapshotImage = await snapshotter.start()
```
##### Map widget snapshotting

Create snapshots of the map displayed in the `MapWidget` with `MapboxMap.snapshot()`. This new feature allows you to capture a static image of the current map view.

The `snapshot()` method captures the current state of the Mapbox map, including all visible layers, markers, and user interactions.

To use the snapshot() method, simply call it on your Mapbox map instance. The method will return a Future that resolves to the image of the current map view.

```dart
final snapshotImage = await mapboxMap.snapshot();
```

Please note that the `snapshot()` method works best if the Mapbox Map is fully loaded before capturing an image. If the map is not fully loaded, the method might return a blank image.
### 2.0.0

#### ⚠️ Breaking changes

Expand Down Expand Up @@ -162,11 +98,69 @@ PolylineAnnotationOptions(
])
)
```
##### Snapshots

###### Standalone snapshotter

Show multiple maps at the same time with no performance penalty. With the all new `Snapshotter` you can get image snapshots of the map, styled the same way as `MapWidget`.

The `Snapshotter` class is highly configurable. You can set the final result at the time of construction using the `MapSnapshotOptions`. Once you've configured your snapshot, you can start the snapshotting process.

One of the key features of the `Snapshotter` class is the `style` object. This object can be manipulated to set different styles for your snapshot, as well as to apply runtime styling to the style, giving you the flexibility to create a snapshot that fits your needs.

```dart
final snapshotter = await Snapshotter.create(
options: MapSnapshotOptions(
size: Size(width: 400, height: 400),
pixelRatio: MediaQuery.of(context).devicePixelRatio),
onStyleLoadedListener: (_) {
// apply runtime styling
final layer = CircleLayer(id: "circle-layer", sourceId: "poi-source");
snapshotter?.style.addLayer(layer);
},
);
snapshotter.style.setStyleURI(MapboxStyles.STANDARD);
snapshotter.setCamera(CameraOptions(center: Point(...)));
...
final snapshotImage = await snapshotter.start()
```
##### Map widget snapshotting

Create snapshots of the map displayed in the `MapWidget` with `MapboxMap.snapshot()`. This new feature allows you to capture a static image of the current map view.

The `snapshot()` method captures the current state of the Mapbox map, including all visible layers, markers, and user interactions.

To use the snapshot() method, simply call it on your Mapbox map instance. The method will return a Future that resolves to the image of the current map view.

```dart
final snapshotImage = await mapboxMap.snapshot();
```

Please note that the `snapshot()` method works best if the Mapbox Map is fully loaded before capturing an image. If the map is not fully loaded, the method might return a blank image.

* Fix camera center not applied from map init options.
* [iOS] Free up resources upon map widget disposal. This should help to reduce the amount of used memory when previously shown map widget is removed from the widget tree.
* Fix multi-word enum cases decoding/encoding when being sent to/from the platform side.
* [Android] Add Gradle 8 compatibility.
* Introduce experimental `RasterArraySource`, note that `rasterLayers` is a get-only property and cannot be set.
* Introduce `TileCacheBudget`, a property to set per-source cache budgets in either megabytes or tiles.
* Expose `iconColorSaturation`, `rasterArrayBand`, `rasterElevation`, `rasterEmissiveStrength`, `hillshadeEmissiveStrength`, and `fillExtrusionEmissiveStrength` on their respective layers.
* Mark `MapboxMapsOptions.get/setWorldview()` and `MapboxMapsOptions.get/setLanguage()` as experimental.
* Bump Pigeon to 17.1.2
* [iOS] Fix crash in `onStyleImageMissingListener`.
* Deprecate `cameraForCoordinates`, please use `cameraForCoordinatesPadding` instead.
* Add a way to disable default puck's image(s) when using `DefaultLocationPuck2D`. By passing an empty byte array, for example, the following code shows a puck 2D with custom top image, default bearing image and no shadow image.
```dart
mapboxMap?.location.updateSettings(LocationComponentSettings(
enabled: true,
puckBearingEnabled: true,
locationPuck:
LocationPuck(locationPuck2D: DefaultLocationPuck2D(topImage: list, shadowImage: Uint8List.fromList([]))))
);
```
* Update Maps SDK to 11.4.0.

### 1.1.0

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ To use the Maps Flutter Plugin add the git dependency to the pubspec.yaml:

```
dependencies:
mapbox_maps_flutter: ^2.0.0-beta.1
mapbox_maps_flutter: ^2.0.0
```

### Configure permissions
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ if (file("$rootDir/gradle/ktlint.gradle").exists() && file("$rootDir/gradle/lint
}

dependencies {
implementation "com.mapbox.maps:android:11.4.0-rc.2"
implementation "com.mapbox.maps:android:11.4.0"

implementation "androidx.annotation:annotation:1.7.1"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.mapbox.maps.mapbox_maps

import android.annotation.SuppressLint
import android.content.Context
import com.mapbox.common.FeatureTelemetryCounter
import com.mapbox.maps.CameraOptions
import com.mapbox.maps.ConstrainMode
import com.mapbox.maps.ContextMode
Expand All @@ -26,6 +28,7 @@ class MapboxMapFactory(
private val lifecycleProvider: MapboxMapsPlugin.LifecycleProvider
) : PlatformViewFactory(StandardMessageCodec.INSTANCE) {

@SuppressLint("RestrictedApi")
override fun create(context: Context?, viewId: Int, args: Any?): PlatformView {
if (context == null) {
throw RuntimeException("Context is null, can't create MapView!")
Expand Down Expand Up @@ -125,6 +128,7 @@ class MapboxMapFactory(
textureView = textureView,
styleUri = styleUri
)
mapCounter.increment()
return MapboxMapController(
context,
mapInitOptions,
Expand All @@ -137,6 +141,7 @@ class MapboxMapFactory(
}

companion object {
private const val TAG = "MapBoxFactory"
@SuppressLint("RestrictedApi")
private val mapCounter = FeatureTelemetryCounter.create("maps-mobile/flutter/map")
}
}
1 change: 1 addition & 0 deletions example/integration_test/all_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ void main() {
vector_source_test.main();
rasterdem_source_test.main();
raster_source_test.main();
rasterarray_source_test.main();
image_source_test.main();
geojson_source_test.main();

Expand Down
22 changes: 11 additions & 11 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ PODS:
- Flutter
- mapbox_maps_flutter (2.0.0-rc.1):
- Flutter
- MapboxMaps (~> 11.4.0-rc.2)
- MapboxMaps (~> 11.4.0)
- Turf (= 2.8.0)
- MapboxCommon (24.4.0-rc.2)
- MapboxCoreMaps (11.4.0-rc.2):
- MapboxCommon (~> 24.4.0-rc)
- MapboxMaps (11.4.0-rc.2):
- MapboxCommon (= 24.4.0-rc.2)
- MapboxCoreMaps (= 11.4.0-rc.2)
- MapboxCommon (24.4.0)
- MapboxCoreMaps (11.4.0):
- MapboxCommon (~> 24.4)
- MapboxMaps (11.4.0):
- MapboxCommon (= 24.4.0)
- MapboxCoreMaps (= 11.4.0)
- Turf (= 2.8.0)
- permission_handler_apple (9.1.1):
- Flutter
Expand Down Expand Up @@ -43,10 +43,10 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
integration_test: ce0a3ffa1de96d1a89ca0ac26fca7ea18a749ef4
mapbox_maps_flutter: 677b6094f040e319151db7496f87e0176506f3cc
MapboxCommon: 382ac2426f53bbe673ddea9398671e8eee2d4057
MapboxCoreMaps: b60c8a4d7dd2378620b1f6175a7d8e9214d250a4
MapboxMaps: b881158fb698cd589bab38ca78113f1480393370
mapbox_maps_flutter: 2ef4455f071d3c707c30d37fc2990c7c927fb844
MapboxCommon: 6acbd8ff41d66abf498e1558b0739f25c562945a
MapboxCoreMaps: f306bb1b10ebe995a2247b40e99322ab7f9b8071
MapboxMaps: 82044383ae19ec124ff444ec4b5d3ce82cb36ba5
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
Turf: aa2ede4298009639d10db36aba1a7ebaad072a5e

Expand Down
1 change: 0 additions & 1 deletion ios/Classes/MapboxMapController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ final class MapboxMapController: NSObject, FlutterPlatformView {
.set(key: "com.mapbox.common.telemetry.internal.custom_user_agent_fragment", value: "FlutterPlugin/\(pluginVersion)")

mapView = MapView(frame: frame, mapInitOptions: mapInitOptions)
mapView.debugOptions = [.camera]
mapboxMap = mapView.mapboxMap

self.registrar = registrar
Expand Down
6 changes: 5 additions & 1 deletion ios/Classes/MapboxMapFactory.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import Flutter
import MapboxMaps
import MapboxCommon
import MapboxCommon_Private

final class MapboxMapFactory: NSObject, FlutterPlatformViewFactory {
private static let mapCounter = FeatureTelemetryCounter.create(forName: "maps-mobile/flutter/map")

class MapboxMapFactory: NSObject, FlutterPlatformViewFactory {
var registrar: FlutterPluginRegistrar

deinit {
Expand Down Expand Up @@ -156,6 +159,7 @@ class MapboxMapFactory: NSObject, FlutterPlatformViewFactory {

var eventTypes = args["eventTypes"] as? [Int] ?? []

Self.mapCounter.increment()
return MapboxMapController(
withFrame: frame,
mapInitOptions: mapInitOptions,
Expand Down
4 changes: 2 additions & 2 deletions ios/mapbox_maps_flutter.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
Pod::Spec.new do |s|
s.name = 'mapbox_maps_flutter'
s.version = '2.0.0-rc.1'
s.version = '2.0.0'

s.summary = 'Mapbox Maps SDK Flutter Plugin.'
s.description = 'An officially developed solution from Mapbox that enables use of our latest Maps SDK product.'
Expand All @@ -17,7 +17,7 @@ Pod::Spec.new do |s|
s.dependency 'Flutter'
s.platform = :ios, '12.0'

s.dependency 'MapboxMaps', '~> 11.4.0-rc.2'
s.dependency 'MapboxMaps', '~> 11.4.0'
s.dependency 'Turf', '2.8.0'

# Flutter.framework does not contain a i386 slice.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/map_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class _MapWidgetState extends State<MapWidget> {
'textureView': widget.textureView,
'styleUri': widget.styleUri,
'channelSuffix': _suffix,
'mapboxPluginVersion': '2.0.0-rc.1',
'mapboxPluginVersion': '2.0.0',
'eventTypes': _events.eventTypes.map((e) => e.index).toList(),
};

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: mapbox_maps_flutter
description: A Flutter plugin for integrating Mapbox Maps SDK v11 in Android/iOS application.
version: 2.0.0-rc.1
version: 2.0.0
homepage: https://github.com/mapbox/mapbox-maps-flutter

environment:
Expand Down

0 comments on commit f07098b

Please sign in to comment.