@maplibre/maplibre-react-native 10.1.5 → 11.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{maplibre-react-native.podspec → MapLibreReactNative.podspec} +15 -16
- package/android/build.gradle +89 -110
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +1 -3
- package/android/src/main/java/org/maplibre/reactnative/MLRNPackage.kt +144 -0
- package/android/src/main/java/org/maplibre/reactnative/components/AbstractEventEmitter.java +1 -5
- package/android/src/main/java/org/maplibre/reactnative/modules/MLRNModule.java +0 -34
- package/android/src/main/java/org/maplibre/reactnative/modules/MLRNSnapshotModule.kt +128 -0
- package/ios/{MLRN/MLRNModule.m → MLRNModule.m} +0 -26
- package/ios/MLRNSnapshotModule/MLRNSnapshotModule.h +4 -0
- package/ios/MLRNSnapshotModule/MLRNSnapshotModule.mm +78 -0
- package/ios/{MLRN/MLRNUtils.h → MLRNUtils.h} +1 -2
- package/lib/commonjs/MLRNModule.js +1 -5
- package/lib/commonjs/MLRNModule.js.map +1 -1
- package/lib/commonjs/MapLibreRN.js +0 -21
- package/lib/commonjs/MapLibreRN.js.map +1 -1
- package/lib/commonjs/components/MapView.js +1 -1
- package/lib/commonjs/components/MapView.js.map +1 -1
- package/lib/commonjs/components/PointAnnotation.js +1 -1
- package/lib/commonjs/components/PointAnnotation.js.map +1 -1
- package/lib/commonjs/components/ShapeSource.js +1 -1
- package/lib/commonjs/components/ShapeSource.js.map +1 -1
- package/lib/commonjs/hooks/useNativeRef.js.map +1 -1
- package/lib/commonjs/index.js +4 -12
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modules/snapshot/NativeSnapshotModule.js +9 -0
- package/lib/commonjs/modules/snapshot/NativeSnapshotModule.js.map +1 -0
- package/lib/commonjs/modules/snapshot/SnapshotManager.js +2 -4
- package/lib/commonjs/modules/snapshot/SnapshotManager.js.map +1 -1
- package/lib/commonjs/modules/snapshot/SnapshotOptions.js +4 -4
- package/lib/commonjs/modules/snapshot/SnapshotOptions.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/utils/animated/AnimatedRouteCoordinatesArray.js +1 -7
- package/lib/commonjs/utils/animated/AnimatedRouteCoordinatesArray.js.map +1 -1
- package/lib/module/MLRNModule.js +0 -2
- package/lib/module/MLRNModule.js.map +1 -1
- package/lib/module/MapLibreRN.js +3 -15
- package/lib/module/MapLibreRN.js.map +1 -1
- package/lib/module/components/MapView.js +1 -1
- package/lib/module/components/MapView.js.map +1 -1
- package/lib/module/components/PointAnnotation.js +1 -1
- package/lib/module/components/PointAnnotation.js.map +1 -1
- package/lib/module/components/ShapeSource.js +1 -1
- package/lib/module/components/ShapeSource.js.map +1 -1
- package/lib/module/hooks/useNativeRef.js.map +1 -1
- package/lib/module/index.js +0 -6
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/snapshot/NativeSnapshotModule.js +5 -0
- package/lib/module/modules/snapshot/NativeSnapshotModule.js.map +1 -0
- package/lib/module/modules/snapshot/SnapshotManager.js +2 -3
- package/lib/module/modules/snapshot/SnapshotManager.js.map +1 -1
- package/lib/module/modules/snapshot/SnapshotOptions.js +4 -4
- package/lib/module/modules/snapshot/SnapshotOptions.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/utils/animated/AnimatedRouteCoordinatesArray.js +1 -7
- package/lib/module/utils/animated/AnimatedRouteCoordinatesArray.js.map +1 -1
- package/lib/typescript/commonjs/src/MLRNModule.d.ts +1 -1
- package/lib/typescript/commonjs/src/MLRNModule.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/MapLibreRN.d.ts +3 -15
- package/lib/typescript/commonjs/src/MapLibreRN.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Camera.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/Camera.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/MapView.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/MapView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/ShapeSource.d.ts +2 -2
- package/lib/typescript/commonjs/src/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/UserLocation.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/UserLocation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/VectorSource.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/VectorSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useNativeRef.d.ts +1 -1
- package/lib/typescript/commonjs/src/hooks/useNativeRef.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +0 -5
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/snapshot/NativeSnapshotModule.d.ts +18 -0
- package/lib/typescript/commonjs/src/modules/snapshot/NativeSnapshotModule.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/snapshot/SnapshotManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/snapshot/SnapshotOptions.d.ts +5 -25
- package/lib/typescript/commonjs/src/modules/snapshot/SnapshotOptions.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/Animated.d.ts +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts +0 -4
- package/lib/typescript/commonjs/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts.map +1 -1
- package/lib/typescript/module/src/MLRNModule.d.ts +1 -1
- package/lib/typescript/module/src/MLRNModule.d.ts.map +1 -1
- package/lib/typescript/module/src/MapLibreRN.d.ts +3 -15
- package/lib/typescript/module/src/MapLibreRN.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Camera.d.ts +1 -1
- package/lib/typescript/module/src/components/Camera.d.ts.map +1 -1
- package/lib/typescript/module/src/components/MapView.d.ts +1 -1
- package/lib/typescript/module/src/components/MapView.d.ts.map +1 -1
- package/lib/typescript/module/src/components/ShapeSource.d.ts +2 -2
- package/lib/typescript/module/src/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/module/src/components/UserLocation.d.ts +1 -1
- package/lib/typescript/module/src/components/UserLocation.d.ts.map +1 -1
- package/lib/typescript/module/src/components/VectorSource.d.ts +1 -1
- package/lib/typescript/module/src/components/VectorSource.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useNativeRef.d.ts +1 -1
- package/lib/typescript/module/src/hooks/useNativeRef.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +0 -5
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/snapshot/NativeSnapshotModule.d.ts +18 -0
- package/lib/typescript/module/src/modules/snapshot/NativeSnapshotModule.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/snapshot/SnapshotManager.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/snapshot/SnapshotOptions.d.ts +5 -25
- package/lib/typescript/module/src/modules/snapshot/SnapshotOptions.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/Animated.d.ts +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts +0 -4
- package/lib/typescript/module/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts.map +1 -1
- package/package.json +20 -12
- package/src/MLRNModule.ts +0 -14
- package/src/MapLibreRN.ts +2 -18
- package/src/components/MapView.tsx +1 -1
- package/src/components/PointAnnotation.tsx +1 -1
- package/src/components/ShapeSource.tsx +2 -2
- package/src/hooks/useNativeRef.ts +3 -3
- package/src/index.ts +0 -6
- package/src/modules/snapshot/NativeSnapshotModule.ts +24 -0
- package/src/modules/snapshot/SnapshotManager.ts +3 -6
- package/src/modules/snapshot/SnapshotOptions.ts +10 -27
- package/src/utils/animated/AnimatedRouteCoordinatesArray.ts +1 -14
- package/android/src/main/AndroidManifestNew.xml +0 -5
- package/android/src/main/java/org/maplibre/reactnative/MLRNPackage.java +0 -90
- package/android/src/main/java/org/maplibre/reactnative/modules/MLRNSnapshotModule.java +0 -135
- package/ios/MLRN/MLRNSnapshotModule.h +0 -5
- package/ios/MLRN/MLRNSnapshotModule.m +0 -70
- package/ios/MLRN.xcodeproj/project.pbxproj +0 -1
- /package/ios/{MLRN/CameraMode.h → CameraMode.h} +0 -0
- /package/ios/{MLRN/CameraMode.m → CameraMode.m} +0 -0
- /package/ios/{MLRN/CameraStop.h → CameraStop.h} +0 -0
- /package/ios/{MLRN/CameraStop.m → CameraStop.m} +0 -0
- /package/ios/{MLRN/CameraUpdateItem.h → CameraUpdateItem.h} +0 -0
- /package/ios/{MLRN/CameraUpdateItem.m → CameraUpdateItem.m} +0 -0
- /package/ios/{MLRN/CameraUpdateQueue.h → CameraUpdateQueue.h} +0 -0
- /package/ios/{MLRN/CameraUpdateQueue.m → CameraUpdateQueue.m} +0 -0
- /package/ios/{MLRN/FilterParser.h → FilterParser.h} +0 -0
- /package/ios/{MLRN/FilterParser.m → FilterParser.m} +0 -0
- /package/ios/{MLRN/MLRN.h → MLRN.h} +0 -0
- /package/ios/{MLRN/MLRN.m → MLRN.m} +0 -0
- /package/ios/{MLRN/MLRNBackgroundLayer.h → MLRNBackgroundLayer.h} +0 -0
- /package/ios/{MLRN/MLRNBackgroundLayer.m → MLRNBackgroundLayer.m} +0 -0
- /package/ios/{MLRN/MLRNBackgroundLayerManager.h → MLRNBackgroundLayerManager.h} +0 -0
- /package/ios/{MLRN/MLRNBackgroundLayerManager.m → MLRNBackgroundLayerManager.m} +0 -0
- /package/ios/{MLRN/MLRNCallout.h → MLRNCallout.h} +0 -0
- /package/ios/{MLRN/MLRNCallout.m → MLRNCallout.m} +0 -0
- /package/ios/{MLRN/MLRNCalloutManager.h → MLRNCalloutManager.h} +0 -0
- /package/ios/{MLRN/MLRNCalloutManager.m → MLRNCalloutManager.m} +0 -0
- /package/ios/{MLRN/MLRNCamera.h → MLRNCamera.h} +0 -0
- /package/ios/{MLRN/MLRNCamera.m → MLRNCamera.m} +0 -0
- /package/ios/{MLRN/MLRNCameraManager.h → MLRNCameraManager.h} +0 -0
- /package/ios/{MLRN/MLRNCameraManager.m → MLRNCameraManager.m} +0 -0
- /package/ios/{MLRN/MLRNCircleLayer.h → MLRNCircleLayer.h} +0 -0
- /package/ios/{MLRN/MLRNCircleLayer.m → MLRNCircleLayer.m} +0 -0
- /package/ios/{MLRN/MLRNCircleLayerManager.h → MLRNCircleLayerManager.h} +0 -0
- /package/ios/{MLRN/MLRNCircleLayerManager.m → MLRNCircleLayerManager.m} +0 -0
- /package/ios/{MLRN/MLRNCustomHeaders.h → MLRNCustomHeaders.h} +0 -0
- /package/ios/{MLRN/MLRNCustomHeaders.m → MLRNCustomHeaders.m} +0 -0
- /package/ios/{MLRN/MLRNEvent.h → MLRNEvent.h} +0 -0
- /package/ios/{MLRN/MLRNEvent.m → MLRNEvent.m} +0 -0
- /package/ios/{MLRN/MLRNEventProtocol.h → MLRNEventProtocol.h} +0 -0
- /package/ios/{MLRN/MLRNEventTypes.h → MLRNEventTypes.h} +0 -0
- /package/ios/{MLRN/MLRNEventTypes.m → MLRNEventTypes.m} +0 -0
- /package/ios/{MLRN/MLRNFillExtrusionLayer.h → MLRNFillExtrusionLayer.h} +0 -0
- /package/ios/{MLRN/MLRNFillExtrusionLayer.m → MLRNFillExtrusionLayer.m} +0 -0
- /package/ios/{MLRN/MLRNFillExtrusionLayerManager.h → MLRNFillExtrusionLayerManager.h} +0 -0
- /package/ios/{MLRN/MLRNFillExtrusionLayerManager.m → MLRNFillExtrusionLayerManager.m} +0 -0
- /package/ios/{MLRN/MLRNFillLayer.h → MLRNFillLayer.h} +0 -0
- /package/ios/{MLRN/MLRNFillLayer.m → MLRNFillLayer.m} +0 -0
- /package/ios/{MLRN/MLRNFillLayerManager.h → MLRNFillLayerManager.h} +0 -0
- /package/ios/{MLRN/MLRNFillLayerManager.m → MLRNFillLayerManager.m} +0 -0
- /package/ios/{MLRN/MLRNHeatmapLayer.h → MLRNHeatmapLayer.h} +0 -0
- /package/ios/{MLRN/MLRNHeatmapLayer.m → MLRNHeatmapLayer.m} +0 -0
- /package/ios/{MLRN/MLRNHeatmapLayerManager.h → MLRNHeatmapLayerManager.h} +0 -0
- /package/ios/{MLRN/MLRNHeatmapLayerManager.m → MLRNHeatmapLayerManager.m} +0 -0
- /package/ios/{MLRN/MLRNImageQueue.h → MLRNImageQueue.h} +0 -0
- /package/ios/{MLRN/MLRNImageQueue.m → MLRNImageQueue.m} +0 -0
- /package/ios/{MLRN/MLRNImageQueueOperation.h → MLRNImageQueueOperation.h} +0 -0
- /package/ios/{MLRN/MLRNImageQueueOperation.m → MLRNImageQueueOperation.m} +0 -0
- /package/ios/{MLRN/MLRNImageSource.h → MLRNImageSource.h} +0 -0
- /package/ios/{MLRN/MLRNImageSource.m → MLRNImageSource.m} +0 -0
- /package/ios/{MLRN/MLRNImageSourceManager.h → MLRNImageSourceManager.h} +0 -0
- /package/ios/{MLRN/MLRNImageSourceManager.m → MLRNImageSourceManager.m} +0 -0
- /package/ios/{MLRN/MLRNImageUtils.h → MLRNImageUtils.h} +0 -0
- /package/ios/{MLRN/MLRNImageUtils.m → MLRNImageUtils.m} +0 -0
- /package/ios/{MLRN/MLRNImages.h → MLRNImages.h} +0 -0
- /package/ios/{MLRN/MLRNImages.m → MLRNImages.m} +0 -0
- /package/ios/{MLRN/MLRNImagesManager.h → MLRNImagesManager.h} +0 -0
- /package/ios/{MLRN/MLRNImagesManager.m → MLRNImagesManager.m} +0 -0
- /package/ios/{MLRN/MLRNLayer.h → MLRNLayer.h} +0 -0
- /package/ios/{MLRN/MLRNLayer.m → MLRNLayer.m} +0 -0
- /package/ios/{MLRN/MLRNLight.h → MLRNLight.h} +0 -0
- /package/ios/{MLRN/MLRNLight.m → MLRNLight.m} +0 -0
- /package/ios/{MLRN/MLRNLightManager.h → MLRNLightManager.h} +0 -0
- /package/ios/{MLRN/MLRNLightManager.m → MLRNLightManager.m} +0 -0
- /package/ios/{MLRN/MLRNLineLayer.h → MLRNLineLayer.h} +0 -0
- /package/ios/{MLRN/MLRNLineLayer.m → MLRNLineLayer.m} +0 -0
- /package/ios/{MLRN/MLRNLineLayerManager.h → MLRNLineLayerManager.h} +0 -0
- /package/ios/{MLRN/MLRNLineLayerManager.m → MLRNLineLayerManager.m} +0 -0
- /package/ios/{MLRN/MLRNLocation.h → MLRNLocation.h} +0 -0
- /package/ios/{MLRN/MLRNLocation.m → MLRNLocation.m} +0 -0
- /package/ios/{MLRN/MLRNLocationManager.h → MLRNLocationManager.h} +0 -0
- /package/ios/{MLRN/MLRNLocationManager.m → MLRNLocationManager.m} +0 -0
- /package/ios/{MLRN/MLRNLocationManagerDelegate.h → MLRNLocationManagerDelegate.h} +0 -0
- /package/ios/{MLRN/MLRNLocationModule.h → MLRNLocationModule.h} +0 -0
- /package/ios/{MLRN/MLRNLocationModule.m → MLRNLocationModule.m} +0 -0
- /package/ios/{MLRN/MLRNLogging.h → MLRNLogging.h} +0 -0
- /package/ios/{MLRN/MLRNLogging.m → MLRNLogging.m} +0 -0
- /package/ios/{MLRN/MLRNMapTouchEvent.h → MLRNMapTouchEvent.h} +0 -0
- /package/ios/{MLRN/MLRNMapTouchEvent.m → MLRNMapTouchEvent.m} +0 -0
- /package/ios/{MLRN/MLRNMapView.h → MLRNMapView.h} +0 -0
- /package/ios/{MLRN/MLRNMapView.m → MLRNMapView.m} +0 -0
- /package/ios/{MLRN/MLRNMapViewManager.h → MLRNMapViewManager.h} +0 -0
- /package/ios/{MLRN/MLRNMapViewManager.m → MLRNMapViewManager.m} +0 -0
- /package/ios/{MLRN/MLRNModule.h → MLRNModule.h} +0 -0
- /package/ios/{MLRN/MLRNNativeUserLocation.h → MLRNNativeUserLocation.h} +0 -0
- /package/ios/{MLRN/MLRNNativeUserLocation.m → MLRNNativeUserLocation.m} +0 -0
- /package/ios/{MLRN/MLRNNativeUserLocationManager.h → MLRNNativeUserLocationManager.h} +0 -0
- /package/ios/{MLRN/MLRNNativeUserLocationManager.m → MLRNNativeUserLocationManager.m} +0 -0
- /package/ios/{MLRN/MLRNOfflineModule.h → MLRNOfflineModule.h} +0 -0
- /package/ios/{MLRN/MLRNOfflineModule.m → MLRNOfflineModule.m} +0 -0
- /package/ios/{MLRN/MLRNPointAnnotation.h → MLRNPointAnnotation.h} +0 -0
- /package/ios/{MLRN/MLRNPointAnnotation.m → MLRNPointAnnotation.m} +0 -0
- /package/ios/{MLRN/MLRNPointAnnotationManager.h → MLRNPointAnnotationManager.h} +0 -0
- /package/ios/{MLRN/MLRNPointAnnotationManager.m → MLRNPointAnnotationManager.m} +0 -0
- /package/ios/{MLRN/MLRNRasterLayer.h → MLRNRasterLayer.h} +0 -0
- /package/ios/{MLRN/MLRNRasterLayer.m → MLRNRasterLayer.m} +0 -0
- /package/ios/{MLRN/MLRNRasterLayerManager.h → MLRNRasterLayerManager.h} +0 -0
- /package/ios/{MLRN/MLRNRasterLayerManager.m → MLRNRasterLayerManager.m} +0 -0
- /package/ios/{MLRN/MLRNRasterSource.h → MLRNRasterSource.h} +0 -0
- /package/ios/{MLRN/MLRNRasterSource.m → MLRNRasterSource.m} +0 -0
- /package/ios/{MLRN/MLRNRasterSourceManager.h → MLRNRasterSourceManager.h} +0 -0
- /package/ios/{MLRN/MLRNRasterSourceManager.m → MLRNRasterSourceManager.m} +0 -0
- /package/ios/{MLRN/MLRNShapeSource.h → MLRNShapeSource.h} +0 -0
- /package/ios/{MLRN/MLRNShapeSource.m → MLRNShapeSource.m} +0 -0
- /package/ios/{MLRN/MLRNShapeSourceManager.h → MLRNShapeSourceManager.h} +0 -0
- /package/ios/{MLRN/MLRNShapeSourceManager.m → MLRNShapeSourceManager.m} +0 -0
- /package/ios/{MLRN/MLRNSource.h → MLRNSource.h} +0 -0
- /package/ios/{MLRN/MLRNSource.m → MLRNSource.m} +0 -0
- /package/ios/{MLRN/MLRNStyle.h → MLRNStyle.h} +0 -0
- /package/ios/{MLRN/MLRNStyle.m → MLRNStyle.m} +0 -0
- /package/ios/{MLRN/MLRNStyleValue.h → MLRNStyleValue.h} +0 -0
- /package/ios/{MLRN/MLRNStyleValue.m → MLRNStyleValue.m} +0 -0
- /package/ios/{MLRN/MLRNSymbolLayer.h → MLRNSymbolLayer.h} +0 -0
- /package/ios/{MLRN/MLRNSymbolLayer.m → MLRNSymbolLayer.m} +0 -0
- /package/ios/{MLRN/MLRNSymbolLayerManager.h → MLRNSymbolLayerManager.h} +0 -0
- /package/ios/{MLRN/MLRNSymbolLayerManager.m → MLRNSymbolLayerManager.m} +0 -0
- /package/ios/{MLRN/MLRNTileSource.h → MLRNTileSource.h} +0 -0
- /package/ios/{MLRN/MLRNTileSource.m → MLRNTileSource.m} +0 -0
- /package/ios/{MLRN/MLRNUserLocation.h → MLRNUserLocation.h} +0 -0
- /package/ios/{MLRN/MLRNUserLocation.m → MLRNUserLocation.m} +0 -0
- /package/ios/{MLRN/MLRNUtils.m → MLRNUtils.m} +0 -0
- /package/ios/{MLRN/MLRNVectorLayer.h → MLRNVectorLayer.h} +0 -0
- /package/ios/{MLRN/MLRNVectorLayer.m → MLRNVectorLayer.m} +0 -0
- /package/ios/{MLRN/MLRNVectorSource.h → MLRNVectorSource.h} +0 -0
- /package/ios/{MLRN/MLRNVectorSource.m → MLRNVectorSource.m} +0 -0
- /package/ios/{MLRN/MLRNVectorSourceManager.h → MLRNVectorSourceManager.h} +0 -0
- /package/ios/{MLRN/MLRNVectorSourceManager.m → MLRNVectorSourceManager.m} +0 -0
- /package/ios/{MLRN/ViewManager.h → ViewManager.h} +0 -0
- /package/ios/{MLRN/ViewManager.m → ViewManager.m} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "json"
|
|
2
2
|
|
|
3
|
-
package = JSON.parse(File.read(File.join(__dir__,
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
4
|
|
|
5
5
|
# Global Variable Defaults
|
|
6
6
|
$MLRN_NATIVE_VERSION ||= "6.11.0"
|
|
@@ -40,7 +40,7 @@ def $MLRN.post_install(installer)
|
|
|
40
40
|
project = installer.pods_project
|
|
41
41
|
self._add_spm_to_target(
|
|
42
42
|
project,
|
|
43
|
-
project.targets.find { |t| t.name == "
|
|
43
|
+
project.targets.find { |t| t.name == "MapLibreReactNative"},
|
|
44
44
|
spm_spec[:url],
|
|
45
45
|
spm_spec[:requirement],
|
|
46
46
|
spm_spec[:product_name]
|
|
@@ -62,19 +62,18 @@ def $MLRN.post_install(installer)
|
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
Pod::Spec.new do |s|
|
|
65
|
-
s.name
|
|
66
|
-
s.
|
|
67
|
-
s.
|
|
68
|
-
s.
|
|
69
|
-
s.
|
|
70
|
-
s.
|
|
71
|
-
s.license = "MIT"
|
|
72
|
-
s.platform = :ios, "8.0"
|
|
65
|
+
s.name = "MapLibreReactNative"
|
|
66
|
+
s.version = package["version"]
|
|
67
|
+
s.summary = package["description"]
|
|
68
|
+
s.homepage = package["homepage"]
|
|
69
|
+
s.license = package["license"]
|
|
70
|
+
s.authors = package["author"]
|
|
73
71
|
|
|
74
|
-
s.
|
|
75
|
-
s.
|
|
72
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
73
|
+
s.source = { :git => "https://github.com/maplibre/maplibre-react-native.git", :tag => "#{s.version}" }
|
|
76
74
|
|
|
77
|
-
s.
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
s.source_files = "ios/**/*.{h,m,mm,cpp}"
|
|
76
|
+
s.private_header_files = "ios/**/*.h"
|
|
77
|
+
|
|
78
|
+
install_modules_dependencies(s)
|
|
80
79
|
end
|
package/android/build.gradle
CHANGED
|
@@ -1,145 +1,124 @@
|
|
|
1
1
|
buildscript {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
repositories {
|
|
6
|
-
google()
|
|
7
|
-
mavenCentral()
|
|
8
|
-
}
|
|
2
|
+
ext.getExtOrDefault = { name ->
|
|
3
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['org.maplibre.reactnative.' + name]
|
|
4
|
+
}
|
|
9
5
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
}
|
|
6
|
+
repositories {
|
|
7
|
+
google()
|
|
8
|
+
mavenCentral()
|
|
9
|
+
}
|
|
16
10
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
dependencies {
|
|
12
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
13
|
+
// noinspection DifferentKotlinGradleVersion
|
|
14
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
15
|
+
}
|
|
20
16
|
}
|
|
21
17
|
|
|
22
|
-
def isNewArchitectureEnabled() {
|
|
23
|
-
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
24
|
-
}
|
|
25
18
|
|
|
26
19
|
apply plugin: "com.android.library"
|
|
27
20
|
apply plugin: "kotlin-android"
|
|
28
21
|
|
|
29
|
-
|
|
30
|
-
// if (isNewArchitectureEnabled()) {
|
|
31
|
-
// apply plugin: "com.facebook.react"
|
|
32
|
-
// }
|
|
33
|
-
|
|
34
|
-
def getExtOrDefault(name) {
|
|
35
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["org.maplibre.reactnative." + name]
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
def getConfigurableExtOrDefault(name) {
|
|
39
|
-
return rootProject.ext.has("org.maplibre.reactnative." + name) ? rootProject.ext.get("org.maplibre.reactnative." + name) : project.properties["org.maplibre.reactnative." + name]
|
|
40
|
-
}
|
|
22
|
+
apply plugin: "com.facebook.react"
|
|
41
23
|
|
|
42
24
|
def getExtOrIntegerDefault(name) {
|
|
43
|
-
|
|
25
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["org.maplibre.reactnative." + name]).toInteger()
|
|
44
26
|
}
|
|
45
27
|
|
|
46
|
-
def
|
|
47
|
-
|
|
48
|
-
def major = parsed[0].toInteger()
|
|
49
|
-
def minor = parsed[1].toInteger()
|
|
50
|
-
|
|
51
|
-
// Namespace support was added in 7.3.0
|
|
52
|
-
return (major == 7 && minor >= 3) || major >= 8
|
|
28
|
+
def getConfigurableExtOrDefault(name) {
|
|
29
|
+
return rootProject.ext.has("org.maplibre.reactnative." + name) ? rootProject.ext.get("org.maplibre.reactnative." + name) : project.properties["org.maplibre.reactnative." + name]
|
|
53
30
|
}
|
|
54
31
|
|
|
55
32
|
android {
|
|
56
|
-
if (supportsNamespace()) {
|
|
57
33
|
namespace "org.maplibre.reactnative"
|
|
58
34
|
|
|
59
|
-
|
|
60
|
-
main {
|
|
61
|
-
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
35
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
67
36
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
73
|
-
}
|
|
37
|
+
defaultConfig {
|
|
38
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
39
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
40
|
+
}
|
|
74
41
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
42
|
+
buildFeatures {
|
|
43
|
+
buildConfig true
|
|
44
|
+
}
|
|
78
45
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
} else {
|
|
84
|
-
throw new GradleException("org.maplibre.reactnative.locationEngine.locationEngine should be one of [\"default\", \"google\"]`. \"${getConfigurableExtOrDefault("locationEngine")}\" was provided.")
|
|
85
|
-
}
|
|
46
|
+
buildTypes {
|
|
47
|
+
release {
|
|
48
|
+
minifyEnabled false
|
|
49
|
+
}
|
|
86
50
|
}
|
|
87
|
-
}
|
|
88
51
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
minifyEnabled false
|
|
52
|
+
lintOptions {
|
|
53
|
+
disable "GradleCompatible"
|
|
92
54
|
}
|
|
93
|
-
}
|
|
94
55
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
56
|
+
compileOptions {
|
|
57
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
58
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
59
|
+
}
|
|
98
60
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
61
|
+
sourceSets {
|
|
62
|
+
main {
|
|
63
|
+
java.srcDirs = ['src/main/java']
|
|
64
|
+
|
|
65
|
+
if (getConfigurableExtOrDefault("locationEngine") == "default") {
|
|
66
|
+
java.srcDirs += 'src/main/location-engine-default'
|
|
67
|
+
} else if (getConfigurableExtOrDefault("locationEngine") == "google") {
|
|
68
|
+
java.srcDirs += 'src/main/location-engine-google'
|
|
69
|
+
} else {
|
|
70
|
+
throw new GradleException("org.maplibre.reactnative.locationEngine.locationEngine should be one of [\"default\", \"google\"]`. \"${getConfigurableExtOrDefault("locationEngine")}\" was provided.")
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
java.srcDirs += [
|
|
74
|
+
"generated/java",
|
|
75
|
+
"generated/jni"
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
103
79
|
}
|
|
104
80
|
|
|
105
81
|
repositories {
|
|
106
|
-
|
|
107
|
-
|
|
82
|
+
mavenCentral()
|
|
83
|
+
google()
|
|
108
84
|
}
|
|
109
85
|
|
|
110
86
|
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
111
87
|
|
|
112
88
|
dependencies {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
89
|
+
implementation "com.facebook.react:react-android"
|
|
90
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
91
|
+
|
|
92
|
+
// MapLibre Native
|
|
93
|
+
implementation "org.maplibre.gl:android-sdk-${getConfigurableExtOrDefault('nativeVariant')}:${getConfigurableExtOrDefault('nativeVersion')}"
|
|
94
|
+
|
|
95
|
+
// MapLibre Plugins
|
|
96
|
+
implementation("org.maplibre.gl:android-plugin-localization-v9:${getConfigurableExtOrDefault('pluginVersion')}") {
|
|
97
|
+
exclude(group: "org.maplibre.gl", module: "android-sdk")
|
|
98
|
+
}
|
|
99
|
+
implementation("org.maplibre.gl:android-plugin-annotation-v9:${getConfigurableExtOrDefault('pluginVersion')}") {
|
|
100
|
+
exclude(group: "org.maplibre.gl", module: "android-sdk")
|
|
101
|
+
}
|
|
102
|
+
implementation("org.maplibre.gl:android-plugin-markerview-v9:${getConfigurableExtOrDefault('pluginVersion')}") {
|
|
103
|
+
exclude(group: "org.maplibre.gl", module: "android-sdk")
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Dependencies
|
|
107
|
+
implementation "org.maplibre.gl:android-sdk-turf:${getConfigurableExtOrDefault('turfVersion')}"
|
|
108
|
+
implementation "com.squareup.okhttp3:okhttp:${getConfigurableExtOrDefault('okhttpVersion')}"
|
|
109
|
+
implementation "com.squareup.okhttp3:okhttp-urlconnection:${getConfigurableExtOrDefault('okhttpVersion')}"
|
|
110
|
+
implementation "androidx.vectordrawable:vectordrawable:1.1.0"
|
|
111
|
+
implementation "androidx.annotation:annotation:1.7.0"
|
|
112
|
+
implementation "androidx.appcompat:appcompat:1.6.1"
|
|
113
|
+
|
|
114
|
+
// Dependencies for Google Location Engine
|
|
115
|
+
if (getConfigurableExtOrDefault("locationEngine") == "google") {
|
|
116
|
+
implementation "com.google.android.gms:play-services-location:${getConfigurableExtOrDefault('googlePlayServicesLocationVersion')}"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
react {
|
|
121
|
+
jsRootDir = file("../src/")
|
|
122
|
+
libraryName = "MapLibreReactNative"
|
|
123
|
+
codegenJavaPackageName = "org.maplibre.reactnative"
|
|
145
124
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
org.maplibre.reactnative.kotlinVersion=
|
|
2
|
-
org.maplibre.reactnative.minSdkVersion=
|
|
3
|
-
org.maplibre.reactnative.targetSdkVersion=
|
|
4
|
-
org.maplibre.reactnative.compileSdkVersion=
|
|
5
|
-
org.maplibre.reactnative.ndkVersion=
|
|
1
|
+
org.maplibre.reactnative.kotlinVersion=2.0.21
|
|
2
|
+
org.maplibre.reactnative.minSdkVersion=24
|
|
3
|
+
org.maplibre.reactnative.targetSdkVersion=34
|
|
4
|
+
org.maplibre.reactnative.compileSdkVersion=35
|
|
5
|
+
org.maplibre.reactnative.ndkVersion=27.1.12297006
|
|
6
6
|
|
|
7
7
|
# MapLibre React Native
|
|
8
8
|
org.maplibre.reactnative.nativeVersion=11.8.1
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
-
package="org.maplibre.reactnative">
|
|
3
|
-
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
4
2
|
<uses-permission android:name="android.permission.INTERNET" />
|
|
5
3
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
6
4
|
</manifest>
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
package org.maplibre.reactnative
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.BaseReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
7
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
8
|
+
import com.facebook.react.uimanager.ViewManager
|
|
9
|
+
import org.maplibre.reactnative.components.annotation.MLRNCalloutManager
|
|
10
|
+
import org.maplibre.reactnative.components.annotation.MLRNMarkerViewManager
|
|
11
|
+
import org.maplibre.reactnative.components.annotation.MLRNPointAnnotationManager
|
|
12
|
+
import org.maplibre.reactnative.components.camera.MLRNCameraManager
|
|
13
|
+
import org.maplibre.reactnative.components.images.MLRNImagesManager
|
|
14
|
+
import org.maplibre.reactnative.components.location.MLRNNativeUserLocationManager
|
|
15
|
+
import org.maplibre.reactnative.components.mapview.MLRNAndroidTextureMapViewManager
|
|
16
|
+
import org.maplibre.reactnative.components.mapview.MLRNMapViewManager
|
|
17
|
+
import org.maplibre.reactnative.components.styles.layers.MLRNBackgroundLayerManager
|
|
18
|
+
import org.maplibre.reactnative.components.styles.layers.MLRNCircleLayerManager
|
|
19
|
+
import org.maplibre.reactnative.components.styles.layers.MLRNFillExtrusionLayerManager
|
|
20
|
+
import org.maplibre.reactnative.components.styles.layers.MLRNFillLayerManager
|
|
21
|
+
import org.maplibre.reactnative.components.styles.layers.MLRNHeatmapLayerManager
|
|
22
|
+
import org.maplibre.reactnative.components.styles.layers.MLRNLineLayerManager
|
|
23
|
+
import org.maplibre.reactnative.components.styles.layers.MLRNRasterLayerManager
|
|
24
|
+
import org.maplibre.reactnative.components.styles.layers.MLRNSymbolLayerManager
|
|
25
|
+
import org.maplibre.reactnative.components.styles.light.MLRNLightManager
|
|
26
|
+
import org.maplibre.reactnative.components.styles.sources.MLRNImageSourceManager
|
|
27
|
+
import org.maplibre.reactnative.components.styles.sources.MLRNRasterSourceManager
|
|
28
|
+
import org.maplibre.reactnative.components.styles.sources.MLRNShapeSourceManager
|
|
29
|
+
import org.maplibre.reactnative.components.styles.sources.MLRNVectorSourceManager
|
|
30
|
+
import org.maplibre.reactnative.modules.MLRNLocationModule
|
|
31
|
+
import org.maplibre.reactnative.modules.MLRNLogging
|
|
32
|
+
import org.maplibre.reactnative.modules.MLRNModule
|
|
33
|
+
import org.maplibre.reactnative.modules.MLRNOfflineModule
|
|
34
|
+
import org.maplibre.reactnative.modules.MLRNSnapshotModule
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class MLRNPackage : BaseReactPackage() {
|
|
38
|
+
override fun getModule(
|
|
39
|
+
name: String,
|
|
40
|
+
reactContext: ReactApplicationContext
|
|
41
|
+
): NativeModule? {
|
|
42
|
+
when (name) {
|
|
43
|
+
MLRNModule.REACT_CLASS -> return MLRNModule(reactContext)
|
|
44
|
+
MLRNOfflineModule.REACT_CLASS -> return MLRNOfflineModule(reactContext)
|
|
45
|
+
MLRNSnapshotModule.NAME -> return MLRNSnapshotModule(reactContext)
|
|
46
|
+
MLRNLocationModule.REACT_CLASS -> return MLRNLocationModule(reactContext)
|
|
47
|
+
MLRNLogging.REACT_CLASS -> return MLRNLogging(reactContext)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return null
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
54
|
+
return ReactModuleInfoProvider {
|
|
55
|
+
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
|
|
56
|
+
|
|
57
|
+
moduleInfos[MLRNModule.REACT_CLASS] = ReactModuleInfo(
|
|
58
|
+
MLRNModule.REACT_CLASS,
|
|
59
|
+
MLRNModule.REACT_CLASS,
|
|
60
|
+
false, // canOverrideExistingModule
|
|
61
|
+
false, // needsEagerInit
|
|
62
|
+
true, // hasConstants
|
|
63
|
+
false, // isCxxModule
|
|
64
|
+
false // isTurboModule
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
moduleInfos[MLRNOfflineModule.REACT_CLASS] = ReactModuleInfo(
|
|
68
|
+
MLRNOfflineModule.REACT_CLASS,
|
|
69
|
+
MLRNOfflineModule.REACT_CLASS,
|
|
70
|
+
false, // canOverrideExistingModule
|
|
71
|
+
false, // needsEagerInit
|
|
72
|
+
true, // hasConstants
|
|
73
|
+
false, // isCxxModule
|
|
74
|
+
false // isTurboModule
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
moduleInfos[MLRNSnapshotModule.NAME] = ReactModuleInfo(
|
|
78
|
+
MLRNSnapshotModule.NAME,
|
|
79
|
+
MLRNSnapshotModule.NAME,
|
|
80
|
+
false, // canOverrideExistingModule
|
|
81
|
+
false, // needsEagerInit
|
|
82
|
+
false, // isCxxModule
|
|
83
|
+
true // isTurboModule
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
moduleInfos[MLRNLocationModule.REACT_CLASS] = ReactModuleInfo(
|
|
87
|
+
MLRNLocationModule.REACT_CLASS,
|
|
88
|
+
MLRNLocationModule.REACT_CLASS,
|
|
89
|
+
false, // canOverrideExistingModule
|
|
90
|
+
false, // needsEagerInit
|
|
91
|
+
true, // hasConstants
|
|
92
|
+
false, // isCxxModule
|
|
93
|
+
false // isTurboModule
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
moduleInfos[MLRNLogging.REACT_CLASS] = ReactModuleInfo(
|
|
97
|
+
MLRNLogging.REACT_CLASS,
|
|
98
|
+
MLRNLogging.REACT_CLASS,
|
|
99
|
+
false, // canOverrideExistingModule
|
|
100
|
+
false, // needsEagerInit
|
|
101
|
+
true, // hasConstants
|
|
102
|
+
false, // isCxxModule
|
|
103
|
+
false // isTurboModule
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
moduleInfos
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
111
|
+
val managers: MutableList<ViewManager<*, *>> = ArrayList()
|
|
112
|
+
|
|
113
|
+
// components
|
|
114
|
+
managers.add(MLRNCameraManager(reactContext))
|
|
115
|
+
managers.add(MLRNMapViewManager(reactContext))
|
|
116
|
+
managers.add(MLRNMarkerViewManager(reactContext))
|
|
117
|
+
managers.add(MLRNAndroidTextureMapViewManager(reactContext))
|
|
118
|
+
managers.add(MLRNLightManager())
|
|
119
|
+
managers.add(MLRNPointAnnotationManager(reactContext))
|
|
120
|
+
managers.add(MLRNCalloutManager())
|
|
121
|
+
managers.add(MLRNNativeUserLocationManager())
|
|
122
|
+
|
|
123
|
+
// sources
|
|
124
|
+
managers.add(MLRNVectorSourceManager(reactContext))
|
|
125
|
+
managers.add(MLRNShapeSourceManager(reactContext))
|
|
126
|
+
managers.add(MLRNRasterSourceManager(reactContext))
|
|
127
|
+
managers.add(MLRNImageSourceManager())
|
|
128
|
+
|
|
129
|
+
// images
|
|
130
|
+
managers.add(MLRNImagesManager(reactContext))
|
|
131
|
+
|
|
132
|
+
// layers
|
|
133
|
+
managers.add(MLRNFillLayerManager())
|
|
134
|
+
managers.add(MLRNFillExtrusionLayerManager())
|
|
135
|
+
managers.add(MLRNHeatmapLayerManager())
|
|
136
|
+
managers.add(MLRNLineLayerManager())
|
|
137
|
+
managers.add(MLRNCircleLayerManager())
|
|
138
|
+
managers.add(MLRNSymbolLayerManager())
|
|
139
|
+
managers.add(MLRNRasterLayerManager())
|
|
140
|
+
managers.add(MLRNBackgroundLayerManager())
|
|
141
|
+
|
|
142
|
+
return managers
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -45,11 +45,7 @@ abstract public class AbstractEventEmitter<T extends ViewGroup> extends ViewGrou
|
|
|
45
45
|
|
|
46
46
|
@Override
|
|
47
47
|
protected void addEventEmitters(ThemedReactContext context, @Nonnull T view) {
|
|
48
|
-
|
|
49
|
-
mEventDispatcher = UIManagerHelper.getUIManager(context, UIManagerType.FABRIC).getEventDispatcher();
|
|
50
|
-
} else {
|
|
51
|
-
mEventDispatcher = context.getNativeModule(UIManagerModule.class).getEventDispatcher();
|
|
52
|
-
}
|
|
48
|
+
mEventDispatcher = UIManagerHelper.getUIManager(context, UIManagerType.FABRIC).getEventDispatcher();
|
|
53
49
|
}
|
|
54
50
|
|
|
55
51
|
@Nullable
|
|
@@ -132,25 +132,6 @@ public class MLRNModule extends ReactContextBaseJavaModule {
|
|
|
132
132
|
.build();
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
/**
|
|
136
|
-
* @deprecated This will be removed in the next major version.
|
|
137
|
-
* @see https://github.com/maplibre/maplibre-react-native/issues/25#issuecomment-1382382044
|
|
138
|
-
*/
|
|
139
|
-
@Deprecated
|
|
140
|
-
@ReactMethod
|
|
141
|
-
public void setAccessToken(final String accessToken) {
|
|
142
|
-
mReactContext.runOnUiQueueThread(new Runnable() {
|
|
143
|
-
@Override
|
|
144
|
-
public void run() {
|
|
145
|
-
if (accessToken == null) {
|
|
146
|
-
MapLibre.getInstance(getReactApplicationContext());
|
|
147
|
-
} else {
|
|
148
|
-
MapLibre.getInstance(getReactApplicationContext(), accessToken, WellKnownTileServer.Mapbox);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
|
|
154
135
|
@ReactMethod
|
|
155
136
|
public void removeCustomHeader(final String headerName) {
|
|
156
137
|
mReactContext.runOnUiQueueThread(new Runnable() {
|
|
@@ -179,21 +160,6 @@ public class MLRNModule extends ReactContextBaseJavaModule {
|
|
|
179
160
|
});
|
|
180
161
|
}
|
|
181
162
|
|
|
182
|
-
/**
|
|
183
|
-
* @deprecated This will be removed in the next major version.
|
|
184
|
-
* @see https://github.com/maplibre/maplibre-react-native/issues/25#issuecomment-1382382044
|
|
185
|
-
*/
|
|
186
|
-
@Deprecated
|
|
187
|
-
@ReactMethod
|
|
188
|
-
public void getAccessToken(Promise promise) {
|
|
189
|
-
String token = MapLibre.getApiKey();
|
|
190
|
-
if(token == null) {
|
|
191
|
-
promise.reject("missing_access_token", "No access token has been set");
|
|
192
|
-
} else {
|
|
193
|
-
promise.resolve(token);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
163
|
@ReactMethod
|
|
198
164
|
public void setConnected(final boolean connected) {
|
|
199
165
|
mReactContext.runOnUiQueueThread(new Runnable() {
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
package org.maplibre.reactnative.modules
|
|
2
|
+
|
|
3
|
+
import android.graphics.Bitmap
|
|
4
|
+
import android.util.Log
|
|
5
|
+
import android.util.TypedValue
|
|
6
|
+
import com.facebook.react.bridge.Promise
|
|
7
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
8
|
+
import com.facebook.react.bridge.ReadableMap
|
|
9
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
10
|
+
import org.maplibre.android.camera.CameraPosition
|
|
11
|
+
import org.maplibre.android.maps.Style
|
|
12
|
+
import org.maplibre.android.snapshotter.MapSnapshot
|
|
13
|
+
import org.maplibre.android.snapshotter.MapSnapshotter
|
|
14
|
+
import org.maplibre.geojson.Feature
|
|
15
|
+
import org.maplibre.geojson.FeatureCollection
|
|
16
|
+
import org.maplibre.geojson.Point
|
|
17
|
+
import org.maplibre.reactnative.NativeSnapshotModuleSpec
|
|
18
|
+
import org.maplibre.reactnative.utils.BitmapUtils
|
|
19
|
+
import org.maplibre.reactnative.utils.GeoJSONUtils
|
|
20
|
+
import java.io.IOException
|
|
21
|
+
import java.io.OutputStream
|
|
22
|
+
import java.util.UUID
|
|
23
|
+
|
|
24
|
+
@ReactModule(name = MLRNSnapshotModule.NAME)
|
|
25
|
+
class MLRNSnapshotModule(reactContext: ReactApplicationContext) :
|
|
26
|
+
NativeSnapshotModuleSpec(reactContext) {
|
|
27
|
+
companion object {
|
|
28
|
+
const val NAME = "MLRNSnapshotModule"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
override fun getName() = NAME
|
|
32
|
+
|
|
33
|
+
private val context: ReactApplicationContext = reactContext
|
|
34
|
+
|
|
35
|
+
// Prevent garbage collection
|
|
36
|
+
private val snapshotterMap: MutableMap<String, MapSnapshotter> =
|
|
37
|
+
HashMap<String, MapSnapshotter>()
|
|
38
|
+
|
|
39
|
+
override fun takeSnap(jsOptions: ReadableMap, promise: Promise) {
|
|
40
|
+
org.maplibre.android.storage.FileSource.getInstance(context).activate()
|
|
41
|
+
|
|
42
|
+
context.runOnUiQueueThread {
|
|
43
|
+
val snapshotterID = UUID.randomUUID().toString()
|
|
44
|
+
val snapshotter: MapSnapshotter = MapSnapshotter(context, getOptions(jsOptions))
|
|
45
|
+
snapshotterMap[snapshotterID] = snapshotter
|
|
46
|
+
snapshotter.start(object :
|
|
47
|
+
MapSnapshotter.SnapshotReadyCallback {
|
|
48
|
+
override fun onSnapshotReady(snapshot: MapSnapshot) {
|
|
49
|
+
val bitmap: Bitmap = snapshot.bitmap
|
|
50
|
+
val result: String? = if (jsOptions.getBoolean("writeToDisk")) {
|
|
51
|
+
BitmapUtils.createTempFile(
|
|
52
|
+
context, bitmap
|
|
53
|
+
)
|
|
54
|
+
} else {
|
|
55
|
+
BitmapUtils.createBase64(bitmap)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (result == null) {
|
|
59
|
+
promise.reject(
|
|
60
|
+
NAME,
|
|
61
|
+
"Could not generate snapshot, please check Android logs for more info."
|
|
62
|
+
)
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
promise.resolve(result)
|
|
67
|
+
snapshotterMap.remove(snapshotterID)
|
|
68
|
+
}
|
|
69
|
+
}) { error ->
|
|
70
|
+
Log.w(NAME, error)
|
|
71
|
+
snapshotterMap.remove(snapshotterID)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
private fun getOptions(jsOptions: ReadableMap): MapSnapshotter.Options {
|
|
77
|
+
val options: MapSnapshotter.Options =
|
|
78
|
+
MapSnapshotter.Options(
|
|
79
|
+
jsOptions.getDouble("width").toInt(), jsOptions.getDouble("height").toInt()
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
options.withLogo(jsOptions.getBoolean("withLogo"))
|
|
83
|
+
jsOptions.getString("styleURL")?.let { styleUrl ->
|
|
84
|
+
options.withStyleBuilder(
|
|
85
|
+
Style.Builder().fromUri(styleUrl)
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
options.withPixelRatio(
|
|
89
|
+
TypedValue.applyDimension(
|
|
90
|
+
TypedValue.COMPLEX_UNIT_DIP,
|
|
91
|
+
1f,
|
|
92
|
+
context.resources.displayMetrics
|
|
93
|
+
)
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
if (jsOptions.hasKey("bounds")) {
|
|
97
|
+
val bounds = jsOptions.getString("bounds")?.let { boundsStr ->
|
|
98
|
+
FeatureCollection.fromJson(boundsStr)
|
|
99
|
+
}
|
|
100
|
+
bounds?.let {
|
|
101
|
+
options.withRegion(GeoJSONUtils.toLatLngBounds(it))
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
val centerPoint = jsOptions.getString("centerCoordinate")?.let { coordStr ->
|
|
105
|
+
Feature.fromJson(coordStr)
|
|
106
|
+
}
|
|
107
|
+
val cameraPosition: CameraPosition =
|
|
108
|
+
CameraPosition.Builder()
|
|
109
|
+
.target(GeoJSONUtils.toLatLng(centerPoint?.geometry() as Point?))
|
|
110
|
+
.tilt(jsOptions.getDouble("pitch")).bearing(jsOptions.getDouble("heading"))
|
|
111
|
+
.zoom(jsOptions.getDouble("zoomLevel")).build()
|
|
112
|
+
options.withCameraPosition(cameraPosition)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return options
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
private fun closeSnapshotOutputStream(outputStream: OutputStream?) {
|
|
119
|
+
if (outputStream == null) {
|
|
120
|
+
return
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
outputStream.close()
|
|
124
|
+
} catch (e: IOException) {
|
|
125
|
+
e.localizedMessage?.let { Log.w(NAME, it) }
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|