@mapsindoors/react-native-maps-indoors-mapbox 2.4.0 → 2.4.1
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/README.md +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/mapsindoorsrn/MapsIndoorsViewManager.java +33 -0
- package/ios/core/DirectionsRendererBridge.m +0 -5
- package/ios/core/DirectionsServiceModule.swift +1 -1
- package/ios/core/MPDisplayRuleBridge.m +3 -2
- package/ios/core/MPDisplayRuleModule.swift +7 -2
- package/ios/core/MapControlBridge.m +1 -0
- package/ios/core/MapControlModule.swift +2 -1
- package/ios/core/MapsIndoorsBridge.m +1 -4
- package/ios/core/MapsIndoorsModule.swift +2 -1
- package/ios/core/ReactPositionProvider.swift +8 -6
- package/ios/core/UtilsBridge.m +0 -1
- package/ios/core/UtilsModule.swift +3 -2
- package/package.json +1 -1
- package/react-native-maps-indoors-mapbox.podspec +2 -2
- package/src/core/MapView.tsx +4 -7
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Documentation
|
|
4
4
|
|
|
5
|
-
Visit [our reference document site](https://app.mapsindoors.com/mapsindoors/reference/react-native/mapbox/2.4.
|
|
5
|
+
Visit [our reference document site](https://app.mapsindoors.com/mapsindoors/reference/react-native/mapbox/2.4.1/index.html) to get an overview of what the MapsIndoors SDK offers.
|
|
6
6
|
|
|
7
7
|
## Getting started
|
|
8
8
|
|
package/android/build.gradle
CHANGED
|
@@ -93,7 +93,7 @@ dependencies {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
implementation 'com.mapbox.maps:android:11.7.0'
|
|
96
|
-
implementation 'com.mapspeople.mapsindoors:mapbox-v11:4.11.
|
|
96
|
+
implementation 'com.mapspeople.mapsindoors:mapbox-v11:4.11.1'
|
|
97
97
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
98
98
|
implementation 'androidx.core:core-ktx:1.3.2'
|
|
99
99
|
implementation 'com.github.bumptech.glide:glide:4.16.0'
|
|
@@ -69,6 +69,39 @@ public class MapsIndoorsViewManager extends ViewGroupManager<MapView> {
|
|
|
69
69
|
return MapBuilder.of("create", COMMAND_CREATE);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
@Override
|
|
73
|
+
public void receiveCommand(@NonNull MapView root, int commandId, @Nullable ReadableArray args) {
|
|
74
|
+
super.receiveCommand(root, commandId, args);
|
|
75
|
+
if (commandId == COMMAND_CREATE) {
|
|
76
|
+
int reactNativeViewId = args.getInt(0);
|
|
77
|
+
|
|
78
|
+
createMapFragment(root, reactNativeViewId);
|
|
79
|
+
|
|
80
|
+
if (!args.isNull(1)) {
|
|
81
|
+
MPCameraPosition cameraPosition = gson.fromJson(args.getString(1), MPCameraPosition.class);
|
|
82
|
+
CameraState cameraState = view.getMapboxMap().getCameraState();
|
|
83
|
+
view.getMapboxMap().setCamera(new CameraOptions.Builder()
|
|
84
|
+
.center(Point.fromLngLat(cameraPosition.target.getLng(), cameraPosition.target.getLat()))
|
|
85
|
+
.zoom(cameraPosition.zoom != null ? Double.valueOf(cameraPosition.zoom) : cameraState.getZoom())
|
|
86
|
+
.pitch(cameraPosition.tilt != null ? Double.valueOf(cameraPosition.tilt) : cameraState.getPitch())
|
|
87
|
+
.bearing(cameraPosition.bearing != null ? Double.valueOf(cameraPosition.bearing) : cameraState.getBearing())
|
|
88
|
+
.build());
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (!args.isNull(2)) {
|
|
92
|
+
if (args.getBoolean(2)) {
|
|
93
|
+
CompassUtils.getCompass(view).setEnabled(true);
|
|
94
|
+
}else {
|
|
95
|
+
CompassUtils.getCompass(view).setEnabled(false);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (!args.isNull(3)) {
|
|
100
|
+
view.getMapboxMap().loadStyle(args.getString(3));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
72
105
|
@Override
|
|
73
106
|
public void receiveCommand(@NonNull MapView root, String commandId, @Nullable ReadableArray args) {
|
|
74
107
|
super.receiveCommand(root, commandId, args);
|
|
@@ -39,11 +39,6 @@
|
|
|
39
39
|
RCT_EXTERN_METHOD(setOnLegSelectedListener: (RCTPromiseResolveBlock) resolve
|
|
40
40
|
rejecter:(RCTPromiseRejectBlock) reject)
|
|
41
41
|
|
|
42
|
-
RCT_EXTERN_METHOD(setPolyLineColors: (NSString *) foregroundString
|
|
43
|
-
backgroundString:(NSString *): backgroundString
|
|
44
|
-
resolver:(RCTPromiseResolveBlock) resolve
|
|
45
|
-
rejecter:(RCTPromiseRejectBlock) reject)
|
|
46
|
-
|
|
47
42
|
RCT_EXTERN_METHOD(setRoute: (NSString *) routeString
|
|
48
43
|
stopIcons:(NSString *) stopIcons
|
|
49
44
|
legIndex: (nonnull NSNumber *) legIndex
|
|
@@ -13,7 +13,7 @@ import MapsIndoorsCodable
|
|
|
13
13
|
public class DirectionsServiceModule: NSObject {
|
|
14
14
|
|
|
15
15
|
var directionsVariables = [String: DirectionsVariables]()
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
@objc static func requiresMainQueueSetup() -> Bool { return false }
|
|
18
18
|
|
|
19
19
|
@objc func create(_ resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#import <React/RCTBridgeModule.h>
|
|
2
2
|
|
|
3
3
|
@interface RCT_EXTERN_MODULE(DisplayRule, NSObject)
|
|
4
|
-
RCT_EXTERN_METHOD(requiresMainQueueSetup)
|
|
5
4
|
// End of head
|
|
5
|
+
|
|
6
|
+
RCT_EXTERN_METHOD(requiresMainQueueSetup)
|
|
6
7
|
|
|
7
8
|
// GetterBridge isVisible->visible
|
|
8
9
|
RCT_EXTERN_METHOD(isVisible: (NSString *) displayRuleId
|
|
@@ -165,7 +166,7 @@ RCT_EXTERN_METHOD(requiresMainQueueSetup)
|
|
|
165
166
|
|
|
166
167
|
// SetterBridge setLabelMaxWidth->labelMaxWidth
|
|
167
168
|
RCT_EXTERN_METHOD(setLabelMaxWidth: (NSString *) displayRuleId
|
|
168
|
-
value:(
|
|
169
|
+
value:(NSUInteger) value
|
|
169
170
|
resolver:(RCTPromiseResolveBlock) resolve
|
|
170
171
|
rejecter:(RCTPromiseRejectBlock) reject)
|
|
171
172
|
|
|
@@ -21,7 +21,7 @@ private func doReject(_ reject: RCTPromiseRejectBlock, displayRuleId: String,
|
|
|
21
21
|
@objc(DisplayRule)
|
|
22
22
|
public class MPDisplayRuleModule: NSObject {
|
|
23
23
|
|
|
24
|
-
@objc static func requiresMainQueueSetup() -> Bool {
|
|
24
|
+
@objc public static func requiresMainQueueSetup() -> Bool {return false}
|
|
25
25
|
|
|
26
26
|
private func getIconPlacement(iconPlacement: NSNumber) -> MPIconPlacement {
|
|
27
27
|
switch(iconPlacement.intValue) {
|
|
@@ -505,7 +505,12 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
505
505
|
return doReject(reject, displayRuleId: displayRuleId)
|
|
506
506
|
}
|
|
507
507
|
|
|
508
|
-
|
|
508
|
+
let maxWidth = displayRule.labelMaxWidth
|
|
509
|
+
if maxWidth == UInt.max {
|
|
510
|
+
return resolve(-1)
|
|
511
|
+
}else {
|
|
512
|
+
return resolve(displayRule.labelMaxWidth)
|
|
513
|
+
}
|
|
509
514
|
}
|
|
510
515
|
|
|
511
516
|
// Setter setLabelMaxWidth->labelMaxWidth
|
|
@@ -7,7 +7,8 @@ import React
|
|
|
7
7
|
|
|
8
8
|
@objc(MapControlModule)
|
|
9
9
|
public class MapControlModule: RCTEventEmitter {
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
@objc public override static func requiresMainQueueSetup() -> Bool { return false }
|
|
11
12
|
|
|
12
13
|
enum HexParsingError: Error {
|
|
13
14
|
case invalidHexString(String)
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
#import <React/RCTBridgeModule.h>
|
|
2
2
|
|
|
3
3
|
@interface RCT_EXTERN_MODULE(MapsIndoorsModule, NSObject)
|
|
4
|
-
RCT_EXTERN_METHOD(requiresMainQueueSetup)
|
|
5
4
|
|
|
6
|
-
RCT_EXTERN_METHOD(
|
|
7
|
-
location:(NSString *)location
|
|
8
|
-
date:(nonnull NSNumber *)date)
|
|
5
|
+
RCT_EXTERN_METHOD(requiresMainQueueSetup)
|
|
9
6
|
|
|
10
7
|
RCT_EXTERN_METHOD(loadMapsIndoors:(NSString *)apiKey
|
|
11
8
|
optionalStrings:(NSArray<NSString *> _Nullable)optionalStrings
|
|
@@ -7,7 +7,8 @@ import React
|
|
|
7
7
|
|
|
8
8
|
@objc(MapsIndoorsModule)
|
|
9
9
|
public class MapsIndoorsModule: NSObject {
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
@objc public static func requiresMainQueueSetup() -> Bool {return false}
|
|
11
12
|
|
|
12
13
|
@objc public func test() {
|
|
13
14
|
print("%@.test()", String(describing: self));
|
|
@@ -14,12 +14,14 @@ public class ReactPositionProvider: MPPositionProvider {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
public func setLatestPosition(positionResult: MPPositionResult) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
DispatchQueue.main.async {
|
|
18
|
+
if (self.latestPosition?.floorIndex != positionResult.floorIndex) {
|
|
19
|
+
let floorSelector = self.mapsIndoorsData.floorSelector
|
|
20
|
+
floorSelector?.onUserPositionFloorChange(floorIndex: positionResult.floorIndex)
|
|
21
|
+
}
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
self.delegate?.onPositionUpdate(position: positionResult)
|
|
24
|
+
self.latestPosition = positionResult
|
|
25
|
+
}
|
|
24
26
|
}
|
|
25
27
|
}
|
package/ios/core/UtilsBridge.m
CHANGED
|
@@ -11,8 +11,9 @@ import MapsIndoorsCore
|
|
|
11
11
|
|
|
12
12
|
@objc(UtilsModule)
|
|
13
13
|
public class UtilsModule: NSObject {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
|
|
15
|
+
@objc public static func requiresMainQueueSetup() -> Bool {return false}
|
|
16
|
+
|
|
16
17
|
@objc public func venueHasGraph(_ venueId: String, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
17
18
|
Task {
|
|
18
19
|
guard let venue = await MPMapsIndoors.shared.venueWith(id: venueId) else {
|
package/package.json
CHANGED
|
@@ -24,6 +24,6 @@ Pod::Spec.new do |s|
|
|
|
24
24
|
s.requires_arc = true
|
|
25
25
|
|
|
26
26
|
s.dependency "React"
|
|
27
|
-
s.dependency "MapsIndoorsMapbox11", "4.9.
|
|
28
|
-
s.dependency "MapsIndoorsCodable", "4.9.
|
|
27
|
+
s.dependency "MapsIndoorsMapbox11", "4.9.4"
|
|
28
|
+
s.dependency "MapsIndoorsCodable", "4.9.4"
|
|
29
29
|
end
|
package/src/core/MapView.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { useEffect, useRef } from 'react';
|
|
3
|
-
import { Platform, UIManager, findNodeHandle, requireNativeComponent } from "react-native";
|
|
3
|
+
import { Platform, UIManager, ViewProps, findNodeHandle, requireNativeComponent } from "react-native";
|
|
4
4
|
import MPCameraPosition from './MPCameraPosition';
|
|
5
5
|
|
|
6
6
|
const createFragment = (viewId: number | null, camera?: MPCameraPosition, showCompass?: boolean, mapboxMapStyle?: String) => {
|
|
@@ -16,7 +16,7 @@ const createFragment = (viewId: number | null, camera?: MPCameraPosition, showCo
|
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const MapView = ({ style, camera, showCompass, mapboxMapStyle }: { style: any, camera?: MPCameraPosition, showCompass?: boolean, mapboxMapStyle?: string}) => {
|
|
19
|
+
const MapView = ({ style, camera, showCompass, mapboxMapStyle }: { style: any, camera?: MPCameraPosition, showCompass?: boolean, mapboxMapStyle?: string, [key: string]: any }) => {
|
|
20
20
|
const ref = useRef(null);
|
|
21
21
|
|
|
22
22
|
useEffect(() => {
|
|
@@ -25,11 +25,8 @@ const MapView = ({ style, camera, showCompass, mapboxMapStyle }: { style: any, c
|
|
|
25
25
|
}, []);
|
|
26
26
|
|
|
27
27
|
return (<MapsIndoorsViewManager
|
|
28
|
-
|
|
29
|
-
ref={ref}
|
|
30
|
-
camera={camera}
|
|
31
|
-
showCompass={showCompass}
|
|
32
|
-
mapboxMapStyle={mapboxMapStyle} />);
|
|
28
|
+
{...{ style, camera, showCompass, mapboxMapStyle }}
|
|
29
|
+
ref={ref}/>);
|
|
33
30
|
}
|
|
34
31
|
|
|
35
32
|
const MapsIndoorsViewManager = requireNativeComponent('MapsIndoorsView');
|