react-native-pointr 9.1.0 → 9.3.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.
Files changed (78) hide show
  1. package/API_REFERENCE.md +887 -0
  2. package/CHANGELOG.md +35 -0
  3. package/EXTENDING.md +419 -0
  4. package/README.md +221 -117
  5. package/WAYFINDING_EVENTS.md +243 -0
  6. package/android/build.gradle +3 -16
  7. package/android/src/main/java/com/pointr/PTRCoreExtensions.kt +126 -0
  8. package/android/src/main/java/com/pointr/PTRMapWidgetCommandType.kt +3 -1
  9. package/android/src/main/java/com/pointr/PTRMapWidgetManager.kt +160 -11
  10. package/android/src/main/java/com/pointr/PointrModule.kt +106 -3
  11. package/example/pointr_rn_demo/.bundle/config +2 -0
  12. package/example/pointr_rn_demo/.eslintrc.js +4 -0
  13. package/example/pointr_rn_demo/.prettierrc.js +5 -0
  14. package/example/pointr_rn_demo/.watchmanconfig +1 -0
  15. package/example/pointr_rn_demo/App.tsx +323 -0
  16. package/example/pointr_rn_demo/Gemfile +16 -0
  17. package/example/pointr_rn_demo/Gemfile.lock +111 -0
  18. package/example/pointr_rn_demo/README.md +188 -0
  19. package/example/pointr_rn_demo/__tests__/App.test.tsx +13 -0
  20. package/example/pointr_rn_demo/android/app/build.gradle +119 -0
  21. package/example/pointr_rn_demo/android/app/debug.keystore +0 -0
  22. package/example/pointr_rn_demo/android/app/proguard-rules.pro +10 -0
  23. package/example/pointr_rn_demo/android/app/src/main/AndroidManifest.xml +27 -0
  24. package/example/pointr_rn_demo/android/app/src/main/java/com/pointr_rn_demo/MainActivity.kt +22 -0
  25. package/example/pointr_rn_demo/android/app/src/main/java/com/pointr_rn_demo/MainApplication.kt +27 -0
  26. package/example/pointr_rn_demo/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  27. package/example/pointr_rn_demo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  28. package/example/pointr_rn_demo/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  29. package/example/pointr_rn_demo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  30. package/example/pointr_rn_demo/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  31. package/example/pointr_rn_demo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  32. package/example/pointr_rn_demo/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  33. package/example/pointr_rn_demo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  34. package/example/pointr_rn_demo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  35. package/example/pointr_rn_demo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  36. package/example/pointr_rn_demo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  37. package/example/pointr_rn_demo/android/app/src/main/res/values/strings.xml +3 -0
  38. package/example/pointr_rn_demo/android/app/src/main/res/values/styles.xml +9 -0
  39. package/example/pointr_rn_demo/android/build.gradle +32 -0
  40. package/example/pointr_rn_demo/android/gradle.properties +44 -0
  41. package/example/pointr_rn_demo/android/settings.gradle +6 -0
  42. package/example/pointr_rn_demo/app.json +4 -0
  43. package/example/pointr_rn_demo/babel.config.js +3 -0
  44. package/example/pointr_rn_demo/index.js +16 -0
  45. package/example/pointr_rn_demo/ios/.xcode.env +11 -0
  46. package/example/pointr_rn_demo/ios/Podfile +40 -0
  47. package/example/pointr_rn_demo/ios/Podfile.lock +2767 -0
  48. package/example/pointr_rn_demo/ios/pointr_rn_demo/AppDelegate.swift +48 -0
  49. package/example/pointr_rn_demo/ios/pointr_rn_demo/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  50. package/example/pointr_rn_demo/ios/pointr_rn_demo/Images.xcassets/Contents.json +6 -0
  51. package/example/pointr_rn_demo/ios/pointr_rn_demo/Info.plist +63 -0
  52. package/example/pointr_rn_demo/ios/pointr_rn_demo/LaunchScreen.storyboard +47 -0
  53. package/example/pointr_rn_demo/ios/pointr_rn_demo/PrivacyInfo.xcprivacy +37 -0
  54. package/example/pointr_rn_demo/ios/pointr_rn_demo.xcodeproj/project.pbxproj +496 -0
  55. package/example/pointr_rn_demo/ios/pointr_rn_demo.xcodeproj/xcshareddata/xcschemes/pointr_rn_demo.xcscheme +88 -0
  56. package/example/pointr_rn_demo/ios/pointr_rn_demo.xcworkspace/contents.xcworkspacedata +10 -0
  57. package/example/pointr_rn_demo/jest.config.js +3 -0
  58. package/example/pointr_rn_demo/metro.config.js +22 -0
  59. package/example/pointr_rn_demo/package-lock.json +11747 -0
  60. package/example/pointr_rn_demo/package.json +46 -0
  61. package/example/pointr_rn_demo/prepare-demo-distribution.sh +103 -0
  62. package/example/pointr_rn_demo/tsconfig.json +5 -0
  63. package/ios/PTRMapWidgetContainerView.swift +59 -7
  64. package/ios/PTRMapWidgetManager-Bridging.m +65 -1
  65. package/ios/PTRMapWidgetManager.swift +185 -144
  66. package/ios/PTRNativeLibrary-Bridging.m +4 -0
  67. package/ios/PTRNativeLibrary.swift +244 -18
  68. package/package.json +16 -2
  69. package/prepare-distribution.sh +84 -0
  70. package/react-native-pointr.podspec +1 -1
  71. package/src/PTRCommand.ts +34 -1
  72. package/src/PTRMapWidgetUtils.ts +105 -5
  73. package/src/PTRPoiManager.ts +20 -0
  74. package/src/index.tsx +40 -1
  75. package/src/types/PTRGeometry.ts +70 -0
  76. package/src/types/PTRPoi.ts +49 -0
  77. package/src/types/PTRPosition.ts +22 -0
  78. package/src/types/PTRWayfindingEvent.ts +18 -0
@@ -17,146 +17,130 @@ public class PTRMapWidgetManager: RCTViewManager {
17
17
  return "PTRMapWidget"
18
18
  }
19
19
 
20
-
21
- @objc func site(_ reactTag: NSNumber, siteExternalIdentifier: String) {
20
+ private func focus(_ reactTag: NSNumber, location: PTRMapWidgetLocation, commandParameters: [String: Any]) {
22
21
  self.bridge.uiManager.addUIBlock { (uiManager, viewRegistry) in
23
22
  guard let ptrMapWidgetContainerView = uiManager?.view(forReactTag: reactTag) as? PTRMapWidgetContainerView else {
24
23
  print("Cannot find PTRMapWidgetContainerView with tag #\(reactTag)")
25
24
  return
26
25
  }
27
26
 
28
- DispatchQueue.main.async {
29
-
30
- let siteLocation = PTRMapWidgetSiteLocation(siteIdentifier: siteExternalIdentifier, isExternalIdentifiers: true)
31
- let action = PTRMapWidgetMapFocusAction(location: siteLocation)
32
- action.completion = { error in
33
- let ptrCommand: [String: Any] = [
34
- "command": "site",
35
- "siteExternalIdentifier": siteExternalIdentifier,
36
- "error": error?.errorCode ?? ""
37
- ]
38
- ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
39
- }
40
- let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
41
- print("calling show site method of mapWidget")
42
- ptrMapWidgetContainerView.present(mapWidget)
43
- }
27
+ let action = PTRMapWidgetMapFocusAction(location: location, completion: { error in
28
+ var ptrCommand = commandParameters
29
+ ptrCommand["error"] = error?.errorCode ?? ""
30
+ print("calling ptrMapWidgetDidEndLoading with parameters: \(ptrCommand)")
31
+ ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
32
+ })
33
+
34
+ let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
35
+ print("calling show \(commandParameters["command"] ?? "unknown") method of mapWidget")
36
+ ptrMapWidgetContainerView.present(mapWidget)
44
37
  }
45
38
  }
46
39
 
40
+ @objc func site(_ reactTag: NSNumber, siteExternalIdentifier: String) {
41
+ let siteLocation = PTRMapWidgetSiteLocation(siteIdentifier: siteExternalIdentifier, isExternalIdentifiers: true)
42
+ let commandParameters: [String: Any] = [
43
+ "command": "site",
44
+ "siteExternalIdentifier": siteExternalIdentifier
45
+ ]
46
+ focus(reactTag, location: siteLocation, commandParameters: commandParameters)
47
+ }
48
+
47
49
  @objc func building(_ reactTag: NSNumber, siteExternalIdentifier: String, buildingExternalIdentifier: String) {
48
- self.bridge.uiManager.addUIBlock { (uiManager, viewRegistry) in
49
- guard let ptrMapWidgetContainerView = uiManager?.view(forReactTag: reactTag) as? PTRMapWidgetContainerView else {
50
- print("Cannot find PTRMapWidgetContainerView with tag #\(reactTag)")
51
- return
52
- }
53
-
54
- DispatchQueue.main.async {
55
- let action = PTRMapWidgetMapFocusAction(location: PTRMapWidgetBuildingLocation(siteIdentifier: siteExternalIdentifier, buildingIdentifier: buildingExternalIdentifier, isExternalIdentifiers: true))
56
- action.completion = { error in
57
- let ptrCommand: [String: Any] = [
58
- "command": "building",
59
- "siteExternalIdentifier": siteExternalIdentifier,
60
- "buildingExternalIdentifier": buildingExternalIdentifier,
61
- "error": error?.errorCode ?? ""
62
- ]
63
- ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
64
- }
65
- let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
66
- print("calling show building method of mapWidget")
67
- ptrMapWidgetContainerView.present(mapWidget)
68
- }
69
- }
50
+ let buildingLocation = PTRMapWidgetBuildingLocation(siteIdentifier: siteExternalIdentifier, buildingIdentifier: buildingExternalIdentifier, isExternalIdentifiers: true)
51
+ let commandParameters: [String: Any] = [
52
+ "command": "building",
53
+ "siteExternalIdentifier": siteExternalIdentifier,
54
+ "buildingExternalIdentifier": buildingExternalIdentifier
55
+ ]
56
+ focus(reactTag, location: buildingLocation, commandParameters: commandParameters)
70
57
  }
71
58
 
72
59
  @objc func level(_ reactTag: NSNumber, siteExternalIdentifier: String, buildingExternalIdentifier: String, levelIndex: Int) {
73
- self.bridge.uiManager.addUIBlock { (uiManager, viewRegistry) in
74
- guard let ptrMapWidgetContainerView = uiManager?.view(forReactTag: reactTag) as? PTRMapWidgetContainerView else {
75
- print("Cannot find PTRMapWidgetContainerView with tag #\(reactTag)")
76
- return
77
- }
78
-
79
- DispatchQueue.main.async {
80
- let action = PTRMapWidgetMapFocusAction(location: PTRMapWidgetLevelLocation(siteIdentifier: siteExternalIdentifier, buildingIdentifier: buildingExternalIdentifier, levelIndex: levelIndex, isExternalIdentifiers: true))
81
- action.completion = { error in
82
- let ptrCommand: [String: Any] = [
83
- "command": "level",
84
- "siteExternalIdentifier": siteExternalIdentifier,
85
- "buildingExternalIdentifier": buildingExternalIdentifier,
86
- "levelIndex": levelIndex,
87
- "error": error?.errorCode ?? ""
88
- ]
89
- ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
90
- }
91
- let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
92
- print("calling show level method of mapWidget")
93
- ptrMapWidgetContainerView.present(mapWidget)
94
- }
95
- }
60
+ let levelLocation = PTRMapWidgetLevelLocation(siteIdentifier: siteExternalIdentifier, buildingIdentifier: buildingExternalIdentifier, levelIndex: levelIndex, isExternalIdentifiers: true)
61
+ let commandParameters: [String: Any] = [
62
+ "command": "level",
63
+ "siteExternalIdentifier": siteExternalIdentifier,
64
+ "buildingExternalIdentifier": buildingExternalIdentifier,
65
+ "levelIndex": levelIndex
66
+ ]
67
+ focus(reactTag, location: levelLocation, commandParameters: commandParameters)
96
68
  }
97
69
 
98
70
  @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) {
99
81
  self.bridge.uiManager.addUIBlock { (uiManager, viewRegistry) in
100
82
  guard let ptrMapWidgetContainerView = uiManager?.view(forReactTag: reactTag) as? PTRMapWidgetContainerView else {
101
83
  print("Cannot find PTRMapWidgetContainerView with tag #\(reactTag)")
102
84
  return
103
85
  }
104
86
 
105
- DispatchQueue.main.async {
106
- let action = PTRMapWidgetMapFocusAction(location: PTRMapWidgetPoiLocation(siteIdentifier: siteExternalIdentifier, poiIdentifier: poiExternalIdentifier, isExternalIdentifiers: true))
107
- action.completion = { error in
108
- let ptrCommand: [String: Any] = [
109
- "command": "poi",
110
- "siteExternalIdentifier": siteExternalIdentifier,
111
- "poiExternalIdentifier": poiExternalIdentifier,
112
- "error": error?.errorCode ?? ""
113
- ]
114
- ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
115
- }
116
- let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
117
- print("calling show poi method of mapWidget")
118
- ptrMapWidgetContainerView.present(mapWidget)
87
+
88
+ let action = PTRMapWidgetWayfindingAction(poiDestination: PTRMapWidgetPoiLocation(siteIdentifier: siteExternalIdentifier, poiIdentifier: toPoiExternalIdentifier, isExternalIdentifiers: true))
89
+ action.completion = { error in
90
+ let ptrCommand: [String: Any] = [
91
+ "command": "path",
92
+ "siteExternalIdentifier": siteExternalIdentifier,
93
+ "poiExternalIdentifier": toPoiExternalIdentifier,
94
+ "error": error?.errorCode ?? ""
95
+ ]
96
+ ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
119
97
  }
98
+ let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
99
+ print("calling show path method of mapWidget")
100
+ ptrMapWidgetContainerView.present(mapWidget)
120
101
  }
121
102
  }
122
103
 
123
- @objc func path(_ reactTag: NSNumber, siteExternalIdentifier: String, toPoiExternalIdentifier: String) {
104
+ @objc func staticPath(_ reactTag: NSNumber, siteExternalIdentifier: String, fromPoiExternalIdentifier: String, toPoiExternalIdentifier: String) {
124
105
  self.bridge.uiManager.addUIBlock { (uiManager, viewRegistry) in
125
106
  guard let ptrMapWidgetContainerView = uiManager?.view(forReactTag: reactTag) as? PTRMapWidgetContainerView else {
126
107
  print("Cannot find PTRMapWidgetContainerView with tag #\(reactTag)")
127
108
  return
128
109
  }
129
110
 
130
- DispatchQueue.main.async {
131
- let action = PTRMapWidgetWayfindingAction(poiDestination: PTRMapWidgetPoiLocation(siteIdentifier: siteExternalIdentifier, poiIdentifier: toPoiExternalIdentifier, isExternalIdentifiers: true))
132
- action.completion = { error in
133
- let ptrCommand: [String: Any] = [
134
- "command": "path",
135
- "siteExternalIdentifier": siteExternalIdentifier,
136
- "poiExternalIdentifier": toPoiExternalIdentifier,
137
- "error": error?.errorCode ?? ""
138
- ]
139
- ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
140
- }
141
- let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
142
- print("calling show path method of mapWidget")
143
- ptrMapWidgetContainerView.present(mapWidget)
111
+ DispatchQueue.global(qos: .default).async {
112
+ ptrMapWidgetContainerView.showStaticPath(siteExternalIdentifier,
113
+ fromPoiExternalIdentifier: fromPoiExternalIdentifier,
114
+ toPoiExternalIdentifier: toPoiExternalIdentifier)
144
115
  }
145
116
  }
146
117
  }
147
118
 
148
- @objc func staticPath(_ reactTag: NSNumber, siteExternalIdentifier: String, fromPoiExternalIdentifier: String, toPoiExternalIdentifier: String) {
119
+ @objc func staticWayfinding(_ reactTag: NSNumber, siteExternalIdentifier: String, sourcePoiExternalIdentifier: String, destinationPoiExternalIdentifier: String) {
149
120
  self.bridge.uiManager.addUIBlock { (uiManager, viewRegistry) in
150
121
  guard let ptrMapWidgetContainerView = uiManager?.view(forReactTag: reactTag) as? PTRMapWidgetContainerView else {
151
122
  print("Cannot find PTRMapWidgetContainerView with tag #\(reactTag)")
152
123
  return
153
124
  }
154
125
 
155
- DispatchQueue.global(qos: .default).async {
156
- ptrMapWidgetContainerView.showStaticPath(siteExternalIdentifier,
157
- fromPoiExternalIdentifier: fromPoiExternalIdentifier,
158
- toPoiExternalIdentifier: toPoiExternalIdentifier)
126
+ let sourcePoiLocation = PTRMapWidgetPoiLocation(siteIdentifier: siteExternalIdentifier, poiIdentifier: sourcePoiExternalIdentifier, isExternalIdentifiers: true)
127
+ let destinationPoiLocation = PTRMapWidgetPoiLocation(siteIdentifier: siteExternalIdentifier, poiIdentifier: destinationPoiExternalIdentifier, isExternalIdentifiers: true)
128
+
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)
159
139
  }
140
+
141
+ let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
142
+ print("calling show static wayfinding method of mapWidget")
143
+ ptrMapWidgetContainerView.present(mapWidget)
160
144
  }
161
145
  }
162
146
 
@@ -167,24 +151,22 @@ public class PTRMapWidgetManager: RCTViewManager {
167
151
  return
168
152
  }
169
153
 
170
- DispatchQueue.main.async {
171
- let action = PTRMapWidgetMarkMyCarAction(levelLocation: PTRMapWidgetLevelLocation(siteIdentifier: siteExternalIdentifier, buildingIdentifier: buildingExternalIdentifier, levelIndex: levelIndex, isExternalIdentifiers: true), shouldShowPopup: shouldShowPopup)
172
- action.completion = { error in
173
- let ptrCommand: [String: Any] = [
174
- "command": "markMyCarForLevel",
175
- "siteExternalIdentifier": siteExternalIdentifier,
176
- "buildingExternalIdentifier": buildingExternalIdentifier,
177
- "levelIndex": levelIndex,
178
- "shouldShowPopup": shouldShowPopup,
179
- "animationType": animationType,
180
- "error": error?.errorCode ?? ""
181
- ]
182
- ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
183
- }
184
- let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
185
- print("calling show mark my car method of mapWidget")
186
- ptrMapWidgetContainerView.present(mapWidget)
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)
187
166
  }
167
+ let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
168
+ print("calling show mark my car method of mapWidget")
169
+ ptrMapWidgetContainerView.present(mapWidget)
188
170
  }
189
171
  }
190
172
 
@@ -195,22 +177,20 @@ public class PTRMapWidgetManager: RCTViewManager {
195
177
  return
196
178
  }
197
179
 
198
- DispatchQueue.main.async {
199
- let action = PTRMapWidgetMarkMyCarAction(siteLocation: PTRMapWidgetSiteLocation(siteIdentifier: siteExternalIdentifier, isExternalIdentifiers: true), shouldShowPopup: shouldShowPopup)
200
- action.completion = { error in
201
- let ptrCommand: [String: Any] = [
202
- "command": "markMyCarForSite",
203
- "siteExternalIdentifier": siteExternalIdentifier,
204
- "shouldShowPopup": shouldShowPopup,
205
- "animationType": animationType,
206
- "error": error?.errorCode ?? ""
207
- ]
208
- ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
209
- }
210
- let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
211
- print("calling show mark my car method of mapWidget")
212
- ptrMapWidgetContainerView.present(mapWidget)
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)
213
190
  }
191
+ let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
192
+ print("calling show mark my car method of mapWidget")
193
+ ptrMapWidgetContainerView.present(mapWidget)
214
194
  }
215
195
  }
216
196
 
@@ -221,22 +201,83 @@ public class PTRMapWidgetManager: RCTViewManager {
221
201
  return
222
202
  }
223
203
 
224
- DispatchQueue.main.async {
225
- let action = PTRMapWidgetShowMyCarAction(location: PTRMapWidgetSiteLocation(siteIdentifier: siteExternalIdentifier, isExternalIdentifiers: true))
226
- action.completion = { error in
227
- let ptrCommand: [String: Any] = [
228
- "command": "myCarForSite",
229
- "siteExternalIdentifier": siteExternalIdentifier,
230
- "animationType": animationType,
231
- "error": error?.errorCode ?? ""
232
- ]
233
- ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
234
- }
235
- let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
236
- print("calling show mark my car method of mapWidget")
237
- ptrMapWidgetContainerView.present(mapWidget)
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
+ }
214
+ let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
215
+ print("calling show mark my car method of mapWidget")
216
+ ptrMapWidgetContainerView.present(mapWidget)
217
+ }
218
+ }
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)
263
+ } else {
264
+ print("Error: Building ID is required for level focus")
265
+ }
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")
238
272
  }
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)
239
281
  }
240
282
  }
241
283
  }
242
-
@@ -31,4 +31,8 @@ RCT_EXTERN_METHOD(requestPermissions)
31
31
 
32
32
  RCT_EXTERN_METHOD(isMyCarMarked:(RCTResponseSenderBlock)callback)
33
33
 
34
+ RCT_EXTERN_METHOD(getPois:(NSString *)siteId
35
+ resolver:(RCTPromiseResolveBlock)resolve
36
+ rejecter:(RCTPromiseRejectBlock)reject)
37
+
34
38
  @end