@mapsindoors/react-native-maps-indoors-mapbox 2.3.1 → 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 +39 -2
- package/android/src/main/java/com/mapsindoorsrn/core/MapControlModule.java +21 -5
- package/android/src/main/java/com/mapsindoorsrn/core/MapsIndoorsModule.java +27 -0
- package/ios/MapsIndoorsViewManager.swift +3 -2
- 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 +2 -0
- package/ios/core/MapControlModule.swift +10 -3
- package/ios/core/MapsIndoorsBridge.m +5 -4
- package/ios/core/MapsIndoorsModule.swift +37 -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/MapControl.ts +1 -1
- package/src/core/MapView.tsx +4 -7
- package/src/core/MapsIndoors.ts +23 -0
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.
|
|
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.
|
|
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'
|
|
@@ -18,6 +18,8 @@ import com.google.gson.Gson;
|
|
|
18
18
|
import com.mapbox.geojson.Point;
|
|
19
19
|
import com.mapbox.maps.CameraOptions;
|
|
20
20
|
import com.mapbox.maps.CameraState;
|
|
21
|
+
import com.mapbox.maps.GlyphsRasterizationMode;
|
|
22
|
+
import com.mapbox.maps.GlyphsRasterizationOptions;
|
|
21
23
|
import com.mapbox.maps.MapInitOptions;
|
|
22
24
|
import com.mapbox.maps.MapView;
|
|
23
25
|
import com.mapbox.maps.plugin.compass.CompassUtils;
|
|
@@ -54,7 +56,9 @@ public class MapsIndoorsViewManager extends ViewGroupManager<MapView> {
|
|
|
54
56
|
@NonNull
|
|
55
57
|
@Override
|
|
56
58
|
protected MapView createViewInstance(@NonNull ThemedReactContext reactContext) {
|
|
57
|
-
MapInitOptions options = new MapInitOptions(reactContext, MapInitOptions.Companion.getDefaultMapOptions(reactContext)
|
|
59
|
+
MapInitOptions options = new MapInitOptions(reactContext, MapInitOptions.Companion.getDefaultMapOptions(reactContext).toBuilder()
|
|
60
|
+
.glyphsRasterizationOptions(new GlyphsRasterizationOptions.Builder().rasterizationMode(GlyphsRasterizationMode.ALL_GLYPHS_RASTERIZED_LOCALLY).build()).build(),
|
|
61
|
+
MapInitOptions.Companion.getDefaultPluginList(), new CameraOptions.Builder().pitch(0.0).build());
|
|
58
62
|
view = new MapView(reactContext, options);
|
|
59
63
|
return view;
|
|
60
64
|
}
|
|
@@ -65,6 +69,39 @@ public class MapsIndoorsViewManager extends ViewGroupManager<MapView> {
|
|
|
65
69
|
return MapBuilder.of("create", COMMAND_CREATE);
|
|
66
70
|
}
|
|
67
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
|
+
|
|
68
105
|
@Override
|
|
69
106
|
public void receiveCommand(@NonNull MapView root, String commandId, @Nullable ReadableArray args) {
|
|
70
107
|
super.receiveCommand(root, commandId, args);
|
|
@@ -89,7 +126,7 @@ public class MapsIndoorsViewManager extends ViewGroupManager<MapView> {
|
|
|
89
126
|
if (!args.isNull(2)) {
|
|
90
127
|
if (args.getBoolean(2)) {
|
|
91
128
|
CompassUtils.getCompass(view).setEnabled(true);
|
|
92
|
-
}else {
|
|
129
|
+
}else {
|
|
93
130
|
CompassUtils.getCompass(view).setEnabled(false);
|
|
94
131
|
}
|
|
95
132
|
}
|
|
@@ -172,26 +172,42 @@ public class MapControlModule extends ReactContextBaseJavaModule implements MPCa
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
@ReactMethod
|
|
175
|
-
public void goTo(String entityString, String entityType, final Promise promise) {
|
|
175
|
+
public void goTo(String entityString, String entityType, Double maxZoom, final Promise promise) {
|
|
176
176
|
switch (entityType) {
|
|
177
177
|
case "MPLocation": {
|
|
178
178
|
MPLocation location = gson.fromJson(entityString, Location.class).toMPLocation();
|
|
179
|
-
|
|
179
|
+
if (maxZoom != -999) {
|
|
180
|
+
mCtx.runOnUiQueueThread(() -> mMapControl.goTo(location, maxZoom));
|
|
181
|
+
}else {
|
|
182
|
+
mCtx.runOnUiQueueThread(() -> mMapControl.goTo(location));
|
|
183
|
+
}
|
|
180
184
|
break;
|
|
181
185
|
}
|
|
182
186
|
case "MPFloor": {
|
|
183
187
|
MPFloor floor = gson.fromJson(entityString, MPFloor.class);
|
|
184
|
-
|
|
188
|
+
if (maxZoom != -999) {
|
|
189
|
+
mCtx.runOnUiQueueThread(() -> mMapControl.goTo(floor, maxZoom));
|
|
190
|
+
}else {
|
|
191
|
+
mCtx.runOnUiQueueThread(() -> mMapControl.goTo(floor));
|
|
192
|
+
}
|
|
185
193
|
break;
|
|
186
194
|
}
|
|
187
195
|
case "MPBuilding": {
|
|
188
196
|
MPBuilding building = gson.fromJson(entityString, MPBuilding.class);
|
|
189
|
-
|
|
197
|
+
if (maxZoom != -999) {
|
|
198
|
+
mCtx.runOnUiQueueThread(() -> mMapControl.goTo(building, maxZoom));
|
|
199
|
+
}else {
|
|
200
|
+
mCtx.runOnUiQueueThread(() -> mMapControl.goTo(building));
|
|
201
|
+
}
|
|
190
202
|
break;
|
|
191
203
|
}
|
|
192
204
|
case "MPVenue": {
|
|
193
205
|
MPVenue venue = gson.fromJson(entityString, MPVenue.class);
|
|
194
|
-
|
|
206
|
+
if (maxZoom != -999) {
|
|
207
|
+
mCtx.runOnUiQueueThread(() -> mMapControl.goTo(venue, maxZoom));
|
|
208
|
+
}else {
|
|
209
|
+
mCtx.runOnUiQueueThread(() -> mMapControl.goTo(venue));
|
|
210
|
+
}
|
|
195
211
|
break;
|
|
196
212
|
}
|
|
197
213
|
}
|
|
@@ -12,6 +12,10 @@ import com.mapsindoors.core.MPBuilding;
|
|
|
12
12
|
import com.mapsindoors.core.MPBuildingCollection;
|
|
13
13
|
import com.mapsindoors.core.MPCategory;
|
|
14
14
|
import com.mapsindoors.core.MPCategoryCollection;
|
|
15
|
+
import com.mapsindoors.core.MPDataSetCache;
|
|
16
|
+
import com.mapsindoors.core.MPDataSetCacheManager;
|
|
17
|
+
import com.mapsindoors.core.MPDataSetCacheScope;
|
|
18
|
+
import com.mapsindoors.core.MPDataSetManagerStatus;
|
|
15
19
|
import com.mapsindoors.core.MPDisplayRule;
|
|
16
20
|
import com.mapsindoors.core.MPFilter;
|
|
17
21
|
import com.mapsindoors.core.MPLocation;
|
|
@@ -32,6 +36,7 @@ import com.mapsindoorsrn.core.models.PositionResult;
|
|
|
32
36
|
import com.mapsindoorsrn.core.models.Query;
|
|
33
37
|
|
|
34
38
|
import java.util.ArrayList;
|
|
39
|
+
import java.util.Collections;
|
|
35
40
|
import java.util.List;
|
|
36
41
|
|
|
37
42
|
public class MapsIndoorsModule extends ReactContextBaseJavaModule {
|
|
@@ -380,4 +385,26 @@ public class MapsIndoorsModule extends ReactContextBaseJavaModule {
|
|
|
380
385
|
promise.resolve(null);
|
|
381
386
|
}
|
|
382
387
|
}
|
|
388
|
+
|
|
389
|
+
@ReactMethod
|
|
390
|
+
public void cacheData(String apiKey, Promise promise) {
|
|
391
|
+
if (!MPDataSetCacheManager.isInitialized()) {
|
|
392
|
+
MPDataSetCacheManager.initialize(reactContext);
|
|
393
|
+
}
|
|
394
|
+
MPDataSetCache cache = MPDataSetCacheManager.getInstance().getDataSetByID(apiKey);
|
|
395
|
+
if (cache == null) {
|
|
396
|
+
cache = MPDataSetCacheManager.getInstance().addDataSetWithCachingScope(apiKey, MPDataSetCacheScope.FULL);
|
|
397
|
+
}else {
|
|
398
|
+
cache.setScope(MPDataSetCacheScope.FULL);
|
|
399
|
+
}
|
|
400
|
+
MPDataSetCache finalCache = cache;
|
|
401
|
+
MPDataSetCacheManager.getInstance().addMPDataSetCacheSyncListener(((mpDataSetCache, i) -> {
|
|
402
|
+
if (i == MPDataSetManagerStatus.SYNC_FINISHED && finalCache.getSolutionId().equals(mpDataSetCache.getSolutionId())) {
|
|
403
|
+
promise.resolve(true);
|
|
404
|
+
} else if (i == MPDataSetManagerStatus.SYNC_FAILED && finalCache.getSolutionId().equals(mpDataSetCache.getSolutionId())) {
|
|
405
|
+
promise.resolve(false);
|
|
406
|
+
}
|
|
407
|
+
}));
|
|
408
|
+
MPDataSetCacheManager.getInstance().synchronizeDataSets(Collections.singletonList(cache));
|
|
409
|
+
}
|
|
383
410
|
}
|
|
@@ -21,8 +21,9 @@ class MapsIndoorsViewManager : RCTViewManager {
|
|
|
21
21
|
pitch: 0
|
|
22
22
|
)
|
|
23
23
|
|
|
24
|
-
let options = MapInitOptions(
|
|
25
|
-
|
|
24
|
+
let options = MapInitOptions(
|
|
25
|
+
mapOptions: MapOptions(glyphsRasterizationOptions: GlyphsRasterizationOptions(rasterizationMode: .allGlyphsRasterizedLocally, fontFamily: nil)),
|
|
26
|
+
cameraOptions: cameraOptions)
|
|
26
27
|
|
|
27
28
|
mapView = MapView(frame: CGRect(x: 0, y: 0, width: 64, height: 64), mapInitOptions: options)
|
|
28
29
|
|
|
@@ -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
|
|
@@ -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)
|
|
@@ -41,6 +42,7 @@
|
|
|
41
42
|
|
|
42
43
|
RCT_EXTERN_METHOD(goTo:(NSString) entityJSON
|
|
43
44
|
entityType:(NSString) entityType
|
|
45
|
+
maxZoom:(nonnull NSNumber) maxZoom
|
|
44
46
|
resolver:(RCTPromiseResolveBlock) resolve
|
|
45
47
|
rejecter:(RCTPromiseRejectBlock) reject)
|
|
46
48
|
|
|
@@ -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)
|
|
@@ -153,11 +154,13 @@ public class MapControlModule: RCTEventEmitter {
|
|
|
153
154
|
rejecter reject: RCTPromiseRejectBlock) {
|
|
154
155
|
return resolve(MapsIndoorsData.sharedInstance.mapView?.getMapControl()?.showUserPosition)
|
|
155
156
|
}
|
|
156
|
-
|
|
157
|
+
|
|
157
158
|
@objc public func goTo(_ entityJSON: String,
|
|
158
159
|
entityType: String,
|
|
160
|
+
maxZoom: NSNumber?,
|
|
159
161
|
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
160
162
|
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
163
|
+
|
|
161
164
|
var entity: MPEntity? = nil
|
|
162
165
|
do {
|
|
163
166
|
switch entityType {
|
|
@@ -175,7 +178,11 @@ public class MapControlModule: RCTEventEmitter {
|
|
|
175
178
|
}
|
|
176
179
|
|
|
177
180
|
DispatchQueue.main.async {
|
|
178
|
-
|
|
181
|
+
if maxZoom != -999 {
|
|
182
|
+
MapsIndoorsData.sharedInstance.mapView?.getMapControl()!.goTo(entity: entity!, maxZoom: maxZoom!.doubleValue)
|
|
183
|
+
} else {
|
|
184
|
+
MapsIndoorsData.sharedInstance.mapView?.getMapControl()!.goTo(entity: entity!)
|
|
185
|
+
}
|
|
179
186
|
return resolve(nil)
|
|
180
187
|
}
|
|
181
188
|
} catch let e {
|
|
@@ -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
|
|
@@ -126,4 +123,8 @@ RCT_EXTERN_METHOD(requiresMainQueueSetup)
|
|
|
126
123
|
RCT_EXTERN_METHOD(getSyncedVenues:(RCTPromiseResolveBlock)resolve
|
|
127
124
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
128
125
|
|
|
126
|
+
RCT_EXTERN_METHOD(cacheData:(NSString) apiKey
|
|
127
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
128
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
129
|
+
|
|
129
130
|
@end
|
|
@@ -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));
|
|
@@ -324,4 +325,39 @@ public class MapsIndoorsModule: NSObject {
|
|
|
324
325
|
func getSyncedVenues(resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
325
326
|
return resolve(MPMapsIndoors.shared.venuesToSync)
|
|
326
327
|
}
|
|
328
|
+
|
|
329
|
+
@objc public func cacheData(_ apiKey: String, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
330
|
+
let datasetCacheManager = MPMapsIndoors.shared.datasetCacheManager
|
|
331
|
+
var dataSet = datasetCacheManager.dataSetWithId(apiKey)
|
|
332
|
+
if dataSet == nil {
|
|
333
|
+
dataSet = datasetCacheManager.addDataSet(apiKey, cachingScope: .full)
|
|
334
|
+
}
|
|
335
|
+
if dataSet == nil {
|
|
336
|
+
return resolve(false)
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
datasetCacheManager.delegate = DatasetDelegate(promise: resolve, dataset: dataSet!.cacheItem)
|
|
341
|
+
|
|
342
|
+
datasetCacheManager.synchronizeCacheItems([dataSet!.cacheItem])
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
class DatasetDelegate: NSObject, MPDataSetCacheManagerDelegate {
|
|
348
|
+
var promise: RCTPromiseResolveBlock
|
|
349
|
+
var dataset: MPDataSetCacheItem
|
|
350
|
+
|
|
351
|
+
init(promise: @escaping RCTPromiseResolveBlock, dataset: MPDataSetCacheItem) {
|
|
352
|
+
self.promise = promise
|
|
353
|
+
self.dataset = dataset
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
func dataSetManager(_ dataSetManager: MPDataSetCacheManager, didFinishSynchronizingItem item: MPDataSetCacheItem) {
|
|
357
|
+
if item.cachingItemId == dataset.cachingItemId {
|
|
358
|
+
return promise(true)
|
|
359
|
+
}else {
|
|
360
|
+
return promise(false)
|
|
361
|
+
}
|
|
362
|
+
}
|
|
327
363
|
}
|
|
@@ -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/MapControl.ts
CHANGED
|
@@ -320,7 +320,7 @@ export default class MapControl {
|
|
|
320
320
|
if (maxZoom) {
|
|
321
321
|
return MapControlModule.goTo(JSON.stringify(entity), entity.type, maxZoom);
|
|
322
322
|
}
|
|
323
|
-
return MapControlModule.goTo(JSON.stringify(entity), entity.type);
|
|
323
|
+
return MapControlModule.goTo(JSON.stringify(entity), entity.type, -999);
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
/**
|
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');
|
package/src/core/MapsIndoors.ts
CHANGED
|
@@ -528,14 +528,28 @@ export default class MapsIndoors {
|
|
|
528
528
|
});
|
|
529
529
|
}
|
|
530
530
|
|
|
531
|
+
/**
|
|
532
|
+
* Add venues to the sync list.
|
|
533
|
+
* @param venues list of venueIds to add to sync.
|
|
534
|
+
* @returns
|
|
535
|
+
*/
|
|
531
536
|
public static async addVenuesToSync(venues: string[]): Promise<void> {
|
|
532
537
|
return MapsIndoorsModule.addVenuesToSync(venues);
|
|
533
538
|
}
|
|
534
539
|
|
|
540
|
+
/**
|
|
541
|
+
* Remove venues from the sync list.
|
|
542
|
+
* @param venues List of venueIds to remove from sync.
|
|
543
|
+
* @returns
|
|
544
|
+
*/
|
|
535
545
|
public static async removeVenuesToSync(venues: string[]): Promise<void> {
|
|
536
546
|
return MapsIndoorsModule.removeVenuesToSync(venues);
|
|
537
547
|
}
|
|
538
548
|
|
|
549
|
+
/**
|
|
550
|
+
* Get a list of venueIds that are synced.
|
|
551
|
+
* @returns Promise<string[]> A list of venueIds that are synced.
|
|
552
|
+
*/
|
|
539
553
|
public static async getSyncedVenues(): Promise<string[]> {
|
|
540
554
|
return MapsIndoorsModule.getSyncedVenues().then((venues: string[]|null) => {
|
|
541
555
|
if (venues === null || venues === undefined) {
|
|
@@ -545,4 +559,13 @@ export default class MapsIndoors {
|
|
|
545
559
|
}
|
|
546
560
|
});
|
|
547
561
|
}
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Cache all data for the current solution. Including tiles and images if present on the solution.
|
|
565
|
+
* @param apiKey The key to the MapsIndoors solution.
|
|
566
|
+
* @returns Promise<boolean> True if the caching was successful, otherwise false.
|
|
567
|
+
*/
|
|
568
|
+
public static async cacheData(apiKey: String): Promise<boolean> {
|
|
569
|
+
return MapsIndoorsModule.cacheData(apiKey);
|
|
570
|
+
}
|
|
548
571
|
}
|