@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 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.0/index.html) to get an overview of what the MapsIndoors SDK offers.
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
 
@@ -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.0'
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:(NSInteger) 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 { return false }
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
- return resolve(displayRule.labelMaxWidth)
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
@@ -2,6 +2,7 @@
2
2
  #import <React/RCTEventEmitter.h>
3
3
 
4
4
  @interface RCT_EXTERN_MODULE(MapControlModule, RCTEventEmitter)
5
+
5
6
  RCT_EXTERN_METHOD(requiresMainQueueSetup)
6
7
 
7
8
  RCT_EXTERN_METHOD(supportedEvents)
@@ -7,7 +7,8 @@ import React
7
7
 
8
8
  @objc(MapControlModule)
9
9
  public class MapControlModule: RCTEventEmitter {
10
- @objc override public static func requiresMainQueueSetup() -> Bool {return false}
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(addEvent:(NSString *)name
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
- @objc static func requiresMainQueueSetup() -> Bool { return false }
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
- if (latestPosition?.floorIndex != positionResult.floorIndex) {
18
- let floorSelector = mapsIndoorsData.floorSelector
19
- floorSelector?.onUserPositionFloorChange(floorIndex: positionResult.floorIndex)
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
- delegate?.onPositionUpdate(position: positionResult)
23
- latestPosition = positionResult
23
+ self.delegate?.onPositionUpdate(position: positionResult)
24
+ self.latestPosition = positionResult
25
+ }
24
26
  }
25
27
  }
@@ -8,7 +8,6 @@
8
8
  #import <React/RCTBridgeModule.h>
9
9
 
10
10
  @interface RCT_EXTERN_MODULE(UtilsModule, NSObject)
11
-
12
11
  RCT_EXTERN_METHOD(requiresMainQueueSetup)
13
12
 
14
13
  RCT_EXTERN_METHOD(venueHasGraph: (NSString *) venueId
@@ -11,8 +11,9 @@ import MapsIndoorsCore
11
11
 
12
12
  @objc(UtilsModule)
13
13
  public class UtilsModule: NSObject {
14
- @objc static func requiresMainQueueSetup() -> Bool { return false }
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mapsindoors/react-native-maps-indoors-mapbox",
3
3
  "title": "React Native MapsIndoors Mapbox",
4
- "version": "2.4.0",
4
+ "version": "2.4.1",
5
5
  "description": "React Native MapsIndoors component with mapbox",
6
6
  "react-native": "index.ts",
7
7
  "files": [
@@ -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.3"
28
- s.dependency "MapsIndoorsCodable", "4.9.3"
27
+ s.dependency "MapsIndoorsMapbox11", "4.9.4"
28
+ s.dependency "MapsIndoorsCodable", "4.9.4"
29
29
  end
@@ -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
- style={style}
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');