react-native-pointr 9.9.0 → 10.1.0

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.
Files changed (41) hide show
  1. package/API_REFERENCE.md +284 -315
  2. package/CHANGELOG.md +42 -0
  3. package/EXTENDING.md +11 -16
  4. package/README.md +14 -14
  5. package/WAYFINDING_EVENTS.md +5 -3
  6. package/android/build.gradle +1 -1
  7. package/android/src/main/java/com/pointr/PTRCoreExtensions.kt +33 -2
  8. package/android/src/main/java/com/pointr/PTRMapWidgetActionType.kt +17 -0
  9. package/android/src/main/java/com/pointr/PTRMapWidgetManager.kt +162 -406
  10. package/android/src/main/java/com/pointr/{PointrModule.kt → PTRNativeLibrary.kt} +150 -32
  11. package/android/src/main/java/com/pointr/{PointrPackage.kt → PTRPackage.kt} +2 -2
  12. package/ios/PTRMapWidgetContainerView.swift +174 -187
  13. package/ios/PTRMapWidgetManager-Bridging.m +12 -64
  14. package/ios/PTRMapWidgetManager.swift +164 -136
  15. package/ios/PTRNativeLibrary-Bridging.m +38 -2
  16. package/ios/PTRNativeLibrary.swift +206 -26
  17. package/package.json +6 -4
  18. package/react-native-pointr.podspec +1 -1
  19. package/src/NativePointrModule.ts +70 -0
  20. package/src/PTRMapWidgetUtils.ts +67 -144
  21. package/src/actions/index.ts +171 -0
  22. package/src/api/MapWidgetApi.ts +8 -8
  23. package/src/api/PointrSdk.ts +50 -91
  24. package/src/components/index.tsx +27 -26
  25. package/src/constants/index.ts +32 -13
  26. package/src/hooks/index.ts +1 -0
  27. package/src/hooks/usePointrGeofences.ts +37 -0
  28. package/src/hooks/usePointrSdk.ts +12 -5
  29. package/src/index.tsx +37 -70
  30. package/src/managers/PTRPoiManager.ts +2 -2
  31. package/src/types/PTRPoi.ts +5 -2
  32. package/src/types/PTRPosition.ts +15 -5
  33. package/src/types/PTRSite.ts +46 -0
  34. package/src/types/PTRWayfindingEvent.ts +11 -7
  35. package/src/types/config.ts +1 -0
  36. package/src/types/events.ts +1 -0
  37. package/src/types/index.ts +4 -0
  38. package/android/src/main/java/com/pointr/PTRMapWidgetCommandType.kt +0 -20
  39. package/src/PTRCommand.ts +0 -153
  40. package/src/api/index.ts +0 -9
  41. package/src/commands/index.ts +0 -275
@@ -24,7 +24,7 @@ public class PTRMapWidgetManager: RCTViewManager {
24
24
  return
25
25
  }
26
26
 
27
- let action = PTRMapWidgetMapFocusAction(location: location, completion: { error in
27
+ let action = PTRMapWidgetAction.focusMap(location: location, completion: { error in
28
28
  var ptrCommand = commandParameters
29
29
  ptrCommand["error"] = error?.errorCode ?? ""
30
30
  print("calling ptrMapWidgetDidEndLoading with parameters: \(ptrCommand)")
@@ -38,7 +38,7 @@ public class PTRMapWidgetManager: RCTViewManager {
38
38
  }
39
39
 
40
40
  @objc func site(_ reactTag: NSNumber, siteExternalIdentifier: String) {
41
- let siteLocation = PTRMapWidgetSiteLocation(siteIdentifier: siteExternalIdentifier, isExternalIdentifiers: true)
41
+ let siteLocation = PTRMapWidgetSiteLocation(siteID: PTRIdentifier(siteExternalIdentifier, isExternal: true))
42
42
  let commandParameters: [String: Any] = [
43
43
  "command": "site",
44
44
  "siteExternalIdentifier": siteExternalIdentifier
@@ -47,7 +47,10 @@ public class PTRMapWidgetManager: RCTViewManager {
47
47
  }
48
48
 
49
49
  @objc func building(_ reactTag: NSNumber, siteExternalIdentifier: String, buildingExternalIdentifier: String) {
50
- let buildingLocation = PTRMapWidgetBuildingLocation(siteIdentifier: siteExternalIdentifier, buildingIdentifier: buildingExternalIdentifier, isExternalIdentifiers: true)
50
+ let buildingLocation = PTRMapWidgetBuildingLocation(
51
+ siteID: PTRIdentifier(siteExternalIdentifier, isExternal: true),
52
+ buildingID: PTRIdentifier(buildingExternalIdentifier, isExternal: true)
53
+ )
51
54
  let commandParameters: [String: Any] = [
52
55
  "command": "building",
53
56
  "siteExternalIdentifier": siteExternalIdentifier,
@@ -57,7 +60,11 @@ public class PTRMapWidgetManager: RCTViewManager {
57
60
  }
58
61
 
59
62
  @objc func level(_ reactTag: NSNumber, siteExternalIdentifier: String, buildingExternalIdentifier: String, levelIndex: Int) {
60
- let levelLocation = PTRMapWidgetLevelLocation(siteIdentifier: siteExternalIdentifier, buildingIdentifier: buildingExternalIdentifier, levelIndex: levelIndex, isExternalIdentifiers: true)
63
+ let levelLocation = PTRMapWidgetLevelLocation(
64
+ siteID: PTRIdentifier(siteExternalIdentifier, isExternal: true),
65
+ buildingID: PTRIdentifier(buildingExternalIdentifier, isExternal: true),
66
+ levelIndex: levelIndex
67
+ )
61
68
  let commandParameters: [String: Any] = [
62
69
  "command": "level",
63
70
  "siteExternalIdentifier": siteExternalIdentifier,
@@ -68,78 +75,90 @@ public class PTRMapWidgetManager: RCTViewManager {
68
75
  }
69
76
 
70
77
  @objc func poi(_ reactTag: NSNumber, siteExternalIdentifier: String, poiExternalIdentifier: String) {
71
- let poiLocation = PTRMapWidgetPoiLocation(siteIdentifier: siteExternalIdentifier, poiIdentifier: poiExternalIdentifier, isExternalIdentifiers: true)
72
- let commandParameters: [String: Any] = [
73
- "command": "poi",
74
- "siteExternalIdentifier": siteExternalIdentifier,
75
- "poiExternalIdentifier": poiExternalIdentifier
76
- ]
77
- focus(reactTag, location: poiLocation, commandParameters: commandParameters)
78
- }
79
-
80
- @objc func path(_ reactTag: NSNumber, siteExternalIdentifier: String, toPoiExternalIdentifier: String) {
81
78
  self.bridge.uiManager.addUIBlock { (uiManager, viewRegistry) in
82
79
  guard let ptrMapWidgetContainerView = uiManager?.view(forReactTag: reactTag) as? PTRMapWidgetContainerView else {
83
80
  print("Cannot find PTRMapWidgetContainerView with tag #\(reactTag)")
84
81
  return
85
82
  }
86
-
87
-
88
- let action = PTRMapWidgetWayfindingAction(poiDestination: PTRMapWidgetPoiLocation(siteIdentifier: siteExternalIdentifier, poiIdentifier: toPoiExternalIdentifier, isExternalIdentifiers: true))
89
- action.completion = { error in
83
+ let poiLocation = PTRMapWidgetPoiLocation(
84
+ siteID: PTRIdentifier(siteExternalIdentifier, isExternal: true),
85
+ poiID: PTRIdentifier(poiExternalIdentifier, isExternal: true)
86
+ )
87
+ let action = PTRMapWidgetAction.highlightPoi(location: poiLocation, completion: { error in
90
88
  let ptrCommand: [String: Any] = [
91
- "command": "path",
89
+ "command": "poi",
92
90
  "siteExternalIdentifier": siteExternalIdentifier,
93
- "poiExternalIdentifier": toPoiExternalIdentifier,
91
+ "poiExternalIdentifier": poiExternalIdentifier,
94
92
  "error": error?.errorCode ?? ""
95
93
  ]
96
94
  ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
97
- }
95
+ })
98
96
  let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
99
- print("calling show path method of mapWidget")
97
+ print("calling show poi method of mapWidget")
100
98
  ptrMapWidgetContainerView.present(mapWidget)
101
99
  }
102
100
  }
103
101
 
104
- @objc func staticPath(_ reactTag: NSNumber, siteExternalIdentifier: String, fromPoiExternalIdentifier: String, toPoiExternalIdentifier: String) {
102
+ @objc func startWayfinding(_ reactTag: NSNumber, siteExternalIdentifier: String, toPoiExternalIdentifier: String) {
105
103
  self.bridge.uiManager.addUIBlock { (uiManager, viewRegistry) in
106
104
  guard let ptrMapWidgetContainerView = uiManager?.view(forReactTag: reactTag) as? PTRMapWidgetContainerView else {
107
105
  print("Cannot find PTRMapWidgetContainerView with tag #\(reactTag)")
108
106
  return
109
107
  }
110
108
 
111
- DispatchQueue.global(qos: .default).async {
112
- ptrMapWidgetContainerView.showStaticPath(siteExternalIdentifier,
113
- fromPoiExternalIdentifier: fromPoiExternalIdentifier,
114
- toPoiExternalIdentifier: toPoiExternalIdentifier)
115
- }
109
+
110
+ let action = PTRMapWidgetAction.startWayfinding(
111
+ poi: PTRMapWidgetPoiLocation(
112
+ siteID: PTRIdentifier(siteExternalIdentifier, isExternal: true),
113
+ poiID: PTRIdentifier(toPoiExternalIdentifier, isExternal: true)
114
+ ),
115
+ completion: { error in
116
+ let ptrCommand: [String: Any] = [
117
+ "command": "startWayfinding",
118
+ "siteExternalIdentifier": siteExternalIdentifier,
119
+ "poiExternalIdentifier": toPoiExternalIdentifier,
120
+ "error": error?.errorCode ?? ""
121
+ ]
122
+ ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
123
+ })
124
+ let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
125
+ print("calling show path method of mapWidget")
126
+ ptrMapWidgetContainerView.present(mapWidget)
116
127
  }
117
128
  }
118
129
 
119
- @objc func staticWayfinding(_ reactTag: NSNumber, siteExternalIdentifier: String, sourcePoiExternalIdentifier: String, destinationPoiExternalIdentifier: String) {
130
+ @objc func displayRoute(_ reactTag: NSNumber, siteExternalIdentifier: String, sourcePoiExternalIdentifier: String, destinationPoiExternalIdentifier: String) {
120
131
  self.bridge.uiManager.addUIBlock { (uiManager, viewRegistry) in
121
132
  guard let ptrMapWidgetContainerView = uiManager?.view(forReactTag: reactTag) as? PTRMapWidgetContainerView else {
122
133
  print("Cannot find PTRMapWidgetContainerView with tag #\(reactTag)")
123
134
  return
124
135
  }
125
136
 
126
- let sourcePoiLocation = PTRMapWidgetPoiLocation(siteIdentifier: siteExternalIdentifier, poiIdentifier: sourcePoiExternalIdentifier, isExternalIdentifiers: true)
127
- let destinationPoiLocation = PTRMapWidgetPoiLocation(siteIdentifier: siteExternalIdentifier, poiIdentifier: destinationPoiExternalIdentifier, isExternalIdentifiers: true)
137
+ let sourcePoiLocation = PTRMapWidgetPoiLocation(
138
+ siteID: PTRIdentifier(siteExternalIdentifier, isExternal: true),
139
+ poiID: PTRIdentifier(sourcePoiExternalIdentifier, isExternal: true)
140
+ )
141
+ let destinationPoiLocation = PTRMapWidgetPoiLocation(
142
+ siteID: PTRIdentifier(siteExternalIdentifier, isExternal: true),
143
+ poiID: PTRIdentifier(destinationPoiExternalIdentifier, isExternal: true)
144
+ )
128
145
 
129
- let action = PTRMapWidgetStaticWayfindingAction(poiSource: sourcePoiLocation, poiDestination: destinationPoiLocation)
130
- action.completion = { error in
131
- let ptrCommand: [String: Any] = [
132
- "command": "staticWayfinding",
133
- "siteExternalIdentifier": siteExternalIdentifier,
134
- "sourcePoiExternalIdentifier": sourcePoiExternalIdentifier,
135
- "destinationPoiExternalIdentifier": destinationPoiExternalIdentifier,
136
- "error": error?.localizedDescription ?? ""
137
- ]
138
- ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
139
- }
146
+ let action = PTRMapWidgetAction.displayRoute(
147
+ poiSource: sourcePoiLocation,
148
+ poiDestination: destinationPoiLocation,
149
+ completion: { error in
150
+ let ptrCommand: [String: Any] = [
151
+ "command": "displayRoute",
152
+ "siteExternalIdentifier": siteExternalIdentifier,
153
+ "sourcePoiExternalIdentifier": sourcePoiExternalIdentifier,
154
+ "destinationPoiExternalIdentifier": destinationPoiExternalIdentifier,
155
+ "error": error?.localizedDescription ?? ""
156
+ ]
157
+ ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
158
+ })
140
159
 
141
160
  let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
142
- print("calling show static wayfinding method of mapWidget")
161
+ print("calling show display route method of mapWidget")
143
162
  ptrMapWidgetContainerView.present(mapWidget)
144
163
  }
145
164
  }
@@ -151,19 +170,25 @@ public class PTRMapWidgetManager: RCTViewManager {
151
170
  return
152
171
  }
153
172
 
154
- let action = PTRMapWidgetMarkMyCarAction(levelLocation: PTRMapWidgetLevelLocation(siteIdentifier: siteExternalIdentifier, buildingIdentifier: buildingExternalIdentifier, levelIndex: levelIndex, isExternalIdentifiers: true), shouldShowPopup: shouldShowPopup)
155
- action.completion = { error in
156
- let ptrCommand: [String: Any] = [
157
- "command": "markMyCarForLevel",
158
- "siteExternalIdentifier": siteExternalIdentifier,
159
- "buildingExternalIdentifier": buildingExternalIdentifier,
160
- "levelIndex": levelIndex,
161
- "shouldShowPopup": shouldShowPopup,
162
- "animationType": animationType,
163
- "error": error?.errorCode ?? ""
164
- ]
165
- ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
166
- }
173
+ let action = PTRMapWidgetAction.markMyCar(
174
+ level: PTRMapWidgetLevelLocation(
175
+ siteID: PTRIdentifier(siteExternalIdentifier, isExternal: true),
176
+ buildingID: PTRIdentifier(buildingExternalIdentifier, isExternal: true),
177
+ levelIndex: levelIndex
178
+ ),
179
+ shouldShowPopup: shouldShowPopup,
180
+ completion: { error in
181
+ let ptrCommand: [String: Any] = [
182
+ "command": "markMyCarForLevel",
183
+ "siteExternalIdentifier": siteExternalIdentifier,
184
+ "buildingExternalIdentifier": buildingExternalIdentifier,
185
+ "levelIndex": levelIndex,
186
+ "shouldShowPopup": shouldShowPopup,
187
+ "animationType": animationType,
188
+ "error": error?.errorCode ?? ""
189
+ ]
190
+ ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
191
+ })
167
192
  let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
168
193
  print("calling show mark my car method of mapWidget")
169
194
  ptrMapWidgetContainerView.present(mapWidget)
@@ -177,17 +202,21 @@ public class PTRMapWidgetManager: RCTViewManager {
177
202
  return
178
203
  }
179
204
 
180
- let action = PTRMapWidgetMarkMyCarAction(siteLocation: PTRMapWidgetSiteLocation(siteIdentifier: siteExternalIdentifier, isExternalIdentifiers: true), shouldShowPopup: shouldShowPopup)
181
- action.completion = { error in
182
- let ptrCommand: [String: Any] = [
183
- "command": "markMyCarForSite",
184
- "siteExternalIdentifier": siteExternalIdentifier,
185
- "shouldShowPopup": shouldShowPopup,
186
- "animationType": animationType,
187
- "error": error?.errorCode ?? ""
188
- ]
189
- ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
190
- }
205
+ let action = PTRMapWidgetAction.markMyCar(
206
+ site: PTRMapWidgetSiteLocation(
207
+ siteID: PTRIdentifier(siteExternalIdentifier, isExternal: true)
208
+ ),
209
+ shouldShowPopup: shouldShowPopup,
210
+ completion: { error in
211
+ let ptrCommand: [String: Any] = [
212
+ "command": "markMyCarForSite",
213
+ "siteExternalIdentifier": siteExternalIdentifier,
214
+ "shouldShowPopup": shouldShowPopup,
215
+ "animationType": animationType,
216
+ "error": error?.errorCode ?? ""
217
+ ]
218
+ ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
219
+ })
191
220
  let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
192
221
  print("calling show mark my car method of mapWidget")
193
222
  ptrMapWidgetContainerView.present(mapWidget)
@@ -201,83 +230,82 @@ public class PTRMapWidgetManager: RCTViewManager {
201
230
  return
202
231
  }
203
232
 
204
- let action = PTRMapWidgetShowMyCarAction(location: PTRMapWidgetSiteLocation(siteIdentifier: siteExternalIdentifier, isExternalIdentifiers: true))
205
- action.completion = { error in
206
- let ptrCommand: [String: Any] = [
207
- "command": "myCarForSite",
208
- "siteExternalIdentifier": siteExternalIdentifier,
209
- "animationType": animationType,
210
- "error": error?.errorCode ?? ""
211
- ]
212
- ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
213
- }
233
+ let action = PTRMapWidgetAction.showMyCar(
234
+ location: PTRMapWidgetSiteLocation(
235
+ siteID: PTRIdentifier(siteExternalIdentifier, isExternal: true)
236
+ ),
237
+ completion: { error in
238
+ let ptrCommand: [String: Any] = [
239
+ "command": "myCarForSite",
240
+ "siteExternalIdentifier": siteExternalIdentifier,
241
+ "animationType": animationType,
242
+ "error": error?.errorCode ?? ""
243
+ ]
244
+ ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
245
+ })
214
246
  let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
215
247
  print("calling show mark my car method of mapWidget")
216
248
  ptrMapWidgetContainerView.present(mapWidget)
217
249
  }
218
250
  }
219
- @objc func startAndFocus(_ reactTag: NSNumber, clientId: String, licenseKey: String, baseUrl: String, focusType: String, siteExternalIdentifier: String) {
220
- startAndFocus(reactTag, clientId: clientId, licenseKey: licenseKey, baseUrl: baseUrl, logLevel: 4, focusType: focusType, siteExternalIdentifier: siteExternalIdentifier, param1: "", levelIndex: 0)
221
- }
222
-
223
- @objc func startAndFocus(_ reactTag: NSNumber, clientId: String, licenseKey: String, baseUrl: String, focusType: String, siteExternalIdentifier: String, param1: String) {
224
- startAndFocus(reactTag, clientId: clientId, licenseKey: licenseKey, baseUrl: baseUrl, logLevel: 4, focusType: focusType, siteExternalIdentifier: siteExternalIdentifier, param1: param1, levelIndex: 0)
225
- }
226
-
227
- @objc func startAndFocus(_ reactTag: NSNumber, clientId: String, licenseKey: String, baseUrl: String, focusType: String, siteExternalIdentifier: String, param1: String, levelIndex: Int) {
228
- startAndFocus(reactTag, clientId: clientId, licenseKey: licenseKey, baseUrl: baseUrl, logLevel: 4, focusType: focusType, siteExternalIdentifier: siteExternalIdentifier, param1: param1, levelIndex: levelIndex)
229
- }
230
-
231
- @objc func startAndFocus(_ reactTag: NSNumber, clientId: String, licenseKey: String, baseUrl: String, logLevel: Int, focusType: String, siteExternalIdentifier: String) {
232
- startAndFocus(reactTag, clientId: clientId, licenseKey: licenseKey, baseUrl: baseUrl, logLevel: logLevel, focusType: focusType, siteExternalIdentifier: siteExternalIdentifier, param1: "", levelIndex: 0)
233
- }
234
-
235
- @objc func startAndFocus(_ reactTag: NSNumber, clientId: String, licenseKey: String, baseUrl: String, logLevel: Int, focusType: String, siteExternalIdentifier: String, param1: String) {
236
- startAndFocus(reactTag, clientId: clientId, licenseKey: licenseKey, baseUrl: baseUrl, logLevel: logLevel, focusType: focusType, siteExternalIdentifier: siteExternalIdentifier, param1: param1, levelIndex: 0)
237
- }
238
-
239
- @objc func startAndFocus(_ reactTag: NSNumber, clientId: String, licenseKey: String, baseUrl: String, logLevel: Int, focusType: String, siteExternalIdentifier: String, param1: String, levelIndex: Int) {
240
-
241
- // Initialize PTRParams
242
- PTRNativeLibrary.params.clientIdentifier = clientId
243
- PTRNativeLibrary.params.licenseKey = licenseKey
244
- PTRNativeLibrary.params.baseUrl = baseUrl
245
- PTRNativeLibrary.params.loggerLevel = PTRLoggerLevel(rawValue: Int32(logLevel)) ?? .error
246
- PTRNativeLibrary.params.mode = PointrDebugMode()
247
-
248
- // Set SDK params in map widget configuration
249
- PTRNativeLibrary.mapWidgetConfiguration.sdkParams = PTRNativeLibrary.params
250
-
251
- // Call appropriate focus method based on command type
252
- switch focusType.lowercased() {
253
- case "poi":
254
- if !param1.isEmpty {
255
- poi(reactTag, siteExternalIdentifier: siteExternalIdentifier, poiExternalIdentifier: param1)
256
- } else {
257
- print("Error: POI ID is required for POI focus")
258
- }
259
-
260
- case "level":
261
- if !param1.isEmpty {
262
- level(reactTag, siteExternalIdentifier: siteExternalIdentifier, buildingExternalIdentifier: param1, levelIndex: levelIndex)
251
+
252
+ // MARK: - v10 New Commands
253
+
254
+ @objc func coordinate(_ reactTag: NSNumber,
255
+ siteExternalIdentifier: String,
256
+ latitude: Double,
257
+ longitude: Double,
258
+ levelIndex: Int) {
259
+ self.bridge.uiManager.addUIBlock { (uiManager, _) in
260
+ guard let view = uiManager?.view(forReactTag: reactTag) as? PTRMapWidgetContainerView else { return }
261
+ let coord = CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
262
+ let location: PTRMapWidgetLocation
263
+ if levelIndex >= 0 {
264
+ location = PTRMapWidgetLevelCoordinateLocation(
265
+ siteID: PTRIdentifier(siteExternalIdentifier, isExternal: true),
266
+ buildingID: PTRIdentifier("", isExternal: true),
267
+ levelIndex: levelIndex,
268
+ coordinate: coord,
269
+ name: nil
270
+ )
263
271
  } else {
264
- print("Error: Building ID is required for level focus")
272
+ location = PTRMapWidgetSiteCoordinateLocation(
273
+ siteID: PTRIdentifier(siteExternalIdentifier, isExternal: true),
274
+ coordinate: coord,
275
+ name: nil
276
+ )
265
277
  }
266
-
267
- case "building":
268
- if !param1.isEmpty {
269
- building(reactTag, siteExternalIdentifier: siteExternalIdentifier, buildingExternalIdentifier: param1)
270
- } else {
271
- print("Error: Building ID is required for building focus")
278
+ let action = PTRMapWidgetAction.focusMap(location: location, completion: { error in
279
+ view.ptrMapWidgetDidEndLoading(withParameters: [
280
+ "command": "coordinate",
281
+ "siteExternalIdentifier": siteExternalIdentifier,
282
+ "error": error?.errorCode ?? ""
283
+ ])
284
+ })
285
+ let mapWidget = view.getMapWidget(action)
286
+ view.present(mapWidget)
287
+ }
288
+ }
289
+
290
+ @objc func highlightCategory(_ reactTag: NSNumber,
291
+ siteExternalIdentifier: String,
292
+ categoryIds: [String]) {
293
+ self.bridge.uiManager.addUIBlock { (uiManager, _) in
294
+ guard let view = uiManager?.view(forReactTag: reactTag) as? PTRMapWidgetContainerView else { return }
295
+ let location = PTRMapWidgetSiteLocation(
296
+ siteID: PTRIdentifier(siteExternalIdentifier, isExternal: true)
297
+ )
298
+ let action = PTRMapWidgetAction.highlightCategory(
299
+ name: categoryIds.first ?? "",
300
+ site: location
301
+ )
302
+ if let mapVC = view.mapWidget {
303
+ mapVC.performAction(action)
272
304
  }
273
-
274
- case "site":
275
- site(reactTag, siteExternalIdentifier: siteExternalIdentifier)
276
-
277
- default:
278
- print("Error: Unknown command type '\(focusType)'. Supported types: site, building, level, poi")
279
- // Default to site focus if command type is unknown
280
- site(reactTag, siteExternalIdentifier: siteExternalIdentifier)
305
+ view.ptrMapWidgetDidEndLoading(withParameters: [
306
+ "command": "highlightCategory",
307
+ "siteExternalIdentifier": siteExternalIdentifier
308
+ ])
281
309
  }
282
310
  }
283
311
  }
@@ -7,7 +7,7 @@
7
7
  #import <React/RCTBridgeModule.h>
8
8
  #import <React/RCTEventEmitter.h>
9
9
 
10
- @interface RCT_EXTERN_MODULE(PTRNativePointrLibrary, RCTEventEmitter)
10
+ @interface RCT_EXTERN_MODULE(PTRNativeLibrary, RCTEventEmitter)
11
11
 
12
12
  // Event emitter methods
13
13
  RCT_EXTERN_METHOD(supportedEvents)
@@ -19,7 +19,7 @@ RCT_EXTERN_METHOD(shouldRequestPermissionsAtStartup:(BOOL)shouldRequestPermissio
19
19
 
20
20
  RCT_EXTERN_METHOD(initialize:(NSString *)clientIdentifier licenseKey:(NSString *)licenseKey baseUrl:(NSString *)baseUrl logLevel:(int)logLevel)
21
21
 
22
- RCT_EXTERN_METHOD(start:(RCTResponseSenderBlock)callback)
22
+ RCT_EXTERN_METHOD(start:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
23
23
 
24
24
  RCT_EXTERN_METHOD(stop)
25
25
 
@@ -35,4 +35,40 @@ RCT_EXTERN_METHOD(getPois:(NSString *)siteId
35
35
  resolver:(RCTPromiseResolveBlock)resolve
36
36
  rejecter:(RCTPromiseRejectBlock)reject)
37
37
 
38
+ // Sites & Buildings
39
+ RCT_EXTERN_METHOD(getSites:(RCTPromiseResolveBlock)resolve
40
+ rejecter:(RCTPromiseRejectBlock)reject)
41
+
42
+ RCT_EXTERN_METHOD(getBuildings:(NSString *)siteId
43
+ resolver:(RCTPromiseResolveBlock)resolve
44
+ rejecter:(RCTPromiseRejectBlock)reject)
45
+
46
+ RCT_EXTERN_METHOD(getSiteByExternalId:(NSString *)externalId
47
+ resolver:(RCTPromiseResolveBlock)resolve
48
+ rejecter:(RCTPromiseRejectBlock)reject)
49
+
50
+ RCT_EXTERN_METHOD(getClientName:(RCTPromiseResolveBlock)resolve
51
+ rejecter:(RCTPromiseRejectBlock)reject)
52
+
53
+ // POI Search
54
+ RCT_EXTERN_METHOD(searchPois:(NSString *)siteId
55
+ query:(NSString *)query
56
+ resolver:(RCTPromiseResolveBlock)resolve
57
+ rejecter:(RCTPromiseRejectBlock)reject)
58
+
59
+ // Wayfinding
60
+ RCT_EXTERN_METHOD(isWayfindingReady:(NSString *)siteId
61
+ resolver:(RCTPromiseResolveBlock)resolve
62
+ rejecter:(RCTPromiseRejectBlock)reject)
63
+
64
+ RCT_EXTERN_METHOD(calculateDistance:(NSString *)fromJson
65
+ to:(NSString *)toJson
66
+ resolver:(RCTPromiseResolveBlock)resolve
67
+ rejecter:(RCTPromiseRejectBlock)reject)
68
+
69
+ // Geofences
70
+ RCT_EXTERN_METHOD(getGeofences:(NSString *)siteId
71
+ resolver:(RCTPromiseResolveBlock)resolve
72
+ rejecter:(RCTPromiseRejectBlock)reject)
73
+
38
74
  @end