@maplibre/maplibre-react-native 11.0.0-beta.24 → 11.0.0-beta.26
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/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapView.kt +10 -8
- package/ios/modules/offline/MLRNOfflineModule.h +1 -2
- package/ios/modules/offline/MLRNOfflineModule.mm +9 -9
- package/lib/commonjs/components/annotations/callout/Callout.js +2 -1
- package/lib/commonjs/components/annotations/callout/Callout.js.map +1 -1
- package/lib/commonjs/components/annotations/marker/Marker.js +4 -2
- package/lib/commonjs/components/annotations/marker/Marker.js.map +1 -1
- package/lib/commonjs/components/annotations/view-annotation/ViewAnnotation.js +6 -5
- package/lib/commonjs/components/annotations/view-annotation/ViewAnnotation.js.map +1 -1
- package/lib/commonjs/components/camera/Camera.js.map +1 -1
- package/lib/commonjs/components/images/Images.js +2 -2
- package/lib/commonjs/components/layer/Layer.js +0 -1
- package/lib/commonjs/components/layer/Layer.js.map +1 -1
- package/lib/commonjs/components/map/Map.js.map +1 -1
- package/lib/commonjs/components/sources/geojson-source/GeoJSONSource.js +2 -2
- package/lib/commonjs/components/sources/geojson-source/GeoJSONSource.js.map +1 -1
- package/lib/commonjs/components/sources/image-source/ImageSource.js +3 -2
- package/lib/commonjs/components/sources/image-source/ImageSource.js.map +1 -1
- package/lib/commonjs/components/sources/raster-source/RasterSource.js +4 -3
- package/lib/commonjs/components/sources/raster-source/RasterSource.js.map +1 -1
- package/lib/commonjs/components/sources/vector-source/VectorSource.js +4 -2
- package/lib/commonjs/components/sources/vector-source/VectorSource.js.map +1 -1
- package/lib/commonjs/components/user-location/NativeUserLocation.js.map +1 -1
- package/lib/commonjs/components/user-location/UserLocation.js.map +1 -1
- package/lib/commonjs/modules/log/LogManager.js +5 -4
- package/lib/commonjs/modules/log/LogManager.js.map +1 -1
- package/lib/commonjs/modules/network/NetworkManager.js +7 -7
- package/lib/commonjs/modules/network/NetworkManager.js.map +1 -1
- package/lib/commonjs/modules/offline/OfflineManager.js +63 -47
- package/lib/commonjs/modules/offline/OfflineManager.js.map +1 -1
- package/lib/commonjs/modules/transform-request/TransformRequestManager.js +50 -45
- package/lib/commonjs/modules/transform-request/TransformRequestManager.js.map +1 -1
- package/lib/commonjs/plugin/ios.js +9 -8
- package/lib/commonjs/plugin/ios.js.map +1 -1
- package/lib/commonjs/types/Anchor.js +5 -6
- package/lib/commonjs/types/Anchor.js.map +1 -1
- package/lib/commonjs/utils/animated/AbstractAnimatedCoordinates.js +2 -2
- package/lib/commonjs/utils/animated/AnimatedCoordinatesArray.js +6 -6
- package/lib/commonjs/utils/animated/AnimatedGeoJSON.js +2 -1
- package/lib/commonjs/utils/animated/AnimatedGeoJSON.js.map +1 -1
- package/lib/commonjs/utils/animated/AnimatedRouteCoordinatesArray.js +6 -6
- package/lib/commonjs/utils/convertStyleSpec.js +4 -4
- package/lib/module/components/annotations/callout/Callout.js +2 -1
- package/lib/module/components/annotations/callout/Callout.js.map +1 -1
- package/lib/module/components/annotations/marker/Marker.js +4 -2
- package/lib/module/components/annotations/marker/Marker.js.map +1 -1
- package/lib/module/components/annotations/view-annotation/ViewAnnotation.js +6 -5
- package/lib/module/components/annotations/view-annotation/ViewAnnotation.js.map +1 -1
- package/lib/module/components/camera/Camera.js.map +1 -1
- package/lib/module/components/images/Images.js +2 -2
- package/lib/module/components/layer/Layer.js +0 -1
- package/lib/module/components/layer/Layer.js.map +1 -1
- package/lib/module/components/map/Map.js.map +1 -1
- package/lib/module/components/sources/geojson-source/GeoJSONSource.js +2 -2
- package/lib/module/components/sources/geojson-source/GeoJSONSource.js.map +1 -1
- package/lib/module/components/sources/image-source/ImageSource.js +3 -2
- package/lib/module/components/sources/image-source/ImageSource.js.map +1 -1
- package/lib/module/components/sources/raster-source/RasterSource.js +4 -3
- package/lib/module/components/sources/raster-source/RasterSource.js.map +1 -1
- package/lib/module/components/sources/vector-source/VectorSource.js +4 -2
- package/lib/module/components/sources/vector-source/VectorSource.js.map +1 -1
- package/lib/module/components/user-location/NativeUserLocation.js.map +1 -1
- package/lib/module/components/user-location/UserLocation.js.map +1 -1
- package/lib/module/modules/log/LogManager.js +5 -4
- package/lib/module/modules/log/LogManager.js.map +1 -1
- package/lib/module/modules/network/NetworkManager.js +7 -7
- package/lib/module/modules/network/NetworkManager.js.map +1 -1
- package/lib/module/modules/offline/OfflineManager.js +63 -47
- package/lib/module/modules/offline/OfflineManager.js.map +1 -1
- package/lib/module/modules/transform-request/TransformRequestManager.js +50 -45
- package/lib/module/modules/transform-request/TransformRequestManager.js.map +1 -1
- package/lib/module/plugin/ios.js +9 -8
- package/lib/module/plugin/ios.js.map +1 -1
- package/lib/module/types/Anchor.js +5 -6
- package/lib/module/types/Anchor.js.map +1 -1
- package/lib/module/utils/animated/AbstractAnimatedCoordinates.js +2 -2
- package/lib/module/utils/animated/AnimatedCoordinatesArray.js +6 -6
- package/lib/module/utils/animated/AnimatedGeoJSON.js +2 -1
- package/lib/module/utils/animated/AnimatedGeoJSON.js.map +1 -1
- package/lib/module/utils/animated/AnimatedRouteCoordinatesArray.js +6 -6
- package/lib/module/utils/convertStyleSpec.js +4 -4
- package/lib/typescript/commonjs/components/annotations/callout/Callout.d.ts +3 -2
- package/lib/typescript/commonjs/components/annotations/callout/Callout.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/annotations/marker/Marker.d.ts +15 -14
- package/lib/typescript/commonjs/components/annotations/marker/Marker.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/annotations/view-annotation/ViewAnnotation.d.ts +26 -24
- package/lib/typescript/commonjs/components/annotations/view-annotation/ViewAnnotation.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/camera/Camera.d.ts +10 -24
- package/lib/typescript/commonjs/components/camera/Camera.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/images/Images.d.ts +12 -12
- package/lib/typescript/commonjs/components/layer/Layer.d.ts +0 -1
- package/lib/typescript/commonjs/components/layer/Layer.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/map/Map.d.ts +54 -51
- package/lib/typescript/commonjs/components/map/Map.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/sources/geojson-source/GeoJSONSource.d.ts +40 -41
- package/lib/typescript/commonjs/components/sources/geojson-source/GeoJSONSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/sources/image-source/ImageSource.d.ts +5 -3
- package/lib/typescript/commonjs/components/sources/image-source/ImageSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/sources/raster-source/RasterSource.d.ts +20 -15
- package/lib/typescript/commonjs/components/sources/raster-source/RasterSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/sources/vector-source/VectorSource.d.ts +23 -20
- package/lib/typescript/commonjs/components/sources/vector-source/VectorSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/user-location/NativeUserLocation.d.ts +9 -6
- package/lib/typescript/commonjs/components/user-location/NativeUserLocation.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/user-location/UserLocation.d.ts +4 -2
- package/lib/typescript/commonjs/components/user-location/UserLocation.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/useCurrentPosition.d.ts +2 -2
- package/lib/typescript/commonjs/modules/log/LogManager.d.ts +5 -4
- package/lib/typescript/commonjs/modules/log/LogManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/modules/network/NetworkManager.d.ts +7 -7
- package/lib/typescript/commonjs/modules/network/NetworkManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/modules/offline/OfflineManager.d.ts +63 -47
- package/lib/typescript/commonjs/modules/offline/OfflineManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/modules/static-map/StaticMapManager.d.ts +2 -2
- package/lib/typescript/commonjs/modules/transform-request/TransformRequestManager.d.ts +56 -49
- package/lib/typescript/commonjs/modules/transform-request/TransformRequestManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/plugin/MapLibrePluginProps.d.ts +10 -15
- package/lib/typescript/commonjs/plugin/MapLibrePluginProps.d.ts.map +1 -1
- package/lib/typescript/commonjs/plugin/ios.d.ts +2 -2
- package/lib/typescript/commonjs/plugin/ios.d.ts.map +1 -1
- package/lib/typescript/commonjs/types/Anchor.d.ts +5 -6
- package/lib/typescript/commonjs/types/Anchor.d.ts.map +1 -1
- package/lib/typescript/commonjs/types/LngLatBounds.d.ts +2 -1
- package/lib/typescript/commonjs/types/LngLatBounds.d.ts.map +1 -1
- package/lib/typescript/commonjs/types/MapLibreRNStyles.d.ts +243 -93
- package/lib/typescript/commonjs/types/MapLibreRNStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/types/sources/PressableSourceProps.d.ts +1 -2
- package/lib/typescript/commonjs/types/sources/PressableSourceProps.d.ts.map +1 -1
- package/lib/typescript/commonjs/utils/animated/AbstractAnimatedCoordinates.d.ts +2 -2
- package/lib/typescript/commonjs/utils/animated/AnimatedCoordinatesArray.d.ts +6 -6
- package/lib/typescript/commonjs/utils/animated/AnimatedGeoJSON.d.ts +2 -1
- package/lib/typescript/commonjs/utils/animated/AnimatedGeoJSON.d.ts.map +1 -1
- package/lib/typescript/commonjs/utils/animated/AnimatedRouteCoordinatesArray.d.ts +6 -6
- package/lib/typescript/commonjs/utils/convertStyleSpec.d.ts +4 -4
- package/lib/typescript/module/components/annotations/callout/Callout.d.ts +3 -2
- package/lib/typescript/module/components/annotations/callout/Callout.d.ts.map +1 -1
- package/lib/typescript/module/components/annotations/marker/Marker.d.ts +15 -14
- package/lib/typescript/module/components/annotations/marker/Marker.d.ts.map +1 -1
- package/lib/typescript/module/components/annotations/view-annotation/ViewAnnotation.d.ts +26 -24
- package/lib/typescript/module/components/annotations/view-annotation/ViewAnnotation.d.ts.map +1 -1
- package/lib/typescript/module/components/camera/Camera.d.ts +10 -24
- package/lib/typescript/module/components/camera/Camera.d.ts.map +1 -1
- package/lib/typescript/module/components/images/Images.d.ts +12 -12
- package/lib/typescript/module/components/layer/Layer.d.ts +0 -1
- package/lib/typescript/module/components/layer/Layer.d.ts.map +1 -1
- package/lib/typescript/module/components/map/Map.d.ts +54 -51
- package/lib/typescript/module/components/map/Map.d.ts.map +1 -1
- package/lib/typescript/module/components/sources/geojson-source/GeoJSONSource.d.ts +40 -41
- package/lib/typescript/module/components/sources/geojson-source/GeoJSONSource.d.ts.map +1 -1
- package/lib/typescript/module/components/sources/image-source/ImageSource.d.ts +5 -3
- package/lib/typescript/module/components/sources/image-source/ImageSource.d.ts.map +1 -1
- package/lib/typescript/module/components/sources/raster-source/RasterSource.d.ts +20 -15
- package/lib/typescript/module/components/sources/raster-source/RasterSource.d.ts.map +1 -1
- package/lib/typescript/module/components/sources/vector-source/VectorSource.d.ts +23 -20
- package/lib/typescript/module/components/sources/vector-source/VectorSource.d.ts.map +1 -1
- package/lib/typescript/module/components/user-location/NativeUserLocation.d.ts +9 -6
- package/lib/typescript/module/components/user-location/NativeUserLocation.d.ts.map +1 -1
- package/lib/typescript/module/components/user-location/UserLocation.d.ts +4 -2
- package/lib/typescript/module/components/user-location/UserLocation.d.ts.map +1 -1
- package/lib/typescript/module/hooks/useCurrentPosition.d.ts +2 -2
- package/lib/typescript/module/modules/log/LogManager.d.ts +5 -4
- package/lib/typescript/module/modules/log/LogManager.d.ts.map +1 -1
- package/lib/typescript/module/modules/network/NetworkManager.d.ts +7 -7
- package/lib/typescript/module/modules/network/NetworkManager.d.ts.map +1 -1
- package/lib/typescript/module/modules/offline/OfflineManager.d.ts +63 -47
- package/lib/typescript/module/modules/offline/OfflineManager.d.ts.map +1 -1
- package/lib/typescript/module/modules/static-map/StaticMapManager.d.ts +2 -2
- package/lib/typescript/module/modules/transform-request/TransformRequestManager.d.ts +56 -49
- package/lib/typescript/module/modules/transform-request/TransformRequestManager.d.ts.map +1 -1
- package/lib/typescript/module/plugin/MapLibrePluginProps.d.ts +10 -15
- package/lib/typescript/module/plugin/MapLibrePluginProps.d.ts.map +1 -1
- package/lib/typescript/module/plugin/ios.d.ts +2 -2
- package/lib/typescript/module/plugin/ios.d.ts.map +1 -1
- package/lib/typescript/module/types/Anchor.d.ts +5 -6
- package/lib/typescript/module/types/Anchor.d.ts.map +1 -1
- package/lib/typescript/module/types/LngLatBounds.d.ts +2 -1
- package/lib/typescript/module/types/LngLatBounds.d.ts.map +1 -1
- package/lib/typescript/module/types/MapLibreRNStyles.d.ts +243 -93
- package/lib/typescript/module/types/MapLibreRNStyles.d.ts.map +1 -1
- package/lib/typescript/module/types/sources/PressableSourceProps.d.ts +1 -2
- package/lib/typescript/module/types/sources/PressableSourceProps.d.ts.map +1 -1
- package/lib/typescript/module/utils/animated/AbstractAnimatedCoordinates.d.ts +2 -2
- package/lib/typescript/module/utils/animated/AnimatedCoordinatesArray.d.ts +6 -6
- package/lib/typescript/module/utils/animated/AnimatedGeoJSON.d.ts +2 -1
- package/lib/typescript/module/utils/animated/AnimatedGeoJSON.d.ts.map +1 -1
- package/lib/typescript/module/utils/animated/AnimatedRouteCoordinatesArray.d.ts +6 -6
- package/lib/typescript/module/utils/convertStyleSpec.d.ts +4 -4
- package/package.json +1 -2
- package/src/components/annotations/callout/Callout.tsx +3 -2
- package/src/components/annotations/marker/Marker.tsx +15 -14
- package/src/components/annotations/view-annotation/ViewAnnotation.tsx +26 -24
- package/src/components/camera/Camera.tsx +10 -24
- package/src/components/images/Images.tsx +12 -12
- package/src/components/layer/Layer.tsx +0 -1
- package/src/components/map/Map.tsx +54 -51
- package/src/components/sources/geojson-source/GeoJSONSource.tsx +40 -41
- package/src/components/sources/image-source/ImageSource.tsx +5 -3
- package/src/components/sources/raster-source/RasterSource.tsx +20 -15
- package/src/components/sources/vector-source/VectorSource.tsx +23 -20
- package/src/components/user-location/NativeUserLocation.tsx +9 -6
- package/src/components/user-location/UserLocation.tsx +4 -2
- package/src/hooks/useCurrentPosition.ts +2 -2
- package/src/modules/log/LogManager.ts +5 -4
- package/src/modules/network/NetworkManager.ts +7 -7
- package/src/modules/offline/OfflineManager.ts +63 -47
- package/src/modules/static-map/StaticMapManager.ts +2 -2
- package/src/modules/transform-request/TransformRequestManager.ts +56 -49
- package/src/plugin/MapLibrePluginProps.ts +10 -15
- package/src/plugin/ios.ts +9 -8
- package/src/types/Anchor.ts +5 -6
- package/src/types/LngLatBounds.ts +2 -1
- package/src/types/MapLibreRNStyles.ts +243 -93
- package/src/types/sources/PressableSourceProps.ts +1 -2
- package/src/utils/animated/AbstractAnimatedCoordinates.ts +2 -2
- package/src/utils/animated/AnimatedCoordinatesArray.ts +6 -6
- package/src/utils/animated/AnimatedGeoJSON.ts +2 -1
- package/src/utils/animated/AnimatedRouteCoordinatesArray.ts +6 -6
- package/src/utils/convertStyleSpec.ts +4 -4
|
@@ -5,20 +5,23 @@ interface NativeUserLocationProps extends BaseProps {
|
|
|
5
5
|
/**
|
|
6
6
|
* Rendering mode
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* - "default": Renders only a puck
|
|
9
|
+
* - "heading": Renders a puck with triangle indicating device heading based on
|
|
10
|
+
* compass
|
|
11
|
+
* - "course": Android renders an arrow indicating device heading based on GPS
|
|
12
|
+
* course, iOS behaves like mode="heading"
|
|
11
13
|
*
|
|
12
|
-
* @
|
|
14
|
+
* @defaultValue "default"
|
|
13
15
|
*/
|
|
14
16
|
mode?: "default" | "heading" | "course";
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* Limit the maximum frames per second for location updates on Android
|
|
18
20
|
*
|
|
19
|
-
* Use this setting to limit animation rate of the location puck to decrease the
|
|
21
|
+
* Use this setting to limit animation rate of the location puck to decrease the
|
|
22
|
+
* stress on the device's CPU which could improve battery life.
|
|
20
23
|
*
|
|
21
|
-
* @platform
|
|
24
|
+
* @platform Android
|
|
22
25
|
*/
|
|
23
26
|
androidPreferredFramesPerSecond?: number;
|
|
24
27
|
}
|
|
@@ -9,7 +9,8 @@ import { Images } from "../images/Images";
|
|
|
9
9
|
|
|
10
10
|
export interface UserLocationProps {
|
|
11
11
|
/**
|
|
12
|
-
* Children to render inside the UserLocation Annotation, e.g. CircleLayer,
|
|
12
|
+
* Children to render inside the UserLocation Annotation, e.g. CircleLayer,
|
|
13
|
+
* SymbolLayer
|
|
13
14
|
*/
|
|
14
15
|
children?: ReactNode;
|
|
15
16
|
|
|
@@ -24,7 +25,8 @@ export interface UserLocationProps {
|
|
|
24
25
|
accuracy?: boolean;
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
|
-
* Render an arrow which indicates direction the device is pointing relative to
|
|
28
|
+
* Render an arrow which indicates direction the device is pointing relative to
|
|
29
|
+
* north
|
|
28
30
|
*/
|
|
29
31
|
heading?: boolean;
|
|
30
32
|
|
|
@@ -9,14 +9,14 @@ interface UseCurrentPositionOptions {
|
|
|
9
9
|
/**
|
|
10
10
|
* Enable or disable position updates
|
|
11
11
|
*
|
|
12
|
-
* @
|
|
12
|
+
* @defaultValue true
|
|
13
13
|
*/
|
|
14
14
|
enabled?: boolean;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Minimum displacement in meters to trigger position update
|
|
18
18
|
*
|
|
19
|
-
* @
|
|
19
|
+
* @defaultValue 0
|
|
20
20
|
*/
|
|
21
21
|
minDisplacement?: number;
|
|
22
22
|
}
|
|
@@ -16,9 +16,10 @@ interface LogEvent {
|
|
|
16
16
|
/**
|
|
17
17
|
* Handler for `onLog` events
|
|
18
18
|
*
|
|
19
|
-
* Called before logging a message, return false to proceed with default
|
|
19
|
+
* Called before logging a message, return false to proceed with default
|
|
20
|
+
* logging.
|
|
20
21
|
*
|
|
21
|
-
* @param event
|
|
22
|
+
* @param event -
|
|
22
23
|
*/
|
|
23
24
|
type LogHandler = (event: LogEvent) => boolean;
|
|
24
25
|
|
|
@@ -35,7 +36,7 @@ class LogManager {
|
|
|
35
36
|
/**
|
|
36
37
|
* Override logging behavior
|
|
37
38
|
*
|
|
38
|
-
* @param logHandler
|
|
39
|
+
* @param logHandler -
|
|
39
40
|
*/
|
|
40
41
|
onLog(logHandler: LogHandler): void {
|
|
41
42
|
this.logHandler = logHandler;
|
|
@@ -44,7 +45,7 @@ class LogManager {
|
|
|
44
45
|
/**
|
|
45
46
|
* Set the minimum log level for a message to be logged
|
|
46
47
|
*
|
|
47
|
-
* @param level Minimum log level
|
|
48
|
+
* @param level - Minimum log level
|
|
48
49
|
*/
|
|
49
50
|
setLogLevel(level: LogLevel): void {
|
|
50
51
|
this.logLevel = level;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import NativeNetworkModule from "./NativeNetworkModule";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* NetworkManager provides methods for managing and controlling network
|
|
4
|
+
* NetworkManager provides methods for managing and controlling network
|
|
5
|
+
* connectivity.
|
|
5
6
|
*/
|
|
6
7
|
class NetworkManager {
|
|
7
8
|
/**
|
|
8
|
-
* Android only: Sets the connectivity state of the map. When set to false, the
|
|
9
|
-
* not make any network requests and will only use cached tiles. This
|
|
10
|
-
* useful for implementing offline mode or reducing data usage.
|
|
9
|
+
* Android only: Sets the connectivity state of the map. When set to false, the
|
|
10
|
+
* map will not make any network requests and will only use cached tiles. This
|
|
11
|
+
* is useful for implementing offline mode or reducing data usage.
|
|
12
|
+
*
|
|
13
|
+
* @param connected - Whether the map should be connected to the network
|
|
11
14
|
*
|
|
12
15
|
* @example
|
|
13
16
|
* ```ts
|
|
14
17
|
* // Enable offline mode
|
|
15
18
|
* NetworkManager.setConnected(false);
|
|
16
|
-
*
|
|
17
19
|
* // Re-enable network requests
|
|
18
20
|
* NetworkManager.setConnected(true);
|
|
19
21
|
* ```
|
|
20
|
-
*
|
|
21
|
-
* @param connected Whether the map should be connected to the network
|
|
22
22
|
*/
|
|
23
23
|
static setConnected(connected: boolean): void {
|
|
24
24
|
NativeNetworkModule.setConnected(connected);
|
|
@@ -36,9 +36,10 @@ export type OfflinePackErrorListener = (
|
|
|
36
36
|
) => void;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* OfflineManager implements a singleton (shared object) that manages offline
|
|
40
|
-
* All of this class's instance methods are asynchronous, reflecting the
|
|
41
|
-
*
|
|
39
|
+
* OfflineManager implements a singleton (shared object) that manages offline
|
|
40
|
+
* packs. All of this class's instance methods are asynchronous, reflecting the
|
|
41
|
+
* fact that offline resources are stored in a database. The shared object
|
|
42
|
+
* maintains a canonical collection of offline packs.
|
|
42
43
|
*/
|
|
43
44
|
class OfflineManager {
|
|
44
45
|
private initialized: boolean;
|
|
@@ -70,10 +71,18 @@ class OfflineManager {
|
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
/**
|
|
73
|
-
* Creates and registers an offline pack that downloads the resources needed to
|
|
74
|
+
* Creates and registers an offline pack that downloads the resources needed to
|
|
75
|
+
* use the given region offline.
|
|
74
76
|
*
|
|
75
|
-
* @
|
|
77
|
+
* @param options - Create options for offline pack that specifies zoom levels, style url, and
|
|
78
|
+
* the region to download.
|
|
79
|
+
* @param progressListener - Callback that listens for status events while downloading the offline
|
|
80
|
+
* resource.
|
|
81
|
+
* @param errorListener - Callback that listens for status events while downloading the offline
|
|
82
|
+
* resource.
|
|
83
|
+
* @returns The created offline pack with its generated ID.
|
|
76
84
|
*
|
|
85
|
+
* @example
|
|
77
86
|
* const progressListener = (offlineRegion, status) => console.log(offlineRegion, status);
|
|
78
87
|
* const errorListener = (offlineRegion, error) => console.log(offlineRegion, error);
|
|
79
88
|
*
|
|
@@ -84,12 +93,6 @@ class OfflineManager {
|
|
|
84
93
|
* bounds: [west, south, east, north],
|
|
85
94
|
* metadata: { customValue: 'myValue' }
|
|
86
95
|
* }, progressListener, errorListener)
|
|
87
|
-
*
|
|
88
|
-
* @param options Create options for offline pack that specifies zoom levels, style url, and the region to download.
|
|
89
|
-
* @param progressListener Callback that listens for status events while downloading the offline resource.
|
|
90
|
-
* @param errorListener Callback that listens for status events while downloading the offline resource.
|
|
91
|
-
*
|
|
92
|
-
* @return The created offline pack with its generated ID.
|
|
93
96
|
*/
|
|
94
97
|
async createPack(
|
|
95
98
|
options: OfflinePackCreateOptions,
|
|
@@ -117,14 +120,18 @@ class OfflineManager {
|
|
|
117
120
|
}
|
|
118
121
|
|
|
119
122
|
/**
|
|
120
|
-
* Invalidates the specified offline pack. This method checks that the tiles in
|
|
123
|
+
* Invalidates the specified offline pack. This method checks that the tiles in
|
|
124
|
+
* the specified offline pack match those from the server. Local tiles that do
|
|
125
|
+
* not match the latest version on the server are updated.
|
|
126
|
+
*
|
|
127
|
+
* This is more efficient than deleting the offline pack and downloading it
|
|
128
|
+
* again. If the data stored locally matches that on the server, new data will
|
|
129
|
+
* not be downloaded.
|
|
121
130
|
*
|
|
122
|
-
*
|
|
131
|
+
* @param id - ID of the OfflinePack.
|
|
123
132
|
*
|
|
124
133
|
* @example
|
|
125
134
|
* await OfflineManager.invalidatePack(pack.id)
|
|
126
|
-
*
|
|
127
|
-
* @param id ID of the OfflinePack.
|
|
128
135
|
*/
|
|
129
136
|
async invalidatePack(id: string): Promise<void> {
|
|
130
137
|
await this.initialize();
|
|
@@ -134,12 +141,13 @@ class OfflineManager {
|
|
|
134
141
|
}
|
|
135
142
|
|
|
136
143
|
/**
|
|
137
|
-
* Unregisters the given OfflinePack and allows resources that are no longer
|
|
144
|
+
* Unregisters the given OfflinePack and allows resources that are no longer
|
|
145
|
+
* required by any remaining packs to be potentially freed.
|
|
146
|
+
*
|
|
147
|
+
* @param id - ID of the OfflinePack.
|
|
138
148
|
*
|
|
139
149
|
* @example
|
|
140
150
|
* await OfflineManager.deletePack(pack.id)
|
|
141
|
-
*
|
|
142
|
-
* @param id ID of the OfflinePack.
|
|
143
151
|
*/
|
|
144
152
|
async deletePack(id: string): Promise<void> {
|
|
145
153
|
await this.initialize();
|
|
@@ -150,10 +158,13 @@ class OfflineManager {
|
|
|
150
158
|
}
|
|
151
159
|
|
|
152
160
|
/**
|
|
153
|
-
* Forces a revalidation of the tiles in the ambient cache and downloads a fresh
|
|
154
|
-
* This is the recommend method for
|
|
155
|
-
* This is the most efficient method because tiles in the
|
|
156
|
-
*
|
|
161
|
+
* Forces a revalidation of the tiles in the ambient cache and downloads a fresh
|
|
162
|
+
* version of the tiles from the tile server. This is the recommend method for
|
|
163
|
+
* clearing the cache. This is the most efficient method because tiles in the
|
|
164
|
+
* ambient cache are re-downloaded to remove outdated data from a device. It
|
|
165
|
+
* does not erase resources from the ambient cache or delete the database, which
|
|
166
|
+
* can be computationally expensive operations that may carry unintended side
|
|
167
|
+
* effects.
|
|
157
168
|
*
|
|
158
169
|
* @example
|
|
159
170
|
* await OfflineManager.invalidateAmbientCache();
|
|
@@ -164,8 +175,8 @@ class OfflineManager {
|
|
|
164
175
|
}
|
|
165
176
|
|
|
166
177
|
/**
|
|
167
|
-
* Erases resources from the ambient cache.
|
|
168
|
-
*
|
|
178
|
+
* Erases resources from the ambient cache. This method clears the cache and
|
|
179
|
+
* decreases the amount of space that map resources take up on the device.
|
|
169
180
|
*
|
|
170
181
|
* @example
|
|
171
182
|
* await OfflineManager.clearAmbientCache();
|
|
@@ -176,13 +187,14 @@ class OfflineManager {
|
|
|
176
187
|
}
|
|
177
188
|
|
|
178
189
|
/**
|
|
179
|
-
* Sets the maximum size of the ambient cache in bytes. Disables the ambient
|
|
180
|
-
* This method may be computationally expensive because it
|
|
190
|
+
* Sets the maximum size of the ambient cache in bytes. Disables the ambient
|
|
191
|
+
* cache if set to 0. This method may be computationally expensive because it
|
|
192
|
+
* will erase resources from the ambient cache if its size is decreased.
|
|
193
|
+
*
|
|
194
|
+
* @param size - Size of ambient cache.
|
|
181
195
|
*
|
|
182
196
|
* @example
|
|
183
197
|
* await OfflineManager.setMaximumAmbientCacheSize(5000000);
|
|
184
|
-
*
|
|
185
|
-
* @param size Size of ambient cache.
|
|
186
198
|
*/
|
|
187
199
|
async setMaximumAmbientCacheSize(size: number): Promise<void> {
|
|
188
200
|
await this.initialize();
|
|
@@ -190,7 +202,8 @@ class OfflineManager {
|
|
|
190
202
|
}
|
|
191
203
|
|
|
192
204
|
/**
|
|
193
|
-
* Deletes the existing database, which includes both the ambient cache and
|
|
205
|
+
* Deletes the existing database, which includes both the ambient cache and
|
|
206
|
+
* offline packs, then reinitializes it.
|
|
194
207
|
*
|
|
195
208
|
* @example
|
|
196
209
|
* await OfflineManager.resetDatabase();
|
|
@@ -232,10 +245,10 @@ class OfflineManager {
|
|
|
232
245
|
/**
|
|
233
246
|
* Sideloads offline db
|
|
234
247
|
*
|
|
248
|
+
* @param path - Path to offline tile db on file system.
|
|
249
|
+
*
|
|
235
250
|
* @example
|
|
236
251
|
* await OfflineManager.mergeOfflineRegions(path);
|
|
237
|
-
*
|
|
238
|
-
* @param path Path to offline tile db on file system.
|
|
239
252
|
*/
|
|
240
253
|
async mergeOfflineRegions(path: string): Promise<void> {
|
|
241
254
|
await this.initialize();
|
|
@@ -243,26 +256,27 @@ class OfflineManager {
|
|
|
243
256
|
}
|
|
244
257
|
|
|
245
258
|
/**
|
|
246
|
-
* Sets the maximum number of tiles that may be downloaded and stored on the
|
|
247
|
-
* Consult the Terms of Service for your map tile host before
|
|
259
|
+
* Sets the maximum number of tiles that may be downloaded and stored on the
|
|
260
|
+
* current device. Consult the Terms of Service for your map tile host before
|
|
261
|
+
* changing this value.
|
|
262
|
+
*
|
|
263
|
+
* @param limit - Map tile limit count.
|
|
248
264
|
*
|
|
249
265
|
* @example
|
|
250
266
|
* OfflineManager.setTileCountLimit(1000);
|
|
251
|
-
*
|
|
252
|
-
* @param limit Map tile limit count.
|
|
253
267
|
*/
|
|
254
268
|
setTileCountLimit(limit: number): void {
|
|
255
269
|
NativeOfflineModule.setTileCountLimit(limit);
|
|
256
270
|
}
|
|
257
271
|
|
|
258
272
|
/**
|
|
259
|
-
* Sets the period at which download status events will be sent over the React
|
|
260
|
-
* The default is 500ms.
|
|
273
|
+
* Sets the period at which download status events will be sent over the React
|
|
274
|
+
* Native bridge. The default is 500ms.
|
|
275
|
+
*
|
|
276
|
+
* @param throttleValue - Event throttle value in ms.
|
|
261
277
|
*
|
|
262
278
|
* @example
|
|
263
279
|
* OfflineManager.setProgressEventThrottle(500);
|
|
264
|
-
*
|
|
265
|
-
* @param throttleValue Event throttle value in ms.
|
|
266
280
|
*/
|
|
267
281
|
setProgressEventThrottle(throttleValue: number): void {
|
|
268
282
|
NativeOfflineModule.setProgressEventThrottle(throttleValue);
|
|
@@ -272,14 +286,16 @@ class OfflineManager {
|
|
|
272
286
|
* Subscribe to download status/error events for the requested offline pack.
|
|
273
287
|
* Note that createPack calls this internally if listeners are provided.
|
|
274
288
|
*
|
|
289
|
+
* @param id - ID of the offline pack.
|
|
290
|
+
* @param progressListener - Callback that listens for status events while downloading the offline
|
|
291
|
+
* resource.
|
|
292
|
+
* @param errorListener - Callback that listens for status events while downloading the offline
|
|
293
|
+
* resource.
|
|
294
|
+
*
|
|
275
295
|
* @example
|
|
276
296
|
* const progressListener = (offlinePack, status) => console.log(offlinePack, status)
|
|
277
297
|
* const errorListener = (offlinePack, error) => console.log(offlinePack, error)
|
|
278
298
|
* OfflineManager.addListener(pack.id, progressListener, errorListener)
|
|
279
|
-
*
|
|
280
|
-
* @param id ID of the offline pack.
|
|
281
|
-
* @param progressListener Callback that listens for status events while downloading the offline resource.
|
|
282
|
-
* @param errorListener Callback that listens for status events while downloading the offline resource.
|
|
283
299
|
*/
|
|
284
300
|
async addListener(
|
|
285
301
|
id: string,
|
|
@@ -306,8 +322,10 @@ class OfflineManager {
|
|
|
306
322
|
}
|
|
307
323
|
|
|
308
324
|
/**
|
|
309
|
-
* Unsubscribes any listeners associated with the offline pack.
|
|
310
|
-
*
|
|
325
|
+
* Unsubscribes any listeners associated with the offline pack. Should be called
|
|
326
|
+
* when the component unmounts.
|
|
327
|
+
*
|
|
328
|
+
* @param packId - ID of the offline pack.
|
|
311
329
|
*
|
|
312
330
|
* @example
|
|
313
331
|
* useEffect(() => {
|
|
@@ -315,8 +333,6 @@ class OfflineManager {
|
|
|
315
333
|
* OfflineManager.removeListener(pack.id);
|
|
316
334
|
* }
|
|
317
335
|
* }, []);
|
|
318
|
-
*
|
|
319
|
-
* @param packId ID of the offline pack.
|
|
320
336
|
*/
|
|
321
337
|
removeListener(packId: string): void {
|
|
322
338
|
delete this.progressListeners[packId];
|
|
@@ -6,7 +6,7 @@ export interface StaticMapOptions {
|
|
|
6
6
|
/**
|
|
7
7
|
* Maplibre style - either a URL or a Style JSON.
|
|
8
8
|
*
|
|
9
|
-
* @see https://maplibre.org/maplibre-style-spec/
|
|
9
|
+
* @see {@link https://maplibre.org/maplibre-style-spec/}
|
|
10
10
|
*/
|
|
11
11
|
mapStyle: string | object;
|
|
12
12
|
|
|
@@ -48,7 +48,7 @@ export type StaticMapCenterOptions = StaticMapOptions & {
|
|
|
48
48
|
zoom?: number;
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* The bearing (rotation) of the map.
|
|
52
52
|
*/
|
|
53
53
|
bearing?: number;
|
|
54
54
|
|
|
@@ -11,7 +11,8 @@ export interface TransformOptions {
|
|
|
11
11
|
* Optional regex to be used as the condition, if the transform should be
|
|
12
12
|
* applied. When omitted the transform will always be applied.
|
|
13
13
|
*
|
|
14
|
-
* Global flags are (like `/i`) are not supported. Supports only inline flags,
|
|
14
|
+
* Global flags are (like `/i` ) are not supported. Supports only inline flags,
|
|
15
|
+
* e.g. `(?i)` for case-insensitive matching.
|
|
15
16
|
*/
|
|
16
17
|
match?: RegExp | string;
|
|
17
18
|
}
|
|
@@ -19,15 +20,16 @@ export interface TransformOptions {
|
|
|
19
20
|
/**
|
|
20
21
|
* A serializable transform for rewriting MapLibre request URLs.
|
|
21
22
|
*
|
|
22
|
-
* Transforms are applied as a pipeline in the order they were added: transform
|
|
23
|
-
* the URL *after* transform N has possibly changed it.
|
|
23
|
+
* Transforms are applied as a pipeline in the order they were added: transform
|
|
24
|
+
* N+1 sees the URL *after* transform N has possibly changed it.
|
|
24
25
|
*/
|
|
25
26
|
export interface UrlTransformOptions extends TransformOptions {
|
|
26
27
|
/**
|
|
27
|
-
* Regex to find the portion of the URL to replace.
|
|
28
|
-
*
|
|
28
|
+
* Regex to find the portion of the URL to replace. Supports capture groups that
|
|
29
|
+
* can be back-referenced in `replace` as `$1` , `$2` , …
|
|
29
30
|
*
|
|
30
|
-
* Global flags are (like `/i`) are not supported. Supports only inline flags,
|
|
31
|
+
* Global flags are (like `/i` ) are not supported. Supports only inline flags,
|
|
32
|
+
* e.g. `(?i)` for case-insensitive matching.
|
|
31
33
|
*/
|
|
32
34
|
find: RegExp | string;
|
|
33
35
|
|
|
@@ -60,18 +62,18 @@ export interface HeaderOptions extends TransformOptions {
|
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
/**
|
|
63
|
-
* TransformRequestManager provides methods for managing HTTP requests made by
|
|
65
|
+
* TransformRequestManager provides methods for managing HTTP requests made by
|
|
66
|
+
* MapLibre.
|
|
64
67
|
*
|
|
65
68
|
* Transformations are possible in three ways:
|
|
66
69
|
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
+
* - Transforming the URL with search and replace
|
|
71
|
+
* - Adding URL search params
|
|
72
|
+
* - Adding HTTP headers
|
|
70
73
|
*
|
|
71
74
|
* Transforms are applied in this order. The `match` conditions are applied to
|
|
72
75
|
* possibly already transformed URLs.
|
|
73
76
|
*
|
|
74
|
-
* @remarks
|
|
75
77
|
* To gain insight into which transforms are applied set the log level to
|
|
76
78
|
* `"debug"` via {@link LogManager}:
|
|
77
79
|
*
|
|
@@ -86,43 +88,44 @@ class TransformRequestManager {
|
|
|
86
88
|
* Transforms execute in insertion order. Therefore `match` and `find` regexes
|
|
87
89
|
* are matched against possibly already modified URL by previous transforms.
|
|
88
90
|
*
|
|
89
|
-
* Re-adding an existing `id` updates the transform
|
|
90
|
-
*
|
|
91
|
-
*
|
|
91
|
+
* Re-adding an existing `id` updates the transform **in-place**, preserving its
|
|
92
|
+
* position in the pipeline. This makes it safe to refresh tokens or swap
|
|
93
|
+
* domains without disrupting the order of other transforms.
|
|
92
94
|
*
|
|
93
95
|
* URL transforms are applied before `addUrlSearchParam` and `addHeader`.
|
|
94
96
|
*
|
|
95
|
-
* @
|
|
96
|
-
*
|
|
97
|
+
* @param options - The transform. Set {@link TransformOptions.id} to a stable string to enable
|
|
98
|
+
* in-place updates; if omitted an id is auto-generated and returned.
|
|
99
|
+
* @returns The id of the transform (the value of `transform.id` when provided, otherwise the auto-generated one). Pass it to {@link removeUrlTransform} to remove it later.
|
|
100
|
+
*
|
|
101
|
+
* @example Upgrade all requests to HTTPS
|
|
102
|
+
* ```ts
|
|
97
103
|
* TransformRequestManager.addUrlTransform({
|
|
98
104
|
* id: "force-https",
|
|
99
105
|
* find: "^http://",
|
|
100
106
|
* replace: "https://",
|
|
101
107
|
* });
|
|
108
|
+
* ```
|
|
102
109
|
*
|
|
103
|
-
* @example
|
|
104
|
-
*
|
|
110
|
+
* @example Redirect a specific domain through a proxy
|
|
111
|
+
* ```ts
|
|
105
112
|
* TransformRequestManager.addUrlTransform({
|
|
106
113
|
* id: "proxy",
|
|
107
114
|
* match: "tiles\\.example\\.com",
|
|
108
115
|
* find: "tiles\\.example\\.com",
|
|
109
116
|
* replace: "proxy.example.com",
|
|
110
117
|
* });
|
|
118
|
+
* ```
|
|
111
119
|
*
|
|
112
|
-
* @example
|
|
113
|
-
*
|
|
120
|
+
* @example Inject an API key into the path using a capture group
|
|
121
|
+
* ```ts
|
|
114
122
|
* TransformRequestManager.addUrlTransform({
|
|
115
123
|
* id: "api-key",
|
|
116
124
|
* match: "api\\.example\\.com",
|
|
117
125
|
* find: "(https://api\\.example\\.com/)(.*)",
|
|
118
126
|
* replace: "$1mySecretKey/$2",
|
|
119
127
|
* });
|
|
120
|
-
*
|
|
121
|
-
* @param options The transform. Set {@link TransformOptions.id} to a stable string to
|
|
122
|
-
* enable in-place updates; if omitted an id is auto-generated and returned.
|
|
123
|
-
*
|
|
124
|
-
* @returns The id of the transform (the value of `transform.id` when provided, otherwise
|
|
125
|
-
* the auto-generated one). Pass it to {@link removeUrlTransform} to remove it later.
|
|
128
|
+
* ```
|
|
126
129
|
*/
|
|
127
130
|
addUrlTransform(options: UrlTransformOptions): string {
|
|
128
131
|
const id = options.id ?? this.getId();
|
|
@@ -138,10 +141,10 @@ class TransformRequestManager {
|
|
|
138
141
|
}
|
|
139
142
|
|
|
140
143
|
/**
|
|
141
|
-
* Removes the URL transform with the given `id
|
|
142
|
-
*
|
|
144
|
+
* Removes the URL transform with the given `id` . No-op if the id is not
|
|
145
|
+
* registered.
|
|
143
146
|
*
|
|
144
|
-
* @param id The identifier passed to/returned from {@link addUrlTransform}.
|
|
147
|
+
* @param id - The identifier passed to/returned from {@link addUrlTransform}.
|
|
145
148
|
*/
|
|
146
149
|
removeUrlTransform(id: string): void {
|
|
147
150
|
NativeTransformRequestModule.removeUrlTransform(id);
|
|
@@ -155,24 +158,25 @@ class TransformRequestManager {
|
|
|
155
158
|
}
|
|
156
159
|
|
|
157
160
|
/**
|
|
158
|
-
* Adds or updates a URL query parameter identified by `id` that will be
|
|
159
|
-
* matching map resource requests. Re-adding an existing `id`
|
|
161
|
+
* Adds or updates a URL query parameter identified by `id` that will be
|
|
162
|
+
* appended to all matching map resource requests. Re-adding an existing `id`
|
|
163
|
+
* updates the param in-place.
|
|
160
164
|
*
|
|
161
|
-
* @
|
|
162
|
-
*
|
|
165
|
+
* @param options - The options. Set {@link TransformOptions.id} to a stable string to enable
|
|
166
|
+
* in-place updates; if omitted an id is auto-generated and returned.
|
|
167
|
+
* @returns The id of the options. Pass it to {@link removeUrlSearchParam} to remove it later.
|
|
168
|
+
*
|
|
169
|
+
* @example Add apiKey to for a specific domain
|
|
170
|
+
* ```ts
|
|
163
171
|
* TransformRequestManager.addUrlSearchParam({
|
|
164
172
|
* match: /tiles\.example\.com/,
|
|
165
173
|
* name: "apiKey",
|
|
166
174
|
* value: "your-api-key",
|
|
167
175
|
* });
|
|
176
|
+
* ```
|
|
168
177
|
*
|
|
169
178
|
* // Add apiKey to all requests (no match = applies to all)
|
|
170
179
|
* TransformRequestManager.addUrlSearchParam({ name: "apiKey", value: "your-api-key" });
|
|
171
|
-
*
|
|
172
|
-
* @param options The options. Set {@link TransformOptions.id} to a stable string to
|
|
173
|
-
* enable in-place updates; if omitted an id is auto-generated and returned.
|
|
174
|
-
*
|
|
175
|
-
* @returns The id of the options. Pass it to {@link removeUrlSearchParam} to remove it later.
|
|
176
180
|
*/
|
|
177
181
|
addUrlSearchParam(options: UrlSearchParamOptions): string {
|
|
178
182
|
const id = options.id ?? this.getId();
|
|
@@ -190,7 +194,7 @@ class TransformRequestManager {
|
|
|
190
194
|
/**
|
|
191
195
|
* Removes a previously added URL query parameter by its `id`.
|
|
192
196
|
*
|
|
193
|
-
* @param id The identifier passed to/returned from {@link addUrlSearchParam}.
|
|
197
|
+
* @param id - The identifier passed to/returned from {@link addUrlSearchParam}.
|
|
194
198
|
*/
|
|
195
199
|
removeUrlSearchParam(id: string): void {
|
|
196
200
|
NativeTransformRequestModule.removeUrlSearchParam(id);
|
|
@@ -198,23 +202,26 @@ class TransformRequestManager {
|
|
|
198
202
|
|
|
199
203
|
/**
|
|
200
204
|
* Adds or updates an HTTP header identified by `id` that will be sent with all
|
|
201
|
-
* matching map resource requests. Re-adding an existing `id` updates the header
|
|
205
|
+
* matching map resource requests. Re-adding an existing `id` updates the header
|
|
206
|
+
* in-place.
|
|
207
|
+
*
|
|
208
|
+
* @param options - The options. Set {@link TransformOptions.id} to a stable string to enable
|
|
209
|
+
* in-place updates; if omitted an id is auto-generated and returned.
|
|
210
|
+
* @returns The id of the options. Pass it to {@link removeHeader} to remove it later.
|
|
202
211
|
*
|
|
203
|
-
* @example
|
|
204
|
-
*
|
|
212
|
+
* @example Add header to all requests
|
|
213
|
+
* ```
|
|
205
214
|
* TransformRequestManager.addHeader({ name: "Authorization", value: "Bearer token123" });
|
|
215
|
+
* ```
|
|
206
216
|
*
|
|
207
|
-
*
|
|
217
|
+
* @example Add header only to requests matching a pattern
|
|
218
|
+
* ```ts
|
|
208
219
|
* TransformRequestManager.addHeader({
|
|
209
220
|
* name: "X-API-Key",
|
|
210
221
|
* value: "key123",
|
|
211
222
|
* match: /https:\/\/api\.example\.com\/tiles\//,
|
|
212
223
|
* });
|
|
213
|
-
*
|
|
214
|
-
* @param options The options. Set {@link TransformOptions.id} to a stable string to
|
|
215
|
-
* enable in-place updates; if omitted an id is auto-generated and returned.
|
|
216
|
-
*
|
|
217
|
-
* @returns The id of the options. Pass it to {@link removeHeader} to remove it later.
|
|
224
|
+
* ```
|
|
218
225
|
*/
|
|
219
226
|
addHeader(options: HeaderOptions): string {
|
|
220
227
|
const id = options.id ?? this.getId();
|
|
@@ -239,7 +246,7 @@ class TransformRequestManager {
|
|
|
239
246
|
/**
|
|
240
247
|
* Removes a previously added HTTP header by its `id`.
|
|
241
248
|
*
|
|
242
|
-
* @param id The identifier passed to/returned from {@link addHeader}.
|
|
249
|
+
* @param id - The identifier passed to/returned from {@link addHeader}.
|
|
243
250
|
*/
|
|
244
251
|
removeHeader(id: string): void {
|
|
245
252
|
NativeTransformRequestModule.removeHeader(id);
|
|
@@ -7,7 +7,7 @@ export type MapLibrePluginProps =
|
|
|
7
7
|
/**
|
|
8
8
|
* Properties relevant only for Android
|
|
9
9
|
*
|
|
10
|
-
* @platform
|
|
10
|
+
* @platform Android
|
|
11
11
|
*/
|
|
12
12
|
android?: {
|
|
13
13
|
/**
|
|
@@ -17,7 +17,7 @@ export type MapLibrePluginProps =
|
|
|
17
17
|
/**
|
|
18
18
|
* Variant of `org.maplibre.gl:android-sdk-*`
|
|
19
19
|
*
|
|
20
|
-
* @
|
|
20
|
+
* @defaultValue "opengl"
|
|
21
21
|
*/
|
|
22
22
|
nativeVariant?: "opengl" | "vulkan";
|
|
23
23
|
/**
|
|
@@ -37,13 +37,15 @@ export type MapLibrePluginProps =
|
|
|
37
37
|
* Location engine to be used
|
|
38
38
|
*
|
|
39
39
|
* - `default`: Used per default from MapLibre; F-Droid compatible
|
|
40
|
-
* - `google`: Google Play Services Location Engine for higher precision; F-Droid
|
|
40
|
+
* - `google`: Google Play Services Location Engine for higher precision; F-Droid
|
|
41
|
+
* incompatible
|
|
41
42
|
*
|
|
42
|
-
* @
|
|
43
|
+
* @defaultValue "default"
|
|
43
44
|
*/
|
|
44
45
|
locationEngine?: "default" | "google";
|
|
45
46
|
/**
|
|
46
|
-
* Version for `com.google.android.gms:play-services-location
|
|
47
|
+
* Version for `com.google.android.gms:play-services-location` , only used with
|
|
48
|
+
* `locationEngine: "google"`
|
|
47
49
|
*/
|
|
48
50
|
googlePlayServicesLocationVersion?: VersionString;
|
|
49
51
|
};
|
|
@@ -51,7 +53,7 @@ export type MapLibrePluginProps =
|
|
|
51
53
|
/**
|
|
52
54
|
* Properties relevant only for iOS
|
|
53
55
|
*
|
|
54
|
-
* @platform
|
|
56
|
+
* @platform iOS
|
|
55
57
|
*/
|
|
56
58
|
ios?: {
|
|
57
59
|
/**
|
|
@@ -62,14 +64,7 @@ export type MapLibrePluginProps =
|
|
|
62
64
|
/**
|
|
63
65
|
* Swift Package Manager spec to override the selected version range
|
|
64
66
|
*
|
|
65
|
-
* @
|
|
66
|
-
* url: "https://github.com/maplibre/maplibre-gl-native-distribution",
|
|
67
|
-
* requirement: {
|
|
68
|
-
* kind: "exactVersion",
|
|
69
|
-
* version: $MLRN_NATIVE_VERSION
|
|
70
|
-
* },
|
|
71
|
-
* product_name: "MapLibre"
|
|
72
|
-
* }`
|
|
67
|
+
* @defaultValue `{ url: "https://github.com/maplibre/maplibre-gl-native-distribution", requirement: { kind: "exactVersion", version: $MLRN_NATIVE_VERSION }, product_name: "MapLibre" }`
|
|
73
68
|
*
|
|
74
69
|
* @example
|
|
75
70
|
* ```ts
|
|
@@ -80,7 +75,7 @@ export type MapLibrePluginProps =
|
|
|
80
75
|
* minimumVersion: "x.x.x"
|
|
81
76
|
* },
|
|
82
77
|
* product_name: "MapLibre"
|
|
83
|
-
* }
|
|
78
|
+
* }`;
|
|
84
79
|
* ```
|
|
85
80
|
*/
|
|
86
81
|
spmSpec?: string;
|