react-native-steerpath-smart-map 1.29.4 → 2.0.0-alpha.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/.eslintrc.js +66 -0
- package/.prettierrc +7 -0
- package/CHANGELOG.md +39 -0
- package/README.md +7 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNEventKeys.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartGeofenceManager.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartLocationManager.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapManager.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapModule.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapPackage.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapPackage.kt +28 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapView.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapViewManager.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/Utils.class +0 -0
- package/android/build.gradle +22 -33
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartLocationManager.java +22 -14
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapManager.java +9 -31
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapPackage.java +11 -9
- package/android/src/main/java/com/steerpath/rnsmartmap/Utils.java +36 -36
- package/ios/RNSmartLocationManager.m +28 -3
- package/ios/RNSmartMapManager.m +10 -22
- package/lib/commonjs/SmartLocationManager.js +50 -0
- package/lib/commonjs/SmartLocationManager.js.map +1 -0
- package/lib/commonjs/SmartLocationManager.web.js +11 -0
- package/lib/commonjs/SmartLocationManager.web.js.map +1 -0
- package/lib/commonjs/SmartMapManager.js +59 -0
- package/lib/commonjs/SmartMapManager.js.map +1 -0
- package/lib/commonjs/SmartMapManager.web.js +24 -0
- package/lib/commonjs/SmartMapManager.web.js.map +1 -0
- package/lib/commonjs/index.js +28 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/module/SmartLocationManager.js +46 -0
- package/lib/module/SmartLocationManager.js.map +1 -0
- package/lib/module/SmartLocationManager.web.js +7 -0
- package/lib/module/SmartLocationManager.web.js.map +1 -0
- package/lib/module/SmartMapManager.js +54 -0
- package/lib/module/SmartMapManager.js.map +1 -0
- package/lib/module/SmartMapManager.web.js +20 -0
- package/lib/module/SmartMapManager.web.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/SmartLocationManager.d.ts +19 -0
- package/lib/typescript/SmartLocationManager.d.ts.map +1 -0
- package/{dist → lib/typescript}/SmartLocationManager.web.d.ts +1 -0
- package/lib/typescript/SmartLocationManager.web.d.ts.map +1 -0
- package/{dist → lib/typescript}/SmartMapManager.d.ts +13 -15
- package/lib/typescript/SmartMapManager.d.ts.map +1 -0
- package/lib/typescript/SmartMapManager.web.d.ts +8 -0
- package/lib/typescript/SmartMapManager.web.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +5 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/package.json +38 -13
- package/react-native-steerpath-smart-map.podspec +15 -12
- package/src/SmartLocationManager.ts +25 -9
- package/src/SmartMapManager.ts +12 -19
- package/src/SmartMapManager.web.ts +3 -24
- package/src/index.ts +3 -4
- package/tsconfig.json +14 -9
- package/.eslintrc.json +0 -81
- package/android/src/main/java/com/steerpath/rnsmartmap/RNEventKeys.java +0 -29
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartGeofenceManager.java +0 -103
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapModule.java +0 -284
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapView.java +0 -470
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapViewManager.java +0 -307
- package/dist/SmartGeofenceManager.d.ts +0 -17
- package/dist/SmartGeofenceManager.js +0 -61
- package/dist/SmartGeofenceManager.web.d.ts +0 -9
- package/dist/SmartGeofenceManager.web.js +0 -10
- package/dist/SmartLocationManager.d.ts +0 -11
- package/dist/SmartLocationManager.js +0 -22
- package/dist/SmartLocationManager.web.js +0 -4
- package/dist/SmartMapEventManager.web.d.ts +0 -5
- package/dist/SmartMapEventManager.web.js +0 -10
- package/dist/SmartMapManager.js +0 -53
- package/dist/SmartMapManager.web.d.ts +0 -12
- package/dist/SmartMapManager.web.js +0 -33
- package/dist/SmartMapView.d.ts +0 -3
- package/dist/SmartMapView.js +0 -294
- package/dist/SmartMapView.web.d.ts +0 -3
- package/dist/SmartMapView.web.js +0 -270
- package/dist/SmartMapViewProps.d.ts +0 -267
- package/dist/SmartMapViewProps.js +0 -76
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -5
- package/dist/internalUtils.d.ts +0 -1
- package/dist/internalUtils.js +0 -5
- package/ios/RCTConvert+SmartMapView.h +0 -35
- package/ios/RCTConvert+SmartMapView.m +0 -295
- package/ios/RNSmartGeofenceManager.h +0 -24
- package/ios/RNSmartGeofenceManager.m +0 -110
- package/ios/RNSmartMapUserTaskEventManager.h +0 -19
- package/ios/RNSmartMapUserTaskEventManager.m +0 -46
- package/ios/RNSmartMapView.h +0 -37
- package/ios/RNSmartMapView.m +0 -21
- package/ios/RNSmartMapViewManager.h +0 -27
- package/ios/RNSmartMapViewManager.m +0 -608
- package/package-lock.json +0 -6570
- package/src/SmartGeofenceManager.ts +0 -94
- package/src/SmartGeofenceManager.web.ts +0 -11
- package/src/SmartMapEventManager.web.ts +0 -13
- package/src/SmartMapView.tsx +0 -377
- package/src/SmartMapView.web.tsx +0 -342
- package/src/SmartMapViewProps.ts +0 -338
- package/src/internalUtils.ts +0 -5
- package/src/typings/steerpath-smart-sdk.d.ts +0 -5
|
@@ -1,608 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// RNSPSmartView.m
|
|
3
|
-
// SteerpathOfficeApp
|
|
4
|
-
//
|
|
5
|
-
// Created by Jarvis Luong on 23/07/2019.
|
|
6
|
-
// Copyright © 2019 Facebook. All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
#import "RNSmartMapViewManager.h"
|
|
10
|
-
|
|
11
|
-
@implementation RNSmartMapViewManager
|
|
12
|
-
{
|
|
13
|
-
NSHashTable* mapEventManagers;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
- (instancetype)init
|
|
17
|
-
{
|
|
18
|
-
self = [super init];
|
|
19
|
-
mapEventManagers = [NSHashTable new];
|
|
20
|
-
return self;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
+ (BOOL)requiresMainQueueSetup
|
|
24
|
-
{
|
|
25
|
-
return YES;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
RCT_EXPORT_MODULE(RNSmartMapView)
|
|
29
|
-
|
|
30
|
-
- (UIView *)view
|
|
31
|
-
{
|
|
32
|
-
RNSmartMapView* view = [RNSmartMapView new];
|
|
33
|
-
RNSmartMapUserTaskEventManager* mapEventManager = [[RNSmartMapUserTaskEventManager alloc] initWithMapView:view];
|
|
34
|
-
[mapEventManagers addObject:mapEventManager];
|
|
35
|
-
view.delegate = self;
|
|
36
|
-
view.userTaskDelegate = mapEventManager;
|
|
37
|
-
return view;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
RCT_EXPORT_VIEW_PROPERTY(onMapLoaded, RCTBubblingEventBlock)
|
|
41
|
-
RCT_EXPORT_VIEW_PROPERTY(onMapClicked, RCTBubblingEventBlock)
|
|
42
|
-
RCT_EXPORT_VIEW_PROPERTY(onUserFloorChanged, RCTBubblingEventBlock)
|
|
43
|
-
RCT_EXPORT_VIEW_PROPERTY(onVisibleFloorChanged, RCTBubblingEventBlock)
|
|
44
|
-
RCT_EXPORT_VIEW_PROPERTY(onViewStatusChanged, RCTBubblingEventBlock)
|
|
45
|
-
RCT_EXPORT_VIEW_PROPERTY(onBottomSheetStateChanged, RCTBubblingEventBlock)
|
|
46
|
-
RCT_EXPORT_VIEW_PROPERTY(onNavigationEnded, RCTBubblingEventBlock)
|
|
47
|
-
RCT_EXPORT_VIEW_PROPERTY(onNavigationFailed, RCTBubblingEventBlock)
|
|
48
|
-
RCT_EXPORT_VIEW_PROPERTY(onNavigationStarted, RCTBubblingEventBlock)
|
|
49
|
-
RCT_EXPORT_VIEW_PROPERTY(onNavigationPreviewAppeared, RCTBubblingEventBlock)
|
|
50
|
-
RCT_EXPORT_VIEW_PROPERTY(onNavigationDestinationReached, RCTBubblingEventBlock)
|
|
51
|
-
RCT_EXPORT_VIEW_PROPERTY(onUserTaskResponse, RCTBubblingEventBlock)
|
|
52
|
-
RCT_EXPORT_VIEW_PROPERTY(onSearchResultSelected, RCTBubblingEventBlock)
|
|
53
|
-
RCT_EXPORT_VIEW_PROPERTY(onSearchCategorySelected, RCTBubblingEventBlock)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
RCT_EXPORT_METHOD(setMapMode:(nonnull NSNumber*) reactTag
|
|
57
|
-
mapMode:(nullable NSString*)mapMode)
|
|
58
|
-
{ // The one we want to switch on
|
|
59
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
60
|
-
RNSmartMapView *view = viewRegistry[reactTag];
|
|
61
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
62
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
NSArray *items = @[@"mapOnly", @"search", @"static"];
|
|
66
|
-
int item = [items indexOfObject:mapMode];
|
|
67
|
-
switch (item) {
|
|
68
|
-
case 0:
|
|
69
|
-
[view setMapMode:SPMapModeMapOnly];
|
|
70
|
-
break;
|
|
71
|
-
case 1:
|
|
72
|
-
[view setMapMode:SPMapModeSearch];
|
|
73
|
-
break;
|
|
74
|
-
case 2:
|
|
75
|
-
[view setMapMode:SPMapModeStatic];
|
|
76
|
-
break;
|
|
77
|
-
default:
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
}];
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
RCT_EXPORT_METHOD(setWidgetPadding:(nonnull NSNumber*) reactTag
|
|
85
|
-
left:(nonnull NSNumber*)left
|
|
86
|
-
top:(nonnull NSNumber*)top
|
|
87
|
-
right:(nonnull NSNumber*)right
|
|
88
|
-
bottom:(nonnull NSNumber*)bottom)
|
|
89
|
-
{ // The one we want to switch on
|
|
90
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
91
|
-
RNSmartMapView *view = viewRegistry[reactTag];
|
|
92
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
93
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
[view setWidgetPadding:left.floatValue top:top.floatValue right:right.floatValue bottom:bottom.floatValue];
|
|
97
|
-
}];
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
RCT_EXPORT_METHOD(setCamera:(nonnull NSNumber*) reactTag
|
|
102
|
-
latitude:(nonnull NSNumber*)latitude
|
|
103
|
-
longitude:(nonnull NSNumber*)longitude
|
|
104
|
-
zoomLevel:(nonnull NSNumber*)zoomLevel
|
|
105
|
-
bearing:(nonnull NSNumber*)bearing
|
|
106
|
-
pitch:(nonnull NSNumber*)pitch
|
|
107
|
-
floorIndex:(nonnull NSNumber*)floorIndex
|
|
108
|
-
buildingRef:(nonnull NSString *)buildingRef)
|
|
109
|
-
{
|
|
110
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
111
|
-
RNSmartMapView *view = viewRegistry[reactTag];
|
|
112
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
113
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
[view setCamera:[latitude doubleValue] longitude:[longitude doubleValue] zoomLevel:[zoomLevel doubleValue] bearing:[bearing doubleValue] pitch:[pitch doubleValue] floorIndex:[floorIndex intValue] buildingRef:buildingRef];
|
|
117
|
-
}];
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
RCT_EXPORT_METHOD(setCameraToBuildingRef:(nonnull NSNumber*) reactTag
|
|
121
|
-
buildingRef:(nonnull NSString*) buildingRef
|
|
122
|
-
callback:(RCTResponseSenderBlock)callback)
|
|
123
|
-
{
|
|
124
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
125
|
-
RNSmartMapView *view = (RNSmartMapView*)viewRegistry[reactTag];
|
|
126
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
127
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
[view setCameraToBuildingRef:buildingRef
|
|
131
|
-
completion:^(SPMapResponse response) {
|
|
132
|
-
callback(@[[NSNull null], [RCTConvert SPMapResponse:response]]);
|
|
133
|
-
}];
|
|
134
|
-
}];
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
RCT_EXPORT_METHOD(setCameraToObject:(nonnull NSNumber*) reactTag
|
|
138
|
-
localRef:(nonnull NSString*) localRef
|
|
139
|
-
buildingRef:(nonnull NSString*) buildingRef
|
|
140
|
-
zoomLevel:(nonnull NSNumber*) zoomLevel
|
|
141
|
-
callback:(RCTResponseSenderBlock)callback)
|
|
142
|
-
{
|
|
143
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
144
|
-
RNSmartMapView *view = (RNSmartMapView*)viewRegistry[reactTag];
|
|
145
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
146
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
[view setCameraToObject:localRef
|
|
150
|
-
buildingRef:buildingRef
|
|
151
|
-
zoomLevel:[zoomLevel doubleValue]
|
|
152
|
-
completion:^(SPMapResponse response) {
|
|
153
|
-
callback(@[[NSNull null], [RCTConvert SPMapResponse:response]]);
|
|
154
|
-
}];
|
|
155
|
-
}];
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
RCT_EXPORT_METHOD(addMarker:(nonnull NSNumber*) reactTag
|
|
159
|
-
mapObject:(id)mapObject
|
|
160
|
-
layout:(NSString*)layout
|
|
161
|
-
iconName:(NSString*)iconName
|
|
162
|
-
textColor:(NSString*)textColor
|
|
163
|
-
textHaloColor:(NSString*)textHaloColor)
|
|
164
|
-
{
|
|
165
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
166
|
-
RNSmartMapView *view = (RNSmartMapView*)viewRegistry[reactTag];
|
|
167
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
168
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
if (mapObject) {
|
|
172
|
-
if (iconName && textColor && textHaloColor) {
|
|
173
|
-
[view addMarker:[RCTConvert SPSmartMapObject:mapObject]
|
|
174
|
-
layout:layout ? [RCTConvert SPLayout:layout] : SPLayoutTop
|
|
175
|
-
iconName:iconName
|
|
176
|
-
textColor:textColor
|
|
177
|
-
textHaloColor:textHaloColor];
|
|
178
|
-
} else {
|
|
179
|
-
[view addMarker:[RCTConvert SPSmartMapObject:mapObject]];
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}];
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
RCT_EXPORT_METHOD(setGeoJson:(nonnull NSNumber*) reactTag
|
|
187
|
-
sourceId:(nonnull NSString*)sourceId
|
|
188
|
-
geoJson:(NSDictionary*)geoJson
|
|
189
|
-
callback:(RCTResponseSenderBlock)callback)
|
|
190
|
-
{
|
|
191
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
192
|
-
RNSmartMapView *view = (RNSmartMapView*)viewRegistry[reactTag];
|
|
193
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
194
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
[view setGeoJson:sourceId geoJson:geoJson completion:^(SPMapResponse response) {
|
|
198
|
-
callback(@[[RCTConvert SPMapResponse:response]]);
|
|
199
|
-
}];
|
|
200
|
-
}];
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
RCT_EXPORT_METHOD(addMarkers:(nonnull NSNumber*) reactTag
|
|
204
|
-
mapObjectsArray:(id)mapObjectsArray
|
|
205
|
-
layout:(NSString*)layout
|
|
206
|
-
iconName:(NSString*)iconName
|
|
207
|
-
textColor:(NSString*)textColor
|
|
208
|
-
textHaloColor:(NSString*)textHaloColor)
|
|
209
|
-
{
|
|
210
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
211
|
-
RNSmartMapView *view = (RNSmartMapView*)viewRegistry[reactTag];
|
|
212
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
213
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
if (mapObjectsArray && [mapObjectsArray isKindOfClass:[NSArray class]]) {
|
|
217
|
-
NSMutableArray* smartMapObjects = [NSMutableArray array];
|
|
218
|
-
for (int i = 0; i < [mapObjectsArray count];i++) {
|
|
219
|
-
id mapObject = [mapObjectsArray objectAtIndex:i];
|
|
220
|
-
[smartMapObjects addObject:[RCTConvert SPSmartMapObject:mapObject]];
|
|
221
|
-
}
|
|
222
|
-
if (iconName && textColor && textHaloColor) {
|
|
223
|
-
[view addMarkers:smartMapObjects layout:[RCTConvert SPLayout:layout] iconName:iconName textColor:textColor textHaloColor:textHaloColor];
|
|
224
|
-
} else {
|
|
225
|
-
[view addMarkers:smartMapObjects];
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}];
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
RCT_EXPORT_METHOD(removeMarker:(nonnull NSNumber*) reactTag
|
|
233
|
-
mapObject:(id)json)
|
|
234
|
-
{
|
|
235
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
236
|
-
RNSmartMapView *view = (RNSmartMapView*)viewRegistry[reactTag];
|
|
237
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
238
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
if (json) {
|
|
242
|
-
[view removeMarker:[RCTConvert SPSmartMapObject:json]];
|
|
243
|
-
}
|
|
244
|
-
}];
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
RCT_EXPORT_METHOD(removeMarkers:(nonnull NSNumber*) reactTag
|
|
249
|
-
mapObjectsArray:(id)mapObjectsArray)
|
|
250
|
-
{
|
|
251
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
252
|
-
RNSmartMapView *view = (RNSmartMapView*)viewRegistry[reactTag];
|
|
253
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
254
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
if (mapObjectsArray && [mapObjectsArray isKindOfClass:[NSArray class]]) {
|
|
258
|
-
NSMutableArray* smartMapObjects = [NSMutableArray array];
|
|
259
|
-
for (int i = 0; i < [mapObjectsArray count];i++) {
|
|
260
|
-
id mapObject = [mapObjectsArray objectAtIndex:i];
|
|
261
|
-
[smartMapObjects addObject:[RCTConvert SPSmartMapObject:mapObject]];
|
|
262
|
-
}
|
|
263
|
-
[view removeMarkers:smartMapObjects];
|
|
264
|
-
}
|
|
265
|
-
}];
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
RCT_EXPORT_METHOD(removeAllMarkers:(nonnull NSNumber*) reactTag)
|
|
270
|
-
{
|
|
271
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
272
|
-
RNSmartMapView *view = (RNSmartMapView*)viewRegistry[reactTag];
|
|
273
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
274
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
[view removeAllMarkers];
|
|
278
|
-
}];
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
RCT_EXPORT_METHOD(selectMapObject:(nonnull NSNumber*) reactTag
|
|
282
|
-
mapObject:(id)json)
|
|
283
|
-
{
|
|
284
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
285
|
-
RNSmartMapView *view = (RNSmartMapView*)viewRegistry[reactTag];
|
|
286
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
287
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
if (json) {
|
|
291
|
-
[view selectMapObject:[RCTConvert SPSmartMapObject:json]];
|
|
292
|
-
}
|
|
293
|
-
}];
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
RCT_EXPORT_METHOD(getWidgetPadding:(nonnull NSNumber*) reactTag
|
|
297
|
-
callback:(RCTResponseSenderBlock)callback)
|
|
298
|
-
{
|
|
299
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
300
|
-
RNSmartMapView *view = (RNSmartMapView*)viewRegistry[reactTag];
|
|
301
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
302
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
NSArray<NSNumber*> * padding = view.getWidgetPadding;
|
|
306
|
-
callback(@[
|
|
307
|
-
@{
|
|
308
|
-
@"left": [padding objectAtIndex:0],
|
|
309
|
-
@"top": [padding objectAtIndex:1],
|
|
310
|
-
@"right": [padding objectAtIndex:2],
|
|
311
|
-
@"bottom": [padding objectAtIndex:3]
|
|
312
|
-
}
|
|
313
|
-
]);
|
|
314
|
-
}];
|
|
315
|
-
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
RCT_EXPORT_METHOD(getMapObject:(nonnull NSNumber*) reactTag
|
|
319
|
-
localRef:(nonnull NSString *)localRef
|
|
320
|
-
buildingRef:(nonnull NSString *)buildingRef
|
|
321
|
-
source:(nonnull NSString*)source
|
|
322
|
-
callback:(RCTResponseSenderBlock)callback)
|
|
323
|
-
{
|
|
324
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
325
|
-
RNSmartMapView *view = (RNSmartMapView*)viewRegistry[reactTag];
|
|
326
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
327
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
328
|
-
return;
|
|
329
|
-
}
|
|
330
|
-
[view getMapObject:localRef buildingRef:buildingRef source:[RCTConvert SPObjectSource:source] completion:^(SPSmartMapObject * _Nullable mapObject, SPMapResponse response) {
|
|
331
|
-
if (mapObject == nil) {
|
|
332
|
-
callback(@[[NSNull null], [RCTConvert SPMapResponse:response]]);
|
|
333
|
-
} else {
|
|
334
|
-
callback(@[[RCTConvert convertMapObjectToJSONWith:mapObject], [RCTConvert SPMapResponse:response]]);
|
|
335
|
-
}
|
|
336
|
-
}];
|
|
337
|
-
}];
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
RCT_EXPORT_METHOD(getMapObjectByProperties:(nonnull NSNumber*) reactTag
|
|
342
|
-
properties:(nonnull NSDictionary *)properties
|
|
343
|
-
callback:(RCTResponseSenderBlock)callback)
|
|
344
|
-
{
|
|
345
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
346
|
-
RNSmartMapView *view = (RNSmartMapView*)viewRegistry[reactTag];
|
|
347
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
348
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
[view getMapObjectByProperties:properties completion:^(SPSmartMapObject * _Nullable mapObject, SPMapResponse response) {
|
|
352
|
-
if (mapObject == nil) {
|
|
353
|
-
callback(@[[NSNull null], [RCTConvert SPMapResponse:response]]);
|
|
354
|
-
} else {
|
|
355
|
-
callback(@[[RCTConvert convertMapObjectToJSONWith:mapObject], [RCTConvert SPMapResponse:response]]);
|
|
356
|
-
}
|
|
357
|
-
}];
|
|
358
|
-
}];
|
|
359
|
-
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
RCT_EXPORT_METHOD(animateCamera:(nonnull NSNumber*) reactTag
|
|
363
|
-
latitude:(nonnull NSNumber*)latitude
|
|
364
|
-
longitude:(nonnull NSNumber*)longitude
|
|
365
|
-
zoomLevel:(nonnull NSNumber*)zoomLevel
|
|
366
|
-
bearing:(nonnull NSNumber*)bearing
|
|
367
|
-
pitch:(nonnull NSNumber*)pitch
|
|
368
|
-
floorIndex:(nonnull NSNumber*)floorIndex
|
|
369
|
-
buildingRef:(nonnull NSString *)buildingRef)
|
|
370
|
-
{
|
|
371
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
372
|
-
RNSmartMapView *view = viewRegistry[reactTag];
|
|
373
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
374
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
375
|
-
return;
|
|
376
|
-
}
|
|
377
|
-
[view animateCamera:[latitude doubleValue] longitude:[longitude doubleValue] zoomLevel:[zoomLevel doubleValue] bearing:[bearing doubleValue] pitch:[pitch doubleValue] floorIndex:[floorIndex intValue] buildingRef:buildingRef completion:^(SPMapResponse response) {
|
|
378
|
-
NSLog(@"Animate Camera completed");
|
|
379
|
-
}];
|
|
380
|
-
}];
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
RCT_EXPORT_METHOD(animateCameraToObject:(nonnull NSNumber*) reactTag
|
|
384
|
-
localRef:(nonnull NSString*) localRef
|
|
385
|
-
buildingRef:(nonnull NSString*) buildingRef
|
|
386
|
-
zoomLevel:(nonnull NSNumber*) zoomLevel
|
|
387
|
-
callback:(RCTResponseSenderBlock)callback)
|
|
388
|
-
{
|
|
389
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
390
|
-
RNSmartMapView *view = (RNSmartMapView*)viewRegistry[reactTag];
|
|
391
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
392
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
393
|
-
return;
|
|
394
|
-
}
|
|
395
|
-
[view animateCameraToObject:localRef
|
|
396
|
-
buildingRef:buildingRef
|
|
397
|
-
zoomLevel:[zoomLevel doubleValue]
|
|
398
|
-
completion:^(SPMapResponse response) {
|
|
399
|
-
callback(@[[NSNull null], [RCTConvert SPMapResponse:response]]);
|
|
400
|
-
}];
|
|
401
|
-
}];
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
RCT_EXPORT_METHOD(animateCameraToBuildingRef:(nonnull NSNumber*) reactTag
|
|
405
|
-
buildingRef:(nonnull NSString*) buildingRef
|
|
406
|
-
callback:(RCTResponseSenderBlock)callback)
|
|
407
|
-
{
|
|
408
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
409
|
-
RNSmartMapView *view = (RNSmartMapView*)viewRegistry[reactTag];
|
|
410
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
411
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
412
|
-
return;
|
|
413
|
-
}
|
|
414
|
-
[view animateCameraToBuildingRef:buildingRef
|
|
415
|
-
completion:^(SPMapResponse response) {
|
|
416
|
-
callback(@[[NSNull null], [RCTConvert SPMapResponse:response]]);
|
|
417
|
-
}];
|
|
418
|
-
}];
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
RCT_EXPORT_METHOD(startUserTask:(nonnull NSNumber*) reactTag
|
|
422
|
-
userTask:(id)json)
|
|
423
|
-
{
|
|
424
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
425
|
-
RNSmartMapView *view = (RNSmartMapView*)viewRegistry[reactTag];
|
|
426
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
427
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
428
|
-
return;
|
|
429
|
-
}
|
|
430
|
-
SPSmartMapUserTask* task = [RCTConvert SPSmartUserTask:json];
|
|
431
|
-
[view startUserTask:task];
|
|
432
|
-
}];
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
RCT_EXPORT_METHOD(getCurrentUserTask:(nonnull NSNumber*) reactTag
|
|
436
|
-
callback:(RCTResponseSenderBlock)callback)
|
|
437
|
-
{
|
|
438
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
439
|
-
RNSmartMapView *view = (RNSmartMapView*)viewRegistry[reactTag];
|
|
440
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
441
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
SPSmartMapUserTask* task = [view getCurrentUserTask];
|
|
445
|
-
callback(@[[NSNull null], [RCTConvert convertUserTaskToJSONWith:task]]);
|
|
446
|
-
}];
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
RCT_EXPORT_METHOD(cancelCurrentUserTask:(nonnull NSNumber*) reactTag)
|
|
450
|
-
{
|
|
451
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
452
|
-
RNSmartMapView *view = (RNSmartMapView*)viewRegistry[reactTag];
|
|
453
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
454
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
455
|
-
return;
|
|
456
|
-
}
|
|
457
|
-
[view cancelCurrentUserTask];
|
|
458
|
-
}];
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
RCT_EXPORT_METHOD(getSmartMapCameraOptions:(nonnull NSNumber*) reactTag
|
|
462
|
-
callback:(RCTResponseSenderBlock)callback)
|
|
463
|
-
{
|
|
464
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
465
|
-
RNSmartMapView* view = (RNSmartMapView*)viewRegistry[reactTag];
|
|
466
|
-
if (!view || ![view isKindOfClass:[RNSmartMapView class]]) {
|
|
467
|
-
RCTLogError(@"Cannot find SPSmartMapView with tag #%@", reactTag);
|
|
468
|
-
return;
|
|
469
|
-
}
|
|
470
|
-
SPSmartMapCameraOptions* opts = view.getSmartMapCameraOptions;
|
|
471
|
-
callback(@[[RCTConvert convertSmartMapCameraOptionsToJSONWith:opts]]);
|
|
472
|
-
}];
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
#pragma MAP Events
|
|
476
|
-
|
|
477
|
-
-(void)spSmartMapViewOnMapLoaded:(RNSmartMapView*)smartMap;
|
|
478
|
-
{
|
|
479
|
-
if (smartMap.onMapLoaded) {
|
|
480
|
-
smartMap.onMapLoaded(nil);
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
-(BOOL)spSmartMapView:(RNSmartMapView*)smartMap onMapClicked:(NSArray<SPSmartMapObject*>*)objects;
|
|
485
|
-
{
|
|
486
|
-
if (smartMap.onMapClicked) {
|
|
487
|
-
smartMap.onMapClicked(@{
|
|
488
|
-
@"mapObjects": [RCTConvert convertMapObjects:objects]
|
|
489
|
-
});
|
|
490
|
-
return YES;
|
|
491
|
-
}
|
|
492
|
-
return NO;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
-(void)spSmartMapView:(RNSmartMapView*)smartMap onUserFloorChanged:(NSInteger)floorIndex buildingRef:(nullable NSString*)buildingRef;
|
|
496
|
-
{
|
|
497
|
-
if (smartMap.onUserFloorChanged) {
|
|
498
|
-
smartMap.onUserFloorChanged(@{
|
|
499
|
-
@"floorIndex": [NSNumber numberWithInteger:floorIndex],
|
|
500
|
-
@"buildingRef": [self valueOrEmptyIfNil:buildingRef]
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
-(void)spSmartMapView:(RNSmartMapView*)smartMap onVisibleFloorChanged:(NSInteger)floorIndex buildingRef:(nullable NSString*)buildingRef;
|
|
506
|
-
{
|
|
507
|
-
if (smartMap.onVisibleFloorChanged) {
|
|
508
|
-
smartMap.onVisibleFloorChanged(@{
|
|
509
|
-
@"floorIndex": [NSNumber numberWithInteger:floorIndex],
|
|
510
|
-
@"buildingRef": [self valueOrEmptyIfNil:buildingRef]
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
#pragma mark ViewStatusListener
|
|
516
|
-
|
|
517
|
-
-(void)spSmartMapView:(RNSmartMapView*)smartMap onViewStatusChanged:(SPMapViewStatus)status withPOIDetail:(nullable SPSmartMapObject*)objectDetail;
|
|
518
|
-
{
|
|
519
|
-
if (smartMap.onViewStatusChanged) {
|
|
520
|
-
smartMap.onViewStatusChanged(@{
|
|
521
|
-
@"status": [RCTConvert SPMapViewStatus:status],
|
|
522
|
-
@"poiDetail": [RCTConvert convertMapObjectToJSONWith:objectDetail]
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
-(void)spSmartMapView:(RNSmartMapView*)smartMap onBottomSheetChanged:(SPSmartMapBottomSheetViewState)state
|
|
528
|
-
{
|
|
529
|
-
if (smartMap.onBottomSheetStateChanged) {
|
|
530
|
-
smartMap.onBottomSheetStateChanged(@{
|
|
531
|
-
@"state": [RCTConvert SPSmartMapBottomSheetViewState:state]
|
|
532
|
-
});
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
#pragma mark NavigationEvent
|
|
537
|
-
|
|
538
|
-
-(void)spSmartMapViewOnNavigationEnded:(RNSmartMapView*)smartMap
|
|
539
|
-
{
|
|
540
|
-
if (smartMap.onNavigationEnded) {
|
|
541
|
-
smartMap.onNavigationEnded(nil);
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
-(void)spSmartMapViewOnNavigationStarted:(RNSmartMapView*)smartMap
|
|
546
|
-
{
|
|
547
|
-
if (smartMap.onNavigationStarted) {
|
|
548
|
-
smartMap.onNavigationStarted(nil);
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
-(void)spSmartMapViewOnNavigationPreviewAppeared:(RNSmartMapView*)smartMap
|
|
553
|
-
{
|
|
554
|
-
if (smartMap.onNavigationPreviewAppeared) {
|
|
555
|
-
smartMap.onNavigationPreviewAppeared(nil);
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
-(void)spSmartMapViewOnNavigationDestinationReached:(RNSmartMapView*)smartMap
|
|
560
|
-
{
|
|
561
|
-
if (smartMap.onNavigationDestinationReached) {
|
|
562
|
-
smartMap.onNavigationDestinationReached(nil);
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
-(void)spSmartMapViewOnNavigationFailed:(RNSmartMapView*)smartMap withError:(SPNavigationError)error
|
|
567
|
-
{
|
|
568
|
-
if (smartMap.onNavigationFailed) {
|
|
569
|
-
smartMap.onNavigationFailed(@{
|
|
570
|
-
@"message": [RCTConvert SPNavigationError:error]
|
|
571
|
-
});
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
#pragma mark Search result clicked event
|
|
576
|
-
-(BOOL)spSmartMapView:(RNSmartMapView*)smartMap onSearchResultSelected:(SPSmartMapObject*)mapObject
|
|
577
|
-
{
|
|
578
|
-
if (smartMap.onSearchResultSelected) {
|
|
579
|
-
smartMap.onSearchResultSelected(@{
|
|
580
|
-
@"mapObject": [RCTConvert convertMapObjectToJSONWith:mapObject]
|
|
581
|
-
});
|
|
582
|
-
return YES;
|
|
583
|
-
}
|
|
584
|
-
return NO;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
#pragma mark Search category selection event
|
|
588
|
-
-(void)spSmartMapView:(RNSmartMapView*)smartMap onSearchCategorySelected:(NSDictionary*)searchAction searchResults:(NSArray<SPSmartMapObject*>*)searchResults
|
|
589
|
-
{
|
|
590
|
-
if (smartMap.onSearchCategorySelected) {
|
|
591
|
-
smartMap.onSearchCategorySelected(@{
|
|
592
|
-
@"searchAction": searchAction,
|
|
593
|
-
@"searchResults": [RCTConvert convertMapObjects:searchResults]
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
-(NSString*)valueOrEmptyIfNil:(nullable NSString*)str
|
|
600
|
-
{
|
|
601
|
-
NSString* guarded = @"";
|
|
602
|
-
if (str != nil) {
|
|
603
|
-
guarded = str;
|
|
604
|
-
}
|
|
605
|
-
return guarded;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
@end
|