Skip to content

Commit bdf8a8f

Browse files
authored
Map feature telemetry (#553)
1 parent 1e62816 commit bdf8a8f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

android/src/main/kotlin/com/mapbox/maps/mapbox_maps/MapboxMapFactory.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.mapbox.maps.mapbox_maps
22

3+
import android.annotation.SuppressLint
34
import android.content.Context
5+
import com.mapbox.common.FeatureTelemetryCounter
46
import com.mapbox.maps.CameraOptions
57
import com.mapbox.maps.ConstrainMode
68
import com.mapbox.maps.ContextMode
@@ -26,6 +28,7 @@ class MapboxMapFactory(
2628
private val lifecycleProvider: MapboxMapsPlugin.LifecycleProvider
2729
) : PlatformViewFactory(StandardMessageCodec.INSTANCE) {
2830

31+
@SuppressLint("RestrictedApi")
2932
override fun create(context: Context?, viewId: Int, args: Any?): PlatformView {
3033
if (context == null) {
3134
throw RuntimeException("Context is null, can't create MapView!")
@@ -125,6 +128,7 @@ class MapboxMapFactory(
125128
textureView = textureView,
126129
styleUri = styleUri
127130
)
131+
mapCounter.increment()
128132
return MapboxMapController(
129133
context,
130134
mapInitOptions,
@@ -137,6 +141,7 @@ class MapboxMapFactory(
137141
}
138142

139143
companion object {
140-
private const val TAG = "MapBoxFactory"
144+
@SuppressLint("RestrictedApi")
145+
private val mapCounter = FeatureTelemetryCounter.create("maps-mobile/flutter/map")
141146
}
142147
}

ios/Classes/MapboxMapFactory.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import Flutter
22
import MapboxMaps
33
import MapboxCommon
4+
import MapboxCommon_Private
5+
6+
final class MapboxMapFactory: NSObject, FlutterPlatformViewFactory {
7+
private static let mapCounter = FeatureTelemetryCounter.create(forName: "maps-mobile/flutter/map")
48

5-
class MapboxMapFactory: NSObject, FlutterPlatformViewFactory {
69
var registrar: FlutterPluginRegistrar
710

811
deinit {
@@ -156,6 +159,7 @@ class MapboxMapFactory: NSObject, FlutterPlatformViewFactory {
156159

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

162+
Self.mapCounter.increment()
159163
return MapboxMapController(
160164
withFrame: frame,
161165
mapInitOptions: mapInitOptions,

0 commit comments

Comments
 (0)