react-native-pointr 8.16.1 → 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 +6 -9
- package/android/gradle.properties +3 -3
- package/android/src/main/AndroidManifestNew.xml +2 -9
- package/android/src/main/java/com/pointr/PTRMapWidgetCommandType.kt +3 -4
- package/android/src/main/java/com/pointr/PTRMapWidgetManager.kt +265 -394
- package/android/src/main/java/com/pointr/PointrModule.kt +36 -177
- package/ios/PTRMapWidgetContainerView.swift +248 -0
- package/ios/PTRMapWidgetManager-Bridging.m +116 -0
- package/ios/PTRMapWidgetManager.swift +255 -0
- package/ios/PTRNativeLibrary-Bridging.m +34 -0
- package/ios/PTRNativeLibrary.swift +357 -0
- package/ios/react-native-pointr-Bridging-Header.h +5 -0
- package/package.json +1 -1
- package/react-native-pointr.podspec +1 -1
- package/src/PTRCommand.ts +25 -4
- package/src/PTRMapWidgetUtils.ts +107 -16
- package/android/.settings/org.eclipse.buildship.core.prefs +0 -2
- package/android/src/main/AndroidManifest.xml +0 -12
- package/android/src/main/java/com/pointr/PointrMapWidgetActivity.kt +0 -485
- package/android/src/main/res/layout/pointr_map_widget_activity_layout.xml +0 -16
- package/ios/PTRMapWidgetContainerView.h +0 -19
- package/ios/PTRMapWidgetContainerView.m +0 -281
- package/ios/PTRMapWidgetManager.m +0 -256
- package/ios/PTRNativeLibrary.h +0 -11
- package/ios/PTRNativeLibrary.m +0 -164
- package/ios/PointrApp.swift +0 -636
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#import <React/RCTBridgeModule.h>
|
|
2
|
+
#import <React/RCTViewManager.h>
|
|
3
|
+
#import <React/RCTEventEmitter.h>
|
|
4
|
+
#import <React/RCTLog.h>
|
|
5
|
+
//
|
|
6
|
+
// PTRMapWidgetManager-Bridging.m
|
|
7
|
+
//
|
|
8
|
+
// This file provides Objective-C bridge methods for PTRMapWidgetManager
|
|
9
|
+
//
|
|
10
|
+
|
|
11
|
+
// The PTRMapWidgetManager is now implemented directly in Objective-C
|
|
12
|
+
// No bridging methods needed as RCT_EXPORT_METHOD is used directly
|
|
13
|
+
|
|
14
|
+
@interface RCT_EXTERN_MODULE(PTRMapWidgetManager, RCTViewManager)
|
|
15
|
+
|
|
16
|
+
RCT_EXPORT_VIEW_PROPERTY(onMapWidgetDidEndLoading, RCTBubblingEventBlock)
|
|
17
|
+
|
|
18
|
+
RCT_EXTERN_METHOD(site:(nonnull NSNumber *)reactTag
|
|
19
|
+
siteExternalIdentifier:(NSString *)siteExternalIdentifier)
|
|
20
|
+
RCT_EXTERN_METHOD(building:(nonnull NSNumber *)reactTag
|
|
21
|
+
siteExternalIdentifier:(NSString *)siteExternalIdentifier
|
|
22
|
+
buildingExternalIdentifier:(NSString *)buildingExternalIdentifier)
|
|
23
|
+
|
|
24
|
+
RCT_EXTERN_METHOD(level:(nonnull NSNumber *)reactTag
|
|
25
|
+
siteExternalIdentifier:(NSString *)siteExternalIdentifier
|
|
26
|
+
buildingExternalIdentifier:(NSString *)buildingExternalIdentifier
|
|
27
|
+
levelIndex:(NSInteger)levelIndex)
|
|
28
|
+
|
|
29
|
+
RCT_EXTERN_METHOD(poi:(nonnull NSNumber *)reactTag
|
|
30
|
+
siteExternalIdentifier:(NSString *)siteExternalIdentifier
|
|
31
|
+
poiExternalIdentifier:(NSString *)poiExternalIdentifier)
|
|
32
|
+
|
|
33
|
+
RCT_EXTERN_METHOD(path:(nonnull NSNumber *)reactTag
|
|
34
|
+
siteExternalIdentifier:(NSString *)siteExternalIdentifier
|
|
35
|
+
toPoiExternalIdentifier:(NSString *)toPoiExternalIdentifier)
|
|
36
|
+
|
|
37
|
+
RCT_EXTERN_METHOD(staticPath:(nonnull NSNumber *)reactTag
|
|
38
|
+
siteExternalIdentifier:(NSString *)siteExternalIdentifier
|
|
39
|
+
fromPoiExternalIdentifier:(NSString *)fromPoiExternalIdentifier
|
|
40
|
+
toPoiExternalIdentifier:(NSString *)toPoiExternalIdentifier)
|
|
41
|
+
|
|
42
|
+
RCT_EXTERN_METHOD(markMyCarForLevel:(nonnull NSNumber *)reactTag
|
|
43
|
+
siteExternalIdentifier:(NSString *)siteExternalIdentifier
|
|
44
|
+
buildingExternalIdentifier:(NSString *)buildingExternalIdentifier
|
|
45
|
+
levelIndex:(NSInteger)levelIndex
|
|
46
|
+
shouldShowPopup:(BOOL)shouldShowPopup
|
|
47
|
+
animationType:(NSInteger)animationType)
|
|
48
|
+
|
|
49
|
+
RCT_EXTERN_METHOD(markMyCarForSite:(nonnull NSNumber *)reactTag
|
|
50
|
+
siteExternalIdentifier:(NSString *)siteExternalIdentifier
|
|
51
|
+
shouldShowPopup:(BOOL)shouldShowPopup
|
|
52
|
+
animationType:(NSInteger)animationType)
|
|
53
|
+
|
|
54
|
+
RCT_EXTERN_METHOD(myCarForSite:(nonnull NSNumber *)reactTag
|
|
55
|
+
siteExternalIdentifier:(NSString *)siteExternalIdentifier
|
|
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
|
+
)
|
|
114
|
+
@end
|
|
115
|
+
|
|
116
|
+
// No additional methods are needed here as the PTRMapWidgetManager is implemented in Objective-C
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import React
|
|
3
|
+
import PointrKit
|
|
4
|
+
|
|
5
|
+
@objc(PTRMapWidgetManager)
|
|
6
|
+
public class PTRMapWidgetManager: RCTViewManager {
|
|
7
|
+
|
|
8
|
+
override public static func requiresMainQueueSetup() -> Bool {
|
|
9
|
+
return true
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
override public func view() -> UIView! {
|
|
13
|
+
return PTRMapWidgetContainerView()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
override public static func moduleName() -> String! {
|
|
17
|
+
return "PTRMapWidget"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
private func focus(_ reactTag: NSNumber, location: PTRMapWidgetLocation, commandParameters: [String: Any]) {
|
|
21
|
+
self.bridge.uiManager.addUIBlock { (uiManager, viewRegistry) in
|
|
22
|
+
guard let ptrMapWidgetContainerView = uiManager?.view(forReactTag: reactTag) as? PTRMapWidgetContainerView else {
|
|
23
|
+
print("Cannot find PTRMapWidgetContainerView with tag #\(reactTag)")
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
|
|
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)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
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
|
+
|
|
49
|
+
@objc func building(_ reactTag: NSNumber, siteExternalIdentifier: String, buildingExternalIdentifier: String) {
|
|
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)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@objc func level(_ reactTag: NSNumber, siteExternalIdentifier: String, buildingExternalIdentifier: String, levelIndex: Int) {
|
|
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)
|
|
68
|
+
}
|
|
69
|
+
|
|
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) {
|
|
81
|
+
self.bridge.uiManager.addUIBlock { (uiManager, viewRegistry) in
|
|
82
|
+
guard let ptrMapWidgetContainerView = uiManager?.view(forReactTag: reactTag) as? PTRMapWidgetContainerView else {
|
|
83
|
+
print("Cannot find PTRMapWidgetContainerView with tag #\(reactTag)")
|
|
84
|
+
return
|
|
85
|
+
}
|
|
86
|
+
|
|
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)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@objc func staticPath(_ reactTag: NSNumber, siteExternalIdentifier: String, fromPoiExternalIdentifier: String, toPoiExternalIdentifier: String) {
|
|
105
|
+
self.bridge.uiManager.addUIBlock { (uiManager, viewRegistry) in
|
|
106
|
+
guard let ptrMapWidgetContainerView = uiManager?.view(forReactTag: reactTag) as? PTRMapWidgetContainerView else {
|
|
107
|
+
print("Cannot find PTRMapWidgetContainerView with tag #\(reactTag)")
|
|
108
|
+
return
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
DispatchQueue.global(qos: .default).async {
|
|
112
|
+
ptrMapWidgetContainerView.showStaticPath(siteExternalIdentifier,
|
|
113
|
+
fromPoiExternalIdentifier: fromPoiExternalIdentifier,
|
|
114
|
+
toPoiExternalIdentifier: toPoiExternalIdentifier)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@objc func markMyCarForLevel(_ reactTag: NSNumber, siteExternalIdentifier: String, buildingExternalIdentifier: String, levelIndex: Int, shouldShowPopup: Bool, animationType: Int) {
|
|
120
|
+
self.bridge.uiManager.addUIBlock { (uiManager, viewRegistry) in
|
|
121
|
+
guard let ptrMapWidgetContainerView = uiManager?.view(forReactTag: reactTag) as? PTRMapWidgetContainerView else {
|
|
122
|
+
print("Cannot find PTRMapWidgetContainerView with tag #\(reactTag)")
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
|
|
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)
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@objc func markMyCarForSite(_ reactTag: NSNumber, siteExternalIdentifier: String, shouldShowPopup: Bool, animationType: Int) {
|
|
146
|
+
self.bridge.uiManager.addUIBlock { (uiManager, viewRegistry) in
|
|
147
|
+
guard let ptrMapWidgetContainerView = uiManager?.view(forReactTag: reactTag) as? PTRMapWidgetContainerView else {
|
|
148
|
+
print("Cannot find PTRMapWidgetContainerView with tag #\(reactTag)")
|
|
149
|
+
return
|
|
150
|
+
}
|
|
151
|
+
|
|
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)
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@objc func myCarForSite(_ reactTag: NSNumber, siteExternalIdentifier: String, animationType: Int) {
|
|
170
|
+
self.bridge.uiManager.addUIBlock { (uiManager, viewRegistry) in
|
|
171
|
+
guard let ptrMapWidgetContainerView = uiManager?.view(forReactTag: reactTag) as? PTRMapWidgetContainerView else {
|
|
172
|
+
print("Cannot find PTRMapWidgetContainerView with tag #\(reactTag)")
|
|
173
|
+
return
|
|
174
|
+
}
|
|
175
|
+
|
|
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")
|
|
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)
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//
|
|
2
|
+
// PTRNativeLibrary-Bridging.m
|
|
3
|
+
//
|
|
4
|
+
// This file provides Objective-C wrappers for Swift classes to make them accessible from React Native
|
|
5
|
+
//
|
|
6
|
+
|
|
7
|
+
#import <React/RCTBridgeModule.h>
|
|
8
|
+
#import <React/RCTEventEmitter.h>
|
|
9
|
+
|
|
10
|
+
@interface RCT_EXTERN_MODULE(PTRNativePointrLibrary, RCTEventEmitter)
|
|
11
|
+
|
|
12
|
+
// Event emitter methods
|
|
13
|
+
RCT_EXTERN_METHOD(supportedEvents)
|
|
14
|
+
RCT_EXTERN_METHOD(startObserving)
|
|
15
|
+
RCT_EXTERN_METHOD(stopObserving)
|
|
16
|
+
|
|
17
|
+
// Core methods
|
|
18
|
+
RCT_EXTERN_METHOD(shouldRequestPermissionsAtStartup:(BOOL)shouldRequestPermissionsAtStartup)
|
|
19
|
+
|
|
20
|
+
RCT_EXTERN_METHOD(initialize:(NSString *)clientIdentifier licenseKey:(NSString *)licenseKey baseUrl:(NSString *)baseUrl logLevel:(int)logLevel)
|
|
21
|
+
|
|
22
|
+
RCT_EXTERN_METHOD(start:(RCTResponseSenderBlock)callback)
|
|
23
|
+
|
|
24
|
+
RCT_EXTERN_METHOD(stop)
|
|
25
|
+
|
|
26
|
+
RCT_EXTERN_METHOD(getCurrentLocation:(RCTResponseSenderBlock)callback)
|
|
27
|
+
|
|
28
|
+
RCT_EXTERN_METHOD(setPointrMapWidgetConfiguration:(NSString *)string)
|
|
29
|
+
|
|
30
|
+
RCT_EXTERN_METHOD(requestPermissions)
|
|
31
|
+
|
|
32
|
+
RCT_EXTERN_METHOD(isMyCarMarked:(RCTResponseSenderBlock)callback)
|
|
33
|
+
|
|
34
|
+
@end
|