react-native-pointr 10.6.0 → 10.7.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.
@@ -0,0 +1,110 @@
1
+ import Foundation
2
+
3
+ /// Every string that crosses the JS <-> native boundary when an action is sent
4
+ /// to the map widget: action type discriminators, `action` / `sdkConfig` payload
5
+ /// keys and view manager command names.
6
+ ///
7
+ /// Nothing here may be hard-coded anywhere else — a key renamed on one side only
8
+ /// fails silently (the cast yields `nil` and the parameter defaults to empty), so
9
+ /// all three sides read them from a constants file:
10
+ ///
11
+ /// TypeScript src/constants/bridgeKeys.ts
12
+ /// Android android/src/main/java/com/pointr/PTRBridgeKeys.kt
13
+ /// iOS ios/PTRBridgeKeys.swift (this file)
14
+ ///
15
+ /// Changing a value here means changing it in the other two files as well.
16
+ enum PTRBridgeKeys {
17
+
18
+ /// Discriminator written to the `type` field of the serialized `action` prop.
19
+ enum ActionTypes {
20
+ /// Focus the map on a site, building or level
21
+ static let focusMap = "focusMap"
22
+ /// Highlight a single POI
23
+ static let highlightPoi = "highlightPoi"
24
+ /// Draw a static route between two POIs
25
+ static let displayRoute = "displayRoute"
26
+ /// Start live wayfinding to a destination POI
27
+ static let startWayfinding = "startWayfinding"
28
+ /// Mark the parked car location
29
+ static let markMyCar = "markMyCar"
30
+ /// Show the previously marked car location
31
+ static let showMyCar = "showMyCar"
32
+ /// Focus the map on a geographic coordinate
33
+ static let focusCoordinate = "focusCoordinate"
34
+ /// Highlight POIs of one or more categories
35
+ static let highlightCategory = "highlightCategory"
36
+ }
37
+
38
+ /// Field names of the JSON payload carried by the `action` view prop.
39
+ /// JS writes them, Android and iOS read them back out.
40
+ enum ActionParamKeys {
41
+ /// Action discriminator — one of `ActionTypes`
42
+ static let type = "type"
43
+ /// Site external identifier
44
+ static let site = "site"
45
+ /// Building external identifier
46
+ static let building = "building"
47
+ /// Level index used by focusMap / markMyCar
48
+ static let level = "level"
49
+ /// POI external identifier — destination for highlightPoi and startWayfinding
50
+ static let poi = "poi"
51
+ /// Source POI external identifier for displayRoute
52
+ static let fromPoi = "fromPoi"
53
+ /// Destination POI external identifier for displayRoute
54
+ static let toPoi = "toPoi"
55
+ /// Whether the car popup is shown
56
+ static let shouldShowPopup = "shouldShowPopup"
57
+ /// Animation applied to the car marker
58
+ static let animationType = "animationType"
59
+ /// Latitude for focusCoordinate
60
+ static let latitude = "latitude"
61
+ /// Longitude for focusCoordinate
62
+ static let longitude = "longitude"
63
+ /// Level index for focusCoordinate
64
+ static let levelIndex = "levelIndex"
65
+ /// Category identifiers for highlightCategory
66
+ static let categoryIds = "categoryIds"
67
+ }
68
+
69
+ /// Field names of the JSON payload carried by the `sdkConfig` view prop.
70
+ enum SdkConfigKeys {
71
+ /// Client identifier issued by Pointr
72
+ static let clientId = "clientId"
73
+ /// License key issued by Pointr
74
+ static let licenseKey = "licenseKey"
75
+ /// Base URL of the Pointr environment
76
+ static let baseUrl = "baseUrl"
77
+ /// Persona identifier applied to the SDK params
78
+ static let personaId = "personaId"
79
+ /// Log level ordinal
80
+ static let logLevel = "logLevel"
81
+ }
82
+
83
+ /// View manager command names used by the imperative `executeMapAction` path.
84
+ /// JS dispatches them, Android matches them in `receiveCommand` and iOS
85
+ /// exports them as `@objc` methods — the names must match on all three sides.
86
+ enum CommandNames {
87
+ /// Focus the map on a site
88
+ static let focusSite = "site"
89
+ /// Focus the map on a building
90
+ static let focusBuilding = "building"
91
+ /// Focus the map on a level
92
+ static let focusLevel = "level"
93
+ /// Highlight a POI
94
+ static let highlightPoi = "poi"
95
+ /// Draw a static route between two POIs
96
+ static let displayRoute = "displayRoute"
97
+ /// Start live wayfinding
98
+ static let startWayfinding = "startWayfinding"
99
+ /// Mark the car at site level
100
+ static let markMyCarForSite = "markMyCarForSite"
101
+ /// Mark the car at a specific level
102
+ static let markMyCarForLevel = "markMyCarForLevel"
103
+ /// Show the marked car at site level
104
+ static let showMyCarForSite = "myCarForSite"
105
+ /// Focus the map on a coordinate
106
+ static let focusCoordinate = "coordinate"
107
+ /// Highlight a category
108
+ static let highlightCategory = "highlightCategory"
109
+ }
110
+ }
@@ -11,15 +11,15 @@ import PointrKit
11
11
  // When set alongside an optional sdkConfig prop, the widget auto-starts and focuses
12
12
  // without the JS caller needing to imperatively dispatch an action afterwards.
13
13
  //
14
- // Expected shape: { "type": "focusMap"|"highlightPoi"|"displayRoute"|"startWayfinding"|"markMyCar"|"showMyCar"|"focusCoordinate"|"highlightCategory",
15
- // "site": "...", "building"?: "...", "level"?: 0,
16
- // "poi"?: "...", "fromPoi"?: "...", "toPoi"?: "...",
17
- // "sourcePoi"?: "...", "destinationPoi"?: "..." }
14
+ // The shape is described by PTRBridgeKeys.ActionTypes (the `type` discriminator)
15
+ // and PTRBridgeKeys.ActionParamKeys (every other field). Read the payload only
16
+ // through those constants the JS side writes it from the matching
17
+ // src/constants/bridgeKeys.ts.
18
18
  @objc var action: String? {
19
19
  didSet { pendingActionString = action }
20
20
  }
21
21
 
22
- // Optional SDK config prop — JSON with clientId / licenseKey / baseUrl / logLevel.
22
+ // Optional SDK config prop — JSON keyed by PTRBridgeKeys.SdkConfigKeys.
23
23
  // When provided the widget uses these credentials instead of the globally-configured params.
24
24
  @objc var sdkConfig: String? {
25
25
  didSet { applySDKConfigIfNeeded() }
@@ -244,10 +244,12 @@ import PointrKit
244
244
  guard let jsonString = sdkConfig,
245
245
  let data = jsonString.data(using: .utf8),
246
246
  let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any] else { return }
247
- if let clientId = json["clientId"] as? String { PTRNativeLibrary.params.clientIdentifier = clientId }
248
- if let licenseKey = json["licenseKey"] as? String { PTRNativeLibrary.params.licenseKey = licenseKey }
249
- if let baseUrl = json["baseUrl"] as? String { PTRNativeLibrary.params.baseUrl = baseUrl }
250
- if let logLevel = json["logLevel"] as? Int32 {
247
+ typealias Keys = PTRBridgeKeys.SdkConfigKeys
248
+ if let clientId = json[Keys.clientId] as? String { PTRNativeLibrary.params.clientIdentifier = clientId }
249
+ if let licenseKey = json[Keys.licenseKey] as? String { PTRNativeLibrary.params.licenseKey = licenseKey }
250
+ if let baseUrl = json[Keys.baseUrl] as? String { PTRNativeLibrary.params.baseUrl = baseUrl }
251
+ if let personaId = json[Keys.personaId] as? String { PTRNativeLibrary.params.personaIdentifier = personaId }
252
+ if let logLevel = json[Keys.logLevel] as? Int32 {
251
253
  PTRNativeLibrary.params.loggerLevel = PTRLoggerLevel(rawValue: logLevel) ?? .error
252
254
  }
253
255
  PTRNativeLibrary.params.mode = PointrDebugMode()
@@ -281,43 +283,46 @@ import PointrKit
281
283
  }
282
284
 
283
285
  private func executeCommandFromJSON(_ jsonString: String) {
286
+ typealias Keys = PTRBridgeKeys.ActionParamKeys
287
+ typealias Types = PTRBridgeKeys.ActionTypes
288
+
284
289
  guard let data = jsonString.data(using: .utf8),
285
290
  let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
286
- let type = json["type"] as? String else {
291
+ let type = json[Keys.type] as? String else {
287
292
  print("PTRMapWidget: invalid command JSON")
288
293
  return
289
294
  }
290
295
 
291
- let siteId = json["site"] as? String ?? ""
292
- let buildingId = json["building"] as? String ?? ""
293
- let levelIndex = json["level"] as? Int ?? 0
294
- let poiId = json["poi"] as? String ?? ""
295
- let fromPoiId = json["fromPoi"] as? String ?? ""
296
- let toPoiId = json["toPoi"] as? String ?? ""
296
+ let siteId = json[Keys.site] as? String ?? ""
297
+ let buildingId = json[Keys.building] as? String ?? ""
298
+ let levelIndex = json[Keys.level] as? Int ?? 0
299
+ let poiId = json[Keys.poi] as? String ?? ""
300
+ let fromPoiId = json[Keys.fromPoi] as? String ?? ""
301
+ let toPoiId = json[Keys.toPoi] as? String ?? ""
297
302
 
298
303
  let action: PTRMapWidgetAction
299
304
  let commandParams: [String: Any]
300
305
 
301
306
  switch type {
302
- case "focusMap":
307
+ case Types.focusMap:
303
308
  let location: PTRMapWidgetLocation
304
309
  let params: [String: Any]
305
- if !buildingId.isEmpty && json["level"] != nil {
310
+ if !buildingId.isEmpty && json[Keys.level] != nil {
306
311
  location = PTRMapWidgetLevelLocation(
307
312
  siteID: PTRIdentifier(siteId, isExternal: true),
308
313
  buildingID: PTRIdentifier(buildingId, isExternal: true),
309
314
  levelIndex: levelIndex
310
315
  )
311
- params = ["command": "focusMap", "siteExternalIdentifier": siteId, "buildingExternalIdentifier": buildingId, "levelIndex": levelIndex]
316
+ params = ["command": Types.focusMap, "siteExternalIdentifier": siteId, "buildingExternalIdentifier": buildingId, "levelIndex": levelIndex]
312
317
  } else if !buildingId.isEmpty {
313
318
  location = PTRMapWidgetBuildingLocation(
314
319
  siteID: PTRIdentifier(siteId, isExternal: true),
315
320
  buildingID: PTRIdentifier(buildingId, isExternal: true)
316
321
  )
317
- params = ["command": "focusMap", "siteExternalIdentifier": siteId, "buildingExternalIdentifier": buildingId]
322
+ params = ["command": Types.focusMap, "siteExternalIdentifier": siteId, "buildingExternalIdentifier": buildingId]
318
323
  } else {
319
324
  location = PTRMapWidgetSiteLocation(siteID: PTRIdentifier(siteId, isExternal: true))
320
- params = ["command": "focusMap", "siteExternalIdentifier": siteId]
325
+ params = ["command": Types.focusMap, "siteExternalIdentifier": siteId]
321
326
  }
322
327
  commandParams = params
323
328
  let focusAction = PTRMapWidgetAction.focusMap(location: location, completion: nil)
@@ -327,20 +332,20 @@ import PointrKit
327
332
  }
328
333
  action = focusAction
329
334
 
330
- case "highlightPoi":
335
+ case Types.highlightPoi:
331
336
  let hlLocation = PTRMapWidgetPoiLocation(
332
337
  siteID: PTRIdentifier(siteId, isExternal: true),
333
338
  poiID: PTRIdentifier(poiId, isExternal: true)
334
339
  )
335
340
  let hlAction = PTRMapWidgetAction.highlightPoi(location: hlLocation, completion: nil)
336
- commandParams = ["command": "highlightPoi", "siteExternalIdentifier": siteId, "poiExternalIdentifier": poiId]
341
+ commandParams = ["command": Types.highlightPoi, "siteExternalIdentifier": siteId, "poiExternalIdentifier": poiId]
337
342
  hlAction.completion = { [weak self] error in
338
343
  var p = commandParams; p["error"] = error?.errorCode ?? ""
339
344
  self?.ptrMapWidgetDidEndLoading(withParameters: p)
340
345
  }
341
346
  action = hlAction
342
347
 
343
- case "displayRoute":
348
+ case Types.displayRoute:
344
349
  // Display a static route between two specified POIs (no live location required)
345
350
  let drSrc = PTRMapWidgetPoiLocation(
346
351
  siteID: PTRIdentifier(siteId, isExternal: true),
@@ -351,31 +356,31 @@ import PointrKit
351
356
  poiID: PTRIdentifier(toPoiId, isExternal: true)
352
357
  )
353
358
  let drAction = PTRMapWidgetAction.displayRoute(poiSource: drSrc, poiDestination: drDst, completion: nil)
354
- commandParams = ["command": "displayRoute", "siteExternalIdentifier": siteId, "fromPoiExternalIdentifier": fromPoiId, "toPoiExternalIdentifier": toPoiId]
359
+ commandParams = ["command": Types.displayRoute, "siteExternalIdentifier": siteId, "fromPoiExternalIdentifier": fromPoiId, "toPoiExternalIdentifier": toPoiId]
355
360
  drAction.completion = { [weak self] error in
356
361
  var p = commandParams; p["error"] = error?.localizedDescription ?? ""
357
362
  self?.ptrMapWidgetDidEndLoading(withParameters: p)
358
363
  }
359
364
  action = drAction
360
365
 
361
- case "startWayfinding":
366
+ case Types.startWayfinding:
362
367
  // Start live wayfinding from the user's current position to a destination POI
363
368
  let swDst = PTRMapWidgetPoiLocation(
364
369
  siteID: PTRIdentifier(siteId, isExternal: true),
365
370
  poiID: PTRIdentifier(poiId, isExternal: true)
366
371
  )
367
372
  let swAction = PTRMapWidgetAction.startWayfinding(poi: swDst, completion: nil)
368
- commandParams = ["command": "startWayfinding", "siteExternalIdentifier": siteId, "poiExternalIdentifier": poiId]
373
+ commandParams = ["command": Types.startWayfinding, "siteExternalIdentifier": siteId, "poiExternalIdentifier": poiId]
369
374
  swAction.completion = { [weak self] error in
370
375
  var p = commandParams; p["error"] = error?.errorCode ?? ""
371
376
  self?.ptrMapWidgetDidEndLoading(withParameters: p)
372
377
  }
373
378
  action = swAction
374
379
 
375
- case "markMyCar":
376
- let shouldShowPopup = json["shouldShowPopup"] as? Bool ?? true
380
+ case Types.markMyCar:
381
+ let shouldShowPopup = json[Keys.shouldShowPopup] as? Bool ?? true
377
382
  let mmcAction: PTRMapWidgetAction
378
- if !buildingId.isEmpty && json["level"] != nil {
383
+ if !buildingId.isEmpty && json[Keys.level] != nil {
379
384
  let mmcLevel = PTRMapWidgetLevelLocation(
380
385
  siteID: PTRIdentifier(siteId, isExternal: true),
381
386
  buildingID: PTRIdentifier(buildingId, isExternal: true),
@@ -386,27 +391,27 @@ import PointrKit
386
391
  let mmcSite = PTRMapWidgetSiteLocation(siteID: PTRIdentifier(siteId, isExternal: true))
387
392
  mmcAction = PTRMapWidgetAction.markMyCar(site: mmcSite, shouldShowPopup: shouldShowPopup)
388
393
  }
389
- commandParams = ["command": "markMyCar", "siteExternalIdentifier": siteId]
394
+ commandParams = ["command": Types.markMyCar, "siteExternalIdentifier": siteId]
390
395
  mmcAction.completion = { [weak self] error in
391
396
  var p = commandParams; p["error"] = error?.errorCode ?? ""
392
397
  self?.ptrMapWidgetDidEndLoading(withParameters: p)
393
398
  }
394
399
  action = mmcAction
395
400
 
396
- case "showMyCar":
401
+ case Types.showMyCar:
397
402
  let smcLoc = PTRMapWidgetSiteLocation(siteID: PTRIdentifier(siteId, isExternal: true))
398
403
  let smcAction = PTRMapWidgetAction.showMyCar(location: smcLoc)
399
- commandParams = ["command": "showMyCar", "siteExternalIdentifier": siteId]
404
+ commandParams = ["command": Types.showMyCar, "siteExternalIdentifier": siteId]
400
405
  smcAction.completion = { [weak self] error in
401
406
  var p = commandParams; p["error"] = error?.errorCode ?? ""
402
407
  self?.ptrMapWidgetDidEndLoading(withParameters: p)
403
408
  }
404
409
  action = smcAction
405
410
 
406
- case "focusCoordinate":
407
- let lat = json["latitude"] as? Double ?? 0.0
408
- let lon = json["longitude"] as? Double ?? 0.0
409
- let lvl = json["levelIndex"] as? Int ?? -1
411
+ case Types.focusCoordinate:
412
+ let lat = json[Keys.latitude] as? Double ?? 0.0
413
+ let lon = json[Keys.longitude] as? Double ?? 0.0
414
+ let lvl = json[Keys.levelIndex] as? Int ?? -1
410
415
  let coord = CLLocationCoordinate2D(latitude: lat, longitude: lon)
411
416
  let coordLocation: PTRMapWidgetLocation
412
417
  if lvl >= 0, !buildingId.isEmpty {
@@ -425,18 +430,18 @@ import PointrKit
425
430
  )
426
431
  }
427
432
  let coordAction = PTRMapWidgetAction.focusMap(location: coordLocation, completion: nil)
428
- commandParams = ["command": "focusCoordinate", "siteExternalIdentifier": siteId]
433
+ commandParams = ["command": Types.focusCoordinate, "siteExternalIdentifier": siteId]
429
434
  coordAction.completion = { [weak self] error in
430
435
  var p = commandParams; p["error"] = error?.errorCode ?? ""
431
436
  self?.ptrMapWidgetDidEndLoading(withParameters: p)
432
437
  }
433
438
  action = coordAction
434
439
 
435
- case "highlightCategory":
440
+ case Types.highlightCategory:
436
441
  // Highlight a single category on the existing map widget.
437
442
  // v10 SDK accepts a single category name (not an array of IDs).
438
- let categoryName = (json["categoryIds"] as? [String])?.first ?? (json["category"] as? String ?? "")
439
- commandParams = ["command": "highlightCategory", "siteExternalIdentifier": siteId]
443
+ let categoryName = (json[Keys.categoryIds] as? [String])?.first ?? (json["category"] as? String ?? "") // legacy singular payload, kept for compatibility
444
+ commandParams = ["command": Types.highlightCategory, "siteExternalIdentifier": siteId]
440
445
  waitForPointrState()
441
446
  DispatchQueue.main.async { [weak self] in
442
447
  guard let self = self else { return }
@@ -17,6 +17,9 @@ public class PTRMapWidgetManager: RCTViewManager {
17
17
  return "PTRMapWidget"
18
18
  }
19
19
 
20
+ // NOTE: the @objc method names below ARE the view manager command names that
21
+ // JS dispatches. They are mirrored in PTRBridgeKeys.CommandNames (and in
22
+ // src/constants/bridgeKeys.ts) — renaming one means renaming all of them.
20
23
  private func focus(_ reactTag: NSNumber, location: PTRMapWidgetLocation, commandParameters: [String: Any]) {
21
24
  self.bridge.uiManager.addUIBlock { (uiManager, viewRegistry) in
22
25
  guard let ptrMapWidgetContainerView = uiManager?.view(forReactTag: reactTag) as? PTRMapWidgetContainerView else {
@@ -40,7 +43,7 @@ public class PTRMapWidgetManager: RCTViewManager {
40
43
  @objc func site(_ reactTag: NSNumber, siteExternalIdentifier: String) {
41
44
  let siteLocation = PTRMapWidgetSiteLocation(siteID: PTRIdentifier(siteExternalIdentifier, isExternal: true))
42
45
  let commandParameters: [String: Any] = [
43
- "command": "site",
46
+ "command": PTRBridgeKeys.CommandNames.focusSite,
44
47
  "siteExternalIdentifier": siteExternalIdentifier
45
48
  ]
46
49
  focus(reactTag, location: siteLocation, commandParameters: commandParameters)
@@ -52,7 +55,7 @@ public class PTRMapWidgetManager: RCTViewManager {
52
55
  buildingID: PTRIdentifier(buildingExternalIdentifier, isExternal: true)
53
56
  )
54
57
  let commandParameters: [String: Any] = [
55
- "command": "building",
58
+ "command": PTRBridgeKeys.CommandNames.focusBuilding,
56
59
  "siteExternalIdentifier": siteExternalIdentifier,
57
60
  "buildingExternalIdentifier": buildingExternalIdentifier
58
61
  ]
@@ -66,7 +69,7 @@ public class PTRMapWidgetManager: RCTViewManager {
66
69
  levelIndex: levelIndex
67
70
  )
68
71
  let commandParameters: [String: Any] = [
69
- "command": "level",
72
+ "command": PTRBridgeKeys.CommandNames.focusLevel,
70
73
  "siteExternalIdentifier": siteExternalIdentifier,
71
74
  "buildingExternalIdentifier": buildingExternalIdentifier,
72
75
  "levelIndex": levelIndex
@@ -86,7 +89,7 @@ public class PTRMapWidgetManager: RCTViewManager {
86
89
  )
87
90
  let action = PTRMapWidgetAction.highlightPoi(location: poiLocation, completion: { error in
88
91
  let ptrCommand: [String: Any] = [
89
- "command": "poi",
92
+ "command": PTRBridgeKeys.CommandNames.highlightPoi,
90
93
  "siteExternalIdentifier": siteExternalIdentifier,
91
94
  "poiExternalIdentifier": poiExternalIdentifier,
92
95
  "error": error?.errorCode ?? ""
@@ -114,7 +117,7 @@ public class PTRMapWidgetManager: RCTViewManager {
114
117
  ),
115
118
  completion: { error in
116
119
  let ptrCommand: [String: Any] = [
117
- "command": "startWayfinding",
120
+ "command": PTRBridgeKeys.CommandNames.startWayfinding,
118
121
  "siteExternalIdentifier": siteExternalIdentifier,
119
122
  "poiExternalIdentifier": toPoiExternalIdentifier,
120
123
  "error": error?.errorCode ?? ""
@@ -148,7 +151,7 @@ public class PTRMapWidgetManager: RCTViewManager {
148
151
  poiDestination: destinationPoiLocation,
149
152
  completion: { error in
150
153
  let ptrCommand: [String: Any] = [
151
- "command": "displayRoute",
154
+ "command": PTRBridgeKeys.CommandNames.displayRoute,
152
155
  "siteExternalIdentifier": siteExternalIdentifier,
153
156
  "sourcePoiExternalIdentifier": sourcePoiExternalIdentifier,
154
157
  "destinationPoiExternalIdentifier": destinationPoiExternalIdentifier,
@@ -179,7 +182,7 @@ public class PTRMapWidgetManager: RCTViewManager {
179
182
  shouldShowPopup: shouldShowPopup,
180
183
  completion: { error in
181
184
  let ptrCommand: [String: Any] = [
182
- "command": "markMyCarForLevel",
185
+ "command": PTRBridgeKeys.CommandNames.markMyCarForLevel,
183
186
  "siteExternalIdentifier": siteExternalIdentifier,
184
187
  "buildingExternalIdentifier": buildingExternalIdentifier,
185
188
  "levelIndex": levelIndex,
@@ -209,7 +212,7 @@ public class PTRMapWidgetManager: RCTViewManager {
209
212
  shouldShowPopup: shouldShowPopup,
210
213
  completion: { error in
211
214
  let ptrCommand: [String: Any] = [
212
- "command": "markMyCarForSite",
215
+ "command": PTRBridgeKeys.CommandNames.markMyCarForSite,
213
216
  "siteExternalIdentifier": siteExternalIdentifier,
214
217
  "shouldShowPopup": shouldShowPopup,
215
218
  "animationType": animationType,
@@ -236,7 +239,7 @@ public class PTRMapWidgetManager: RCTViewManager {
236
239
  ),
237
240
  completion: { error in
238
241
  let ptrCommand: [String: Any] = [
239
- "command": "myCarForSite",
242
+ "command": PTRBridgeKeys.CommandNames.showMyCarForSite,
240
243
  "siteExternalIdentifier": siteExternalIdentifier,
241
244
  "animationType": animationType,
242
245
  "error": error?.errorCode ?? ""
@@ -277,7 +280,7 @@ public class PTRMapWidgetManager: RCTViewManager {
277
280
  }
278
281
  let action = PTRMapWidgetAction.focusMap(location: location, completion: { error in
279
282
  view.ptrMapWidgetDidEndLoading(withParameters: [
280
- "command": "coordinate",
283
+ "command": PTRBridgeKeys.CommandNames.focusCoordinate,
281
284
  "siteExternalIdentifier": siteExternalIdentifier,
282
285
  "error": error?.errorCode ?? ""
283
286
  ])
@@ -303,7 +306,7 @@ public class PTRMapWidgetManager: RCTViewManager {
303
306
  mapVC.performAction(action)
304
307
  }
305
308
  view.ptrMapWidgetDidEndLoading(withParameters: [
306
- "command": "highlightCategory",
309
+ "command": PTRBridgeKeys.CommandNames.highlightCategory,
307
310
  "siteExternalIdentifier": siteExternalIdentifier
308
311
  ])
309
312
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-pointr",
3
- "version": "10.6.0",
3
+ "version": "10.7.1",
4
4
  "description": "Pointr React-Native Module",
5
5
  "main": "src/index",
6
6
  "files": [
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
16
16
 
17
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
18
18
 
19
- s.dependency 'PointrKit', '10.6.0'
19
+ s.dependency 'PointrKit', '10.7.0'
20
20
 
21
21
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
22
22
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
@@ -1,5 +1,5 @@
1
1
  import { UIManager } from 'react-native';
2
- import { PTRActionType } from './constants';
2
+ import { PTRActionType, PTRCommandNames } from './constants';
3
3
  import { PTRFocusMapAction, PTRHighlightPoiAction, PTRDisplayRouteAction, PTRStartWayfindingAction, PTRAction, PTRMarkMyCarAction, PTRShowMyCarAction, PTRFocusCoordinateAction, PTRHighlightCategoryAction } from './actions';
4
4
 
5
5
  /**
@@ -17,19 +17,19 @@ export const showMapWidget = (reactTag: number, ptrCommand: PTRAction) => {
17
17
  if (focusAction.level !== undefined && focusAction.building) {
18
18
  UIManager.dispatchViewManagerCommand(
19
19
  reactTag,
20
- 'level',
20
+ PTRCommandNames.FOCUS_LEVEL,
21
21
  [focusAction.site, focusAction.building, focusAction.level],
22
22
  );
23
23
  } else if (focusAction.building) {
24
24
  UIManager.dispatchViewManagerCommand(
25
25
  reactTag,
26
- 'building',
26
+ PTRCommandNames.FOCUS_BUILDING,
27
27
  [focusAction.site, focusAction.building],
28
28
  );
29
29
  } else {
30
30
  UIManager.dispatchViewManagerCommand(
31
31
  reactTag,
32
- 'site',
32
+ PTRCommandNames.FOCUS_SITE,
33
33
  [focusAction.site],
34
34
  );
35
35
  }
@@ -39,7 +39,7 @@ export const showMapWidget = (reactTag: number, ptrCommand: PTRAction) => {
39
39
  const highlightPoiAction = ptrCommand as PTRHighlightPoiAction;
40
40
  UIManager.dispatchViewManagerCommand(
41
41
  reactTag,
42
- 'poi',
42
+ PTRCommandNames.HIGHLIGHT_POI,
43
43
  [highlightPoiAction.site, highlightPoiAction.poi],
44
44
  );
45
45
  break;
@@ -48,7 +48,7 @@ export const showMapWidget = (reactTag: number, ptrCommand: PTRAction) => {
48
48
  const displayRouteAction = ptrCommand as PTRDisplayRouteAction;
49
49
  UIManager.dispatchViewManagerCommand(
50
50
  reactTag,
51
- 'displayRoute',
51
+ PTRCommandNames.DISPLAY_ROUTE,
52
52
  [displayRouteAction.site, displayRouteAction.fromPoi, displayRouteAction.toPoi],
53
53
  );
54
54
  break;
@@ -57,7 +57,7 @@ export const showMapWidget = (reactTag: number, ptrCommand: PTRAction) => {
57
57
  const wayfindingAction = ptrCommand as PTRStartWayfindingAction;
58
58
  UIManager.dispatchViewManagerCommand(
59
59
  reactTag,
60
- 'startWayfinding',
60
+ PTRCommandNames.START_WAYFINDING,
61
61
  [wayfindingAction.site, wayfindingAction.poi],
62
62
  );
63
63
  break;
@@ -67,13 +67,13 @@ export const showMapWidget = (reactTag: number, ptrCommand: PTRAction) => {
67
67
  if (markMyCarAction.building !== undefined && markMyCarAction.level !== undefined) {
68
68
  UIManager.dispatchViewManagerCommand(
69
69
  reactTag,
70
- 'markMyCarForLevel',
70
+ PTRCommandNames.MARK_MY_CAR_FOR_LEVEL,
71
71
  [markMyCarAction.site, markMyCarAction.building, markMyCarAction.level, markMyCarAction.shouldShowPopup, markMyCarAction.animationType],
72
72
  );
73
73
  } else {
74
74
  UIManager.dispatchViewManagerCommand(
75
75
  reactTag,
76
- 'markMyCarForSite',
76
+ PTRCommandNames.MARK_MY_CAR_FOR_SITE,
77
77
  [markMyCarAction.site, markMyCarAction.shouldShowPopup, markMyCarAction.animationType],
78
78
  );
79
79
  }
@@ -83,7 +83,7 @@ export const showMapWidget = (reactTag: number, ptrCommand: PTRAction) => {
83
83
  const showMyCarAction = ptrCommand as PTRShowMyCarAction;
84
84
  UIManager.dispatchViewManagerCommand(
85
85
  reactTag,
86
- 'myCarForSite',
86
+ PTRCommandNames.SHOW_MY_CAR_FOR_SITE,
87
87
  [showMyCarAction.site, showMyCarAction.animationType],
88
88
  );
89
89
  break;
@@ -92,7 +92,7 @@ export const showMapWidget = (reactTag: number, ptrCommand: PTRAction) => {
92
92
  const coordAction = ptrCommand as PTRFocusCoordinateAction;
93
93
  UIManager.dispatchViewManagerCommand(
94
94
  reactTag,
95
- 'coordinate',
95
+ PTRCommandNames.FOCUS_COORDINATE,
96
96
  [coordAction.site, coordAction.latitude, coordAction.longitude, coordAction.levelIndex ?? -1],
97
97
  );
98
98
  break;
@@ -101,7 +101,7 @@ export const showMapWidget = (reactTag: number, ptrCommand: PTRAction) => {
101
101
  const filterAction = ptrCommand as PTRHighlightCategoryAction;
102
102
  UIManager.dispatchViewManagerCommand(
103
103
  reactTag,
104
- 'highlightCategory',
104
+ PTRCommandNames.HIGHLIGHT_CATEGORY,
105
105
  [filterAction.site, filterAction.categoryIds],
106
106
  );
107
107
  break;