react-native-pointr 9.1.0 → 9.2.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.
- package/android/build.gradle +1 -13
- package/android/src/main/java/com/pointr/PTRMapWidgetCommandType.kt +2 -1
- package/android/src/main/java/com/pointr/PTRMapWidgetManager.kt +87 -0
- package/ios/PTRMapWidgetContainerView.swift +4 -3
- package/ios/PTRMapWidgetManager-Bridging.m +58 -1
- package/ios/PTRMapWidgetManager.swift +164 -151
- package/ios/PTRNativeLibrary.swift +36 -16
- package/package.json +1 -1
- package/react-native-pointr.podspec +1 -1
- package/src/PTRCommand.ts +21 -1
- package/src/PTRMapWidgetUtils.ts +96 -5
package/android/build.gradle
CHANGED
|
@@ -13,18 +13,6 @@ buildscript {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
allprojects {
|
|
17
|
-
repositories {
|
|
18
|
-
maven {
|
|
19
|
-
url "https://android.pointr.dev/artifactory/gradle-release-local"
|
|
20
|
-
credentials {
|
|
21
|
-
username 'consumer'
|
|
22
|
-
password 'AKCp5dKiUPiSx94yLYgSsu6WzM4MaMAohkrpPyDydQgnNsUajTmhBXLzqLVkwJPNFNZzzv5Rt'
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
16
|
def reactNativeArchitectures() {
|
|
29
17
|
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
30
18
|
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
@@ -106,7 +94,7 @@ dependencies {
|
|
|
106
94
|
//noinspection GradleDynamicVersion
|
|
107
95
|
implementation "com.facebook.react:react-native:+"
|
|
108
96
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
109
|
-
implementation("com.pointrlabs:pointr:9.
|
|
97
|
+
implementation("com.pointrlabs:pointr:9.2.0")
|
|
110
98
|
implementation ("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version")
|
|
111
99
|
implementation 'com.google.android.material:material:1.12.0'
|
|
112
100
|
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
|
|
@@ -2,7 +2,7 @@ package com.pointr
|
|
|
2
2
|
|
|
3
3
|
import androidx.annotation.StringDef
|
|
4
4
|
|
|
5
|
-
@StringDef(value = [PTRMapWidgetCommandType.SITE, PTRMapWidgetCommandType.BUILDING, PTRMapWidgetCommandType.LEVEL, PTRMapWidgetCommandType.POI, PTRMapWidgetCommandType.PATH, PTRMapWidgetCommandType.STATIC_PATH])
|
|
5
|
+
@StringDef(value = [PTRMapWidgetCommandType.SITE, PTRMapWidgetCommandType.BUILDING, PTRMapWidgetCommandType.LEVEL, PTRMapWidgetCommandType.POI, PTRMapWidgetCommandType.PATH, PTRMapWidgetCommandType.STATIC_PATH, PTRMapWidgetCommandType.START_AND_FOCUS])
|
|
6
6
|
annotation class PTRMapWidgetCommandType {
|
|
7
7
|
companion object {
|
|
8
8
|
const val SITE = "site"
|
|
@@ -14,5 +14,6 @@ annotation class PTRMapWidgetCommandType {
|
|
|
14
14
|
const val MARK_MY_CAR_LEVEL = "markMyCarForLevel"
|
|
15
15
|
const val MARK_MY_CAR_SITE = "markMyCarForSite"
|
|
16
16
|
const val SHOW_MY_CAR_SITE = "showMyCarForSite"
|
|
17
|
+
const val START_AND_FOCUS = "startAndFocus"
|
|
17
18
|
}
|
|
18
19
|
}
|
|
@@ -17,6 +17,7 @@ import com.pointrlabs.core.management.DataManager
|
|
|
17
17
|
import com.pointrlabs.core.management.Pointr
|
|
18
18
|
import com.pointrlabs.core.management.interfaces.PointrListener
|
|
19
19
|
import com.pointrlabs.core.management.models.ErrorMessage
|
|
20
|
+
import com.pointrlabs.core.management.models.PTRParams
|
|
20
21
|
import com.pointrlabs.core.management.models.Site
|
|
21
22
|
import com.pointrlabs.core.management.models.deeplink.PTRMapWidgetAction
|
|
22
23
|
import com.pointrlabs.core.management.models.deeplink.PTRMapWidgetBuildingLocation
|
|
@@ -179,6 +180,55 @@ class PTRMapWidgetManager(private val reactContext: ReactApplicationContext) :
|
|
|
179
180
|
PTRMapWidgetShowMyCarAction(location, shouldShowPopup = args.getBoolean(1))
|
|
180
181
|
}
|
|
181
182
|
|
|
183
|
+
PTRMapWidgetCommandType.START_AND_FOCUS -> {
|
|
184
|
+
// First 4 parameters are initialization parameters
|
|
185
|
+
val clientId = args.getString(0).orEmpty()
|
|
186
|
+
val licenceKey = args.getString(1).orEmpty()
|
|
187
|
+
val baseUrl = args.getString(2).orEmpty()
|
|
188
|
+
val logLevel = args.getInt(3)
|
|
189
|
+
|
|
190
|
+
val ptrParams = PTRParams(clientId, licenceKey, baseUrl)
|
|
191
|
+
ptrParams.logLevel = try {
|
|
192
|
+
Plog.LogLevel.entries[logLevel]
|
|
193
|
+
} catch (_: IllegalArgumentException) {
|
|
194
|
+
Plog.LogLevel.ERROR
|
|
195
|
+
}
|
|
196
|
+
PointrModule.mapWidgetConfiguration.sdkParams = ptrParams
|
|
197
|
+
|
|
198
|
+
// Next parameter is focus type (site, building, level, poi)
|
|
199
|
+
val focusType = args.getString(4).orEmpty()
|
|
200
|
+
|
|
201
|
+
// Create focus action based on type
|
|
202
|
+
val location = when (focusType) {
|
|
203
|
+
PTRMapWidgetCommandType.SITE -> {
|
|
204
|
+
val siteId = args.getString(5).orEmpty()
|
|
205
|
+
PTRMapWidgetSiteLocation(siteId, isExternalIdentifier = true)
|
|
206
|
+
}
|
|
207
|
+
PTRMapWidgetCommandType.BUILDING -> {
|
|
208
|
+
val siteId = args.getString(5).orEmpty()
|
|
209
|
+
val buildingId = args.getString(6).orEmpty()
|
|
210
|
+
PTRMapWidgetBuildingLocation(siteId, buildingId, isExternalIdentifier = true)
|
|
211
|
+
}
|
|
212
|
+
PTRMapWidgetCommandType.LEVEL -> {
|
|
213
|
+
val siteId = args.getString(5).orEmpty()
|
|
214
|
+
val buildingId = args.getString(6).orEmpty()
|
|
215
|
+
val levelIndex = args.getInt(7)
|
|
216
|
+
PTRMapWidgetLevelLocation(siteId, buildingId, levelIndex, isExternalIdentifier = true)
|
|
217
|
+
}
|
|
218
|
+
PTRMapWidgetCommandType.POI -> {
|
|
219
|
+
val siteId = args.getString(5).orEmpty()
|
|
220
|
+
val poiId = args.getString(6).orEmpty()
|
|
221
|
+
PTRMapWidgetPoiLocation(siteId, poiId, isExternalIdentifier = true)
|
|
222
|
+
}
|
|
223
|
+
else -> {
|
|
224
|
+
// Default to site if invalid focus type
|
|
225
|
+
val siteId = args.getString(5).orEmpty()
|
|
226
|
+
PTRMapWidgetSiteLocation(siteId, isExternalIdentifier = true)
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
PTRMapWidgetFocusAction(location)
|
|
230
|
+
}
|
|
231
|
+
|
|
182
232
|
else -> return
|
|
183
233
|
}
|
|
184
234
|
action.onComplete = { error ->
|
|
@@ -260,6 +310,43 @@ class PTRMapWidgetManager(private val reactContext: ReactApplicationContext) :
|
|
|
260
310
|
event.putString("error", args[3] as String)
|
|
261
311
|
}
|
|
262
312
|
|
|
313
|
+
PTRMapWidgetCommandType.START_AND_FOCUS -> {
|
|
314
|
+
event.putString("clientId", args[0] as String)
|
|
315
|
+
event.putString("licenceKey", args[1] as String)
|
|
316
|
+
event.putString("baseUrl", args[2] as String)
|
|
317
|
+
event.putInt("logLevel", (args[3] as Number).toInt())
|
|
318
|
+
event.putString("focusType", args[4] as String)
|
|
319
|
+
|
|
320
|
+
// Add focus-specific parameters based on focus type
|
|
321
|
+
val focusType = args[4] as String
|
|
322
|
+
when (focusType) {
|
|
323
|
+
PTRMapWidgetCommandType.SITE -> {
|
|
324
|
+
event.putString("siteExternalIdentifier", args[5] as String)
|
|
325
|
+
event.putString("error", args.last().toString())
|
|
326
|
+
}
|
|
327
|
+
PTRMapWidgetCommandType.BUILDING -> {
|
|
328
|
+
event.putString("siteExternalIdentifier", args[5] as String)
|
|
329
|
+
event.putString("buildingExternalIdentifier", args[6] as String)
|
|
330
|
+
event.putString("error", args.last().toString())
|
|
331
|
+
}
|
|
332
|
+
PTRMapWidgetCommandType.LEVEL -> {
|
|
333
|
+
event.putString("siteExternalIdentifier", args[5] as String)
|
|
334
|
+
event.putString("buildingExternalIdentifier", args[6] as String)
|
|
335
|
+
event.putInt("levelIndex", (args[7] as Number).toInt())
|
|
336
|
+
event.putString("error", args.last().toString())
|
|
337
|
+
}
|
|
338
|
+
PTRMapWidgetCommandType.POI -> {
|
|
339
|
+
event.putString("siteExternalIdentifier", args[5] as String)
|
|
340
|
+
event.putString("poiExternalIdentifier", args[6] as String)
|
|
341
|
+
event.putString("error", args.last().toString())
|
|
342
|
+
}
|
|
343
|
+
else -> {
|
|
344
|
+
event.putString("siteExternalIdentifier", args[5] as String)
|
|
345
|
+
event.putString("error", args.last().toString())
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
263
350
|
else -> {
|
|
264
351
|
return
|
|
265
352
|
}
|
|
@@ -16,10 +16,11 @@ import PointrKit
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
@objc func getMapWidget(_ action: PTRMapWidgetAction) -> PTRMapWidgetViewController {
|
|
19
|
-
if
|
|
20
|
-
|
|
19
|
+
if PTRNativeLibrary.mapWidgetConfiguration.sdkParams == nil {
|
|
20
|
+
if waitForPointrState() != .running {
|
|
21
|
+
print("Pointr is not running")
|
|
22
|
+
}
|
|
21
23
|
}
|
|
22
|
-
|
|
23
24
|
print("initializing map widget")
|
|
24
25
|
mapWidget = PTRMapWidgetViewController(action: action, configuration: PTRNativeLibrary.mapWidgetConfiguration)
|
|
25
26
|
return mapWidget!
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
#import <React/RCTLog.h>
|
|
5
5
|
//
|
|
6
6
|
// PTRMapWidgetManager-Bridging.m
|
|
7
|
-
//
|
|
7
|
+
//
|
|
8
8
|
// This file provides Objective-C bridge methods for PTRMapWidgetManager
|
|
9
9
|
//
|
|
10
10
|
|
|
@@ -54,6 +54,63 @@ RCT_EXTERN_METHOD(markMyCarForSite:(nonnull NSNumber *)reactTag
|
|
|
54
54
|
RCT_EXTERN_METHOD(myCarForSite:(nonnull NSNumber *)reactTag
|
|
55
55
|
siteExternalIdentifier:(NSString *)siteExternalIdentifier
|
|
56
56
|
animationType:(NSInteger)animationType)
|
|
57
|
+
|
|
58
|
+
RCT_EXTERN_METHOD(startAndFocus:(nonnull NSNumber *)reactTag
|
|
59
|
+
clientId:(NSString *)clientId
|
|
60
|
+
licenseKey:(NSString *)licenseKey
|
|
61
|
+
baseUrl:(NSString *)baseUrl
|
|
62
|
+
logLevel:(NSInteger)logLevel
|
|
63
|
+
focusType:(nonnull NSString *)focusType
|
|
64
|
+
siteExternalIdentifier:(NSString *)siteExternalIdentifier
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
RCT_EXTERN_METHOD(startAndFocus:(nonnull NSNumber *)reactTag
|
|
68
|
+
clientId:(NSString *)clientId
|
|
69
|
+
licenseKey:(NSString *)licenseKey
|
|
70
|
+
baseUrl:(NSString *)baseUrl
|
|
71
|
+
focusType:(nonnull NSString *)focusType
|
|
72
|
+
siteExternalIdentifier:(NSString *)siteExternalIdentifier
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
RCT_EXTERN_METHOD(startAndFocus:(nonnull NSNumber *)reactTag
|
|
76
|
+
clientId:(NSString *)clientId
|
|
77
|
+
licenseKey:(NSString *)licenseKey
|
|
78
|
+
baseUrl:(NSString *)baseUrl
|
|
79
|
+
focusType:(nonnull NSString *)focusType
|
|
80
|
+
siteExternalIdentifier:(NSString *)siteExternalIdentifier
|
|
81
|
+
param1:(NSString *)param1
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
RCT_EXTERN_METHOD(startAndFocus:(nonnull NSNumber *)reactTag
|
|
85
|
+
clientId:(NSString *)clientId
|
|
86
|
+
licenseKey:(NSString *)licenseKey
|
|
87
|
+
baseUrl:(NSString *)baseUrl
|
|
88
|
+
focusType:(nonnull NSString *)focusType
|
|
89
|
+
siteExternalIdentifier:(NSString *)siteExternalIdentifier
|
|
90
|
+
param1:(NSString *)param1
|
|
91
|
+
levelIndex:(NSInteger)levelIndex
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
RCT_EXTERN_METHOD(startAndFocus:(nonnull NSNumber *)reactTag
|
|
95
|
+
clientId:(NSString *)clientId
|
|
96
|
+
licenseKey:(NSString *)licenseKey
|
|
97
|
+
baseUrl:(NSString *)baseUrl
|
|
98
|
+
logLevel:(NSInteger)logLevel
|
|
99
|
+
focusType:(nonnull NSString *)focusType
|
|
100
|
+
siteExternalIdentifier:(NSString *)siteExternalIdentifier
|
|
101
|
+
param1:(NSString *)param1
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
RCT_EXTERN_METHOD(startAndFocus:(nonnull NSNumber *)reactTag
|
|
105
|
+
clientId:(NSString *)clientId
|
|
106
|
+
licenseKey:(NSString *)licenseKey
|
|
107
|
+
baseUrl:(NSString *)baseUrl
|
|
108
|
+
logLevel:(NSInteger)logLevel
|
|
109
|
+
focusType:(nonnull NSString *)focusType
|
|
110
|
+
siteExternalIdentifier:(NSString *)siteExternalIdentifier
|
|
111
|
+
param1:(NSString *)param1
|
|
112
|
+
levelIndex:(NSInteger)levelIndex
|
|
113
|
+
)
|
|
57
114
|
@end
|
|
58
115
|
|
|
59
116
|
// No additional methods are needed here as the PTRMapWidgetManager is implemented in Objective-C
|
|
@@ -17,107 +17,64 @@ 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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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)
|
|
119
|
-
}
|
|
120
|
-
}
|
|
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)
|
|
121
78
|
}
|
|
122
79
|
|
|
123
80
|
@objc func path(_ reactTag: NSNumber, siteExternalIdentifier: String, toPoiExternalIdentifier: String) {
|
|
@@ -127,21 +84,20 @@ public class PTRMapWidgetManager: RCTViewManager {
|
|
|
127
84
|
return
|
|
128
85
|
}
|
|
129
86
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
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)
|
|
97
|
+
}
|
|
98
|
+
let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
|
|
99
|
+
print("calling show path method of mapWidget")
|
|
100
|
+
ptrMapWidgetContainerView.present(mapWidget)
|
|
145
101
|
}
|
|
146
102
|
}
|
|
147
103
|
|
|
@@ -154,8 +110,8 @@ public class PTRMapWidgetManager: RCTViewManager {
|
|
|
154
110
|
|
|
155
111
|
DispatchQueue.global(qos: .default).async {
|
|
156
112
|
ptrMapWidgetContainerView.showStaticPath(siteExternalIdentifier,
|
|
157
|
-
|
|
158
|
-
|
|
113
|
+
fromPoiExternalIdentifier: fromPoiExternalIdentifier,
|
|
114
|
+
toPoiExternalIdentifier: toPoiExternalIdentifier)
|
|
159
115
|
}
|
|
160
116
|
}
|
|
161
117
|
}
|
|
@@ -167,24 +123,22 @@ public class PTRMapWidgetManager: RCTViewManager {
|
|
|
167
123
|
return
|
|
168
124
|
}
|
|
169
125
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
ptrMapWidgetContainerView.present(mapWidget)
|
|
187
|
-
}
|
|
126
|
+
let action = PTRMapWidgetMarkMyCarAction(levelLocation: PTRMapWidgetLevelLocation(siteIdentifier: siteExternalIdentifier, buildingIdentifier: buildingExternalIdentifier, levelIndex: levelIndex, isExternalIdentifiers: true), shouldShowPopup: shouldShowPopup)
|
|
127
|
+
action.completion = { error in
|
|
128
|
+
let ptrCommand: [String: Any] = [
|
|
129
|
+
"command": "markMyCarForLevel",
|
|
130
|
+
"siteExternalIdentifier": siteExternalIdentifier,
|
|
131
|
+
"buildingExternalIdentifier": buildingExternalIdentifier,
|
|
132
|
+
"levelIndex": levelIndex,
|
|
133
|
+
"shouldShowPopup": shouldShowPopup,
|
|
134
|
+
"animationType": animationType,
|
|
135
|
+
"error": error?.errorCode ?? ""
|
|
136
|
+
]
|
|
137
|
+
ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
|
|
138
|
+
}
|
|
139
|
+
let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
|
|
140
|
+
print("calling show mark my car method of mapWidget")
|
|
141
|
+
ptrMapWidgetContainerView.present(mapWidget)
|
|
188
142
|
}
|
|
189
143
|
}
|
|
190
144
|
|
|
@@ -195,22 +149,20 @@ public class PTRMapWidgetManager: RCTViewManager {
|
|
|
195
149
|
return
|
|
196
150
|
}
|
|
197
151
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
ptrMapWidgetContainerView.present(mapWidget)
|
|
213
|
-
}
|
|
152
|
+
let action = PTRMapWidgetMarkMyCarAction(siteLocation: PTRMapWidgetSiteLocation(siteIdentifier: siteExternalIdentifier, isExternalIdentifiers: true), shouldShowPopup: shouldShowPopup)
|
|
153
|
+
action.completion = { error in
|
|
154
|
+
let ptrCommand: [String: Any] = [
|
|
155
|
+
"command": "markMyCarForSite",
|
|
156
|
+
"siteExternalIdentifier": siteExternalIdentifier,
|
|
157
|
+
"shouldShowPopup": shouldShowPopup,
|
|
158
|
+
"animationType": animationType,
|
|
159
|
+
"error": error?.errorCode ?? ""
|
|
160
|
+
]
|
|
161
|
+
ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
|
|
162
|
+
}
|
|
163
|
+
let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
|
|
164
|
+
print("calling show mark my car method of mapWidget")
|
|
165
|
+
ptrMapWidgetContainerView.present(mapWidget)
|
|
214
166
|
}
|
|
215
167
|
}
|
|
216
168
|
|
|
@@ -221,22 +173,83 @@ public class PTRMapWidgetManager: RCTViewManager {
|
|
|
221
173
|
return
|
|
222
174
|
}
|
|
223
175
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
176
|
+
let action = PTRMapWidgetShowMyCarAction(location: PTRMapWidgetSiteLocation(siteIdentifier: siteExternalIdentifier, isExternalIdentifiers: true))
|
|
177
|
+
action.completion = { error in
|
|
178
|
+
let ptrCommand: [String: Any] = [
|
|
179
|
+
"command": "myCarForSite",
|
|
180
|
+
"siteExternalIdentifier": siteExternalIdentifier,
|
|
181
|
+
"animationType": animationType,
|
|
182
|
+
"error": error?.errorCode ?? ""
|
|
183
|
+
]
|
|
184
|
+
ptrMapWidgetContainerView.ptrMapWidgetDidEndLoading(withParameters: ptrCommand)
|
|
185
|
+
}
|
|
186
|
+
let mapWidget = ptrMapWidgetContainerView.getMapWidget(action)
|
|
187
|
+
print("calling show mark my car method of mapWidget")
|
|
188
|
+
ptrMapWidgetContainerView.present(mapWidget)
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
@objc func startAndFocus(_ reactTag: NSNumber, clientId: String, licenseKey: String, baseUrl: String, focusType: String, siteExternalIdentifier: String) {
|
|
192
|
+
startAndFocus(reactTag, clientId: clientId, licenseKey: licenseKey, baseUrl: baseUrl, logLevel: 4, focusType: focusType, siteExternalIdentifier: siteExternalIdentifier, param1: "", levelIndex: 0)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
@objc func startAndFocus(_ reactTag: NSNumber, clientId: String, licenseKey: String, baseUrl: String, focusType: String, siteExternalIdentifier: String, param1: String) {
|
|
196
|
+
startAndFocus(reactTag, clientId: clientId, licenseKey: licenseKey, baseUrl: baseUrl, logLevel: 4, focusType: focusType, siteExternalIdentifier: siteExternalIdentifier, param1: param1, levelIndex: 0)
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
@objc func startAndFocus(_ reactTag: NSNumber, clientId: String, licenseKey: String, baseUrl: String, focusType: String, siteExternalIdentifier: String, param1: String, levelIndex: Int) {
|
|
200
|
+
startAndFocus(reactTag, clientId: clientId, licenseKey: licenseKey, baseUrl: baseUrl, logLevel: 4, focusType: focusType, siteExternalIdentifier: siteExternalIdentifier, param1: param1, levelIndex: levelIndex)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@objc func startAndFocus(_ reactTag: NSNumber, clientId: String, licenseKey: String, baseUrl: String, logLevel: Int, focusType: String, siteExternalIdentifier: String) {
|
|
204
|
+
startAndFocus(reactTag, clientId: clientId, licenseKey: licenseKey, baseUrl: baseUrl, logLevel: logLevel, focusType: focusType, siteExternalIdentifier: siteExternalIdentifier, param1: "", levelIndex: 0)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
@objc func startAndFocus(_ reactTag: NSNumber, clientId: String, licenseKey: String, baseUrl: String, logLevel: Int, focusType: String, siteExternalIdentifier: String, param1: String) {
|
|
208
|
+
startAndFocus(reactTag, clientId: clientId, licenseKey: licenseKey, baseUrl: baseUrl, logLevel: logLevel, focusType: focusType, siteExternalIdentifier: siteExternalIdentifier, param1: param1, levelIndex: 0)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
@objc func startAndFocus(_ reactTag: NSNumber, clientId: String, licenseKey: String, baseUrl: String, logLevel: Int, focusType: String, siteExternalIdentifier: String, param1: String, levelIndex: Int) {
|
|
212
|
+
|
|
213
|
+
// Initialize PTRParams
|
|
214
|
+
PTRNativeLibrary.params.clientIdentifier = clientId
|
|
215
|
+
PTRNativeLibrary.params.licenseKey = licenseKey
|
|
216
|
+
PTRNativeLibrary.params.baseUrl = baseUrl
|
|
217
|
+
PTRNativeLibrary.params.loggerLevel = PTRLoggerLevel(rawValue: Int32(logLevel)) ?? .error
|
|
218
|
+
PTRNativeLibrary.params.mode = PointrDebugMode()
|
|
219
|
+
|
|
220
|
+
// Set SDK params in map widget configuration
|
|
221
|
+
PTRNativeLibrary.mapWidgetConfiguration.sdkParams = PTRNativeLibrary.params
|
|
222
|
+
|
|
223
|
+
// Call appropriate focus method based on command type
|
|
224
|
+
switch focusType.lowercased() {
|
|
225
|
+
case "poi":
|
|
226
|
+
if !param1.isEmpty {
|
|
227
|
+
poi(reactTag, siteExternalIdentifier: siteExternalIdentifier, poiExternalIdentifier: param1)
|
|
228
|
+
} else {
|
|
229
|
+
print("Error: POI ID is required for POI focus")
|
|
238
230
|
}
|
|
231
|
+
|
|
232
|
+
case "level":
|
|
233
|
+
if !param1.isEmpty {
|
|
234
|
+
level(reactTag, siteExternalIdentifier: siteExternalIdentifier, buildingExternalIdentifier: param1, levelIndex: levelIndex)
|
|
235
|
+
} else {
|
|
236
|
+
print("Error: Building ID is required for level focus")
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
case "building":
|
|
240
|
+
if !param1.isEmpty {
|
|
241
|
+
building(reactTag, siteExternalIdentifier: siteExternalIdentifier, buildingExternalIdentifier: param1)
|
|
242
|
+
} else {
|
|
243
|
+
print("Error: Building ID is required for building focus")
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
case "site":
|
|
247
|
+
site(reactTag, siteExternalIdentifier: siteExternalIdentifier)
|
|
248
|
+
|
|
249
|
+
default:
|
|
250
|
+
print("Error: Unknown command type '\(focusType)'. Supported types: site, building, level, poi")
|
|
251
|
+
// Default to site focus if command type is unknown
|
|
252
|
+
site(reactTag, siteExternalIdentifier: siteExternalIdentifier)
|
|
239
253
|
}
|
|
240
254
|
}
|
|
241
255
|
}
|
|
242
|
-
|
|
@@ -22,25 +22,28 @@ class PTRNativeLibrary: RCTEventEmitter, PTREventManagerDelegate {
|
|
|
22
22
|
var ptrMapWidget: PTRMapWidgetViewController? = nil
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
static var configuration: Dictionary<String,Any>? = nil
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return mapWidgetConfiguration
|
|
30
|
-
}
|
|
31
|
-
let mirror = Mirror(reflecting: mapWidgetConfiguration)
|
|
32
|
-
for attr in mirror.children {
|
|
33
|
-
guard let key = attr.label else {
|
|
34
|
-
continue
|
|
25
|
+
static var configuration: Dictionary<String,Any>? = nil {
|
|
26
|
+
didSet {
|
|
27
|
+
guard let configuration else {
|
|
28
|
+
return
|
|
35
29
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
let mirror = Mirror(reflecting: mapWidgetConfiguration)
|
|
31
|
+
for attr in mirror.children {
|
|
32
|
+
guard let key = attr.label else {
|
|
33
|
+
continue
|
|
34
|
+
}
|
|
35
|
+
// only set boolean values
|
|
36
|
+
guard let value = configuration[key] as? Bool, attr.value is Bool else {
|
|
37
|
+
continue
|
|
38
|
+
}
|
|
39
|
+
mapWidgetConfiguration.setValue(value, forKey: key)
|
|
39
40
|
}
|
|
40
|
-
mapWidgetConfiguration.setValue(value, forKey: key)
|
|
41
41
|
}
|
|
42
|
-
return mapWidgetConfiguration
|
|
43
42
|
}
|
|
43
|
+
|
|
44
|
+
@objc public
|
|
45
|
+
static var mapWidgetConfiguration: PTRMapWidgetConfiguration = PTRMapWidgetConfiguration.defaultConfiguration()
|
|
46
|
+
|
|
44
47
|
private var dispatchGroupSiteManager = [DispatchGroup]()
|
|
45
48
|
var rootViewController: UIViewController? = nil
|
|
46
49
|
var isRouteFooterViewEnabled = true
|
|
@@ -48,6 +51,11 @@ class PTRNativeLibrary: RCTEventEmitter, PTREventManagerDelegate {
|
|
|
48
51
|
override init() {
|
|
49
52
|
super.init()
|
|
50
53
|
self.eventManagerDelegate = self
|
|
54
|
+
guard let permissionManager = Pointr.shared.permissionManager else {
|
|
55
|
+
print("EDIP - Pointr permission manager not available")
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
permissionManager.delegate = self
|
|
51
59
|
}
|
|
52
60
|
|
|
53
61
|
override static func requiresMainQueueSetup() -> Bool {
|
|
@@ -146,7 +154,6 @@ class PTRNativeLibrary: RCTEventEmitter, PTREventManagerDelegate {
|
|
|
146
154
|
baseUrl: String,
|
|
147
155
|
logLevel: Int) {
|
|
148
156
|
guard let presentedViewController = RCTPresentedViewController() else { return }
|
|
149
|
-
Pointr.shared.permissionManager?.delegate = self
|
|
150
157
|
self.rootViewController = presentedViewController
|
|
151
158
|
PTRNativeLibrary.params.mode = PointrDebugMode()
|
|
152
159
|
PTRNativeLibrary.params.loggerLevel = PTRLoggerLevel.init(rawValue: Int32(logLevel)) ?? .error
|
|
@@ -324,14 +331,27 @@ extension PTRNativeLibrary: PTRSiteManagerDelegate {
|
|
|
324
331
|
// MARK: - PTRPermissionManagerDelegate
|
|
325
332
|
extension PTRNativeLibrary: PTRPermissionManagerDelegate {
|
|
326
333
|
public func permissionManagerShouldRequestLocationAuthorizationPermission() -> Bool {
|
|
334
|
+
Plogv("Should request location permission: \(PTRNativeLibrary.shouldRequestPermissionsAtStartup)")
|
|
327
335
|
return PTRNativeLibrary.shouldRequestPermissionsAtStartup
|
|
328
336
|
}
|
|
329
337
|
|
|
330
338
|
public func permissionManagerShouldRequestBluetoothServicesPermission() -> Bool {
|
|
339
|
+
Plogv("Should request bluetooth permission: \(PTRNativeLibrary.shouldRequestPermissionsAtStartup)")
|
|
331
340
|
return PTRNativeLibrary.shouldRequestPermissionsAtStartup
|
|
332
341
|
}
|
|
333
342
|
|
|
334
343
|
public func permissionManagerShouldRequestUserNotificationAuthorizationPermission() -> Bool {
|
|
344
|
+
Plogv("Should request notification permission: \(PTRNativeLibrary.shouldRequestPermissionsAtStartup)")
|
|
345
|
+
return PTRNativeLibrary.shouldRequestPermissionsAtStartup
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
public func permissionManagerShouldRequestCoreMotionAuthorizationPermission(_ permissionManager: any PTRPermissionManagerInterface) -> Bool {
|
|
349
|
+
Plogv("Should request core motion permission: \(PTRNativeLibrary.shouldRequestPermissionsAtStartup)")
|
|
350
|
+
return PTRNativeLibrary.shouldRequestPermissionsAtStartup
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
func permissionManagerShouldRequestLocationAuthorizationPermissionForWhenInUse(_ permissionManager: any PTRPermissionManagerInterface) -> Bool {
|
|
354
|
+
Plogv("Should request location when in use permission: \(PTRNativeLibrary.shouldRequestPermissionsAtStartup)")
|
|
335
355
|
return PTRNativeLibrary.shouldRequestPermissionsAtStartup
|
|
336
356
|
}
|
|
337
357
|
}
|
package/package.json
CHANGED
|
@@ -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', '9.
|
|
19
|
+
s.dependency 'PointrKit', '9.2.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.
|
package/src/PTRCommand.ts
CHANGED
|
@@ -10,7 +10,8 @@ export enum PTRCommandType {
|
|
|
10
10
|
STATIC_PATH = "staticPath",
|
|
11
11
|
MARK_MY_CAR_LEVEL = "markMyCarForLevel",
|
|
12
12
|
MARK_MY_CAR_SITE = "markMyCarForSite",
|
|
13
|
-
SHOW_MY_CAR_SITE = "showMyCarForSite"
|
|
13
|
+
SHOW_MY_CAR_SITE = "showMyCarForSite",
|
|
14
|
+
START_AND_FOCUS = "startAndFocus"
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* Base class for all Pointr SDK commands
|
|
@@ -117,4 +118,23 @@ export class PTRShowMyCarSiteCommand extends PTRCommand {
|
|
|
117
118
|
constructor(public site: string, public shouldShowPopup: boolean = true, public animationType: number = 1) {
|
|
118
119
|
super(PTRCommandType.SHOW_MY_CAR_SITE);
|
|
119
120
|
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Command to start the SDK and focus on a location using an existing PTR command
|
|
125
|
+
* This command is not a PTRCommand itself, but wraps SDK initialization with a focus command
|
|
126
|
+
* @param clientId - the client ID for SDK initialization
|
|
127
|
+
* @param licenseKey - the license key for SDK initialization
|
|
128
|
+
* @param baseUrl - the base URL for SDK initialization
|
|
129
|
+
* @param logLevel - the log level for SDK initialization
|
|
130
|
+
* @param command - the PTR command to execute after SDK initialization (PTRSiteCommand, PTRBuildingCommand, PTRLevelCommand, or PTRPoiCommand)
|
|
131
|
+
*/
|
|
132
|
+
export class PTRStartAndFocusCommand {
|
|
133
|
+
constructor(
|
|
134
|
+
public clientId: string,
|
|
135
|
+
public licenseKey: string,
|
|
136
|
+
public baseUrl: string,
|
|
137
|
+
public logLevel: number = 4,
|
|
138
|
+
public command: PTRSiteCommand | PTRBuildingCommand | PTRLevelCommand | PTRPoiCommand
|
|
139
|
+
) {}
|
|
120
140
|
}
|
package/src/PTRMapWidgetUtils.ts
CHANGED
|
@@ -1,13 +1,104 @@
|
|
|
1
1
|
import { UIManager } from 'react-native';
|
|
2
|
-
import { PTRSiteCommand, PTRBuildingCommand, PTRLevelCommand, PTRPoiCommand, PTRPathCommand, PTRStaticPathCommand, PTRCommand, PTRCommandType, PTRMarkMyCarLevelCommand, PTRMarkMyCarSiteCommand, PTRShowMyCarSiteCommand } from 'react-native-pointr/src/PTRCommand';
|
|
2
|
+
import { PTRSiteCommand, PTRBuildingCommand, PTRLevelCommand, PTRPoiCommand, PTRPathCommand, PTRStaticPathCommand, PTRCommand, PTRCommandType, PTRMarkMyCarLevelCommand, PTRMarkMyCarSiteCommand, PTRShowMyCarSiteCommand, PTRStartAndFocusCommand } from 'react-native-pointr/src/PTRCommand';
|
|
3
|
+
/**
|
|
4
|
+
* Handle PTRStartAndFocusCommand specifically
|
|
5
|
+
* @param reactTag view tag of the map widget
|
|
6
|
+
* @param startAndFocusCommand the start and focus command
|
|
7
|
+
*/
|
|
8
|
+
const handleStartAndFocusCommand = (reactTag: number, startAndFocusCommand: PTRStartAndFocusCommand) => {
|
|
9
|
+
const innerCommand = startAndFocusCommand.command;
|
|
10
|
+
console.info('Handling PTRStartAndFocusCommand with type:', innerCommand.type);
|
|
11
|
+
// Build arguments based on the inner command type
|
|
12
|
+
let args: any[];
|
|
13
|
+
console.info('Inner command details:', innerCommand);
|
|
14
|
+
|
|
15
|
+
switch (innerCommand.type) {
|
|
16
|
+
case PTRCommandType.SITE: {
|
|
17
|
+
const siteCommand = innerCommand as PTRSiteCommand;
|
|
18
|
+
args = [
|
|
19
|
+
startAndFocusCommand.clientId,
|
|
20
|
+
startAndFocusCommand.licenseKey,
|
|
21
|
+
startAndFocusCommand.baseUrl,
|
|
22
|
+
startAndFocusCommand.logLevel,
|
|
23
|
+
innerCommand.type,
|
|
24
|
+
siteCommand.site,
|
|
25
|
+
"",
|
|
26
|
+
0
|
|
27
|
+
];
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
case PTRCommandType.BUILDING: {
|
|
31
|
+
const buildingCommand = innerCommand as PTRBuildingCommand;
|
|
32
|
+
args = [
|
|
33
|
+
startAndFocusCommand.clientId,
|
|
34
|
+
startAndFocusCommand.licenseKey,
|
|
35
|
+
startAndFocusCommand.baseUrl,
|
|
36
|
+
startAndFocusCommand.logLevel,
|
|
37
|
+
innerCommand.type,
|
|
38
|
+
buildingCommand.site,
|
|
39
|
+
buildingCommand.building,
|
|
40
|
+
0
|
|
41
|
+
];
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
case PTRCommandType.LEVEL: {
|
|
45
|
+
const levelCommand = innerCommand as PTRLevelCommand;
|
|
46
|
+
args = [
|
|
47
|
+
startAndFocusCommand.clientId,
|
|
48
|
+
startAndFocusCommand.licenseKey,
|
|
49
|
+
startAndFocusCommand.baseUrl,
|
|
50
|
+
startAndFocusCommand.logLevel,
|
|
51
|
+
innerCommand.type,
|
|
52
|
+
levelCommand.site,
|
|
53
|
+
levelCommand.building,
|
|
54
|
+
levelCommand.level
|
|
55
|
+
];
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
case PTRCommandType.POI: {
|
|
59
|
+
const poiCommand = innerCommand as PTRPoiCommand;
|
|
60
|
+
args = [
|
|
61
|
+
startAndFocusCommand.clientId,
|
|
62
|
+
startAndFocusCommand.licenseKey,
|
|
63
|
+
startAndFocusCommand.baseUrl,
|
|
64
|
+
startAndFocusCommand.logLevel,
|
|
65
|
+
innerCommand.type,
|
|
66
|
+
poiCommand.site,
|
|
67
|
+
poiCommand.poi,
|
|
68
|
+
0
|
|
69
|
+
];
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
default:
|
|
73
|
+
console.error('Unsupported command type in PTRStartAndFocusCommand:', innerCommand.type);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
console.info('Dispatching startAndFocus with args:', args);
|
|
77
|
+
UIManager.dispatchViewManagerCommand(
|
|
78
|
+
reactTag,
|
|
79
|
+
'startAndFocus',
|
|
80
|
+
args,
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
3
84
|
/**
|
|
4
85
|
* Show the map widget with the given command
|
|
5
86
|
* @param reactTag view tag of the map widget
|
|
6
|
-
* @param ptrCommand command to show the map widget
|
|
87
|
+
* @param ptrCommand command to show the map widget (PTRCommand or PTRStartAndFocusCommand)
|
|
7
88
|
*/
|
|
8
|
-
export const showMapWidget = (reactTag: number, ptrCommand: PTRCommand) => {
|
|
9
|
-
|
|
10
|
-
|
|
89
|
+
export const showMapWidget = (reactTag: number, ptrCommand: PTRCommand | PTRStartAndFocusCommand) => {
|
|
90
|
+
// Check if it's a PTRStartAndFocusCommand (which doesn't have a 'type' property)
|
|
91
|
+
if ('command' in ptrCommand) {
|
|
92
|
+
const startAndFocusCommand = ptrCommand as PTRStartAndFocusCommand;
|
|
93
|
+
console.log(`Showing map widget with start and focus command: ${startAndFocusCommand.command.type} and reactTag: ${reactTag}`);
|
|
94
|
+
handleStartAndFocusCommand(reactTag, startAndFocusCommand);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Handle regular PTRCommand
|
|
99
|
+
const command = ptrCommand as PTRCommand;
|
|
100
|
+
console.log(`Showing map widget with command: ${command.type} and reactTag: ${reactTag}`);
|
|
101
|
+
switch (command.type) {
|
|
11
102
|
case PTRCommandType.SITE: {
|
|
12
103
|
const siteCommand = ptrCommand as PTRSiteCommand;
|
|
13
104
|
UIManager.dispatchViewManagerCommand(
|