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
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
package com.pointr
|
|
2
2
|
|
|
3
3
|
import android.annotation.SuppressLint
|
|
4
|
-
import android.os.Handler
|
|
5
|
-
import android.os.Looper.getMainLooper
|
|
6
4
|
import android.util.Log
|
|
7
5
|
import android.view.Choreographer
|
|
8
6
|
import android.view.View
|
|
@@ -15,36 +13,32 @@ import com.facebook.react.bridge.WritableNativeMap
|
|
|
15
13
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
16
14
|
import com.facebook.react.uimanager.ViewGroupManager
|
|
17
15
|
import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
18
|
-
import com.pointrlabs.core.configuration.MutableConfiguration
|
|
19
16
|
import com.pointrlabs.core.management.DataManager
|
|
20
17
|
import com.pointrlabs.core.management.Pointr
|
|
21
18
|
import com.pointrlabs.core.management.interfaces.PointrListener
|
|
22
19
|
import com.pointrlabs.core.management.models.ErrorMessage
|
|
20
|
+
import com.pointrlabs.core.management.models.PTRParams
|
|
23
21
|
import com.pointrlabs.core.management.models.Site
|
|
24
|
-
import com.pointrlabs.core.
|
|
25
|
-
import com.pointrlabs.core.
|
|
26
|
-
import com.pointrlabs.core.
|
|
27
|
-
import com.pointrlabs.core.
|
|
28
|
-
import com.pointrlabs.core.
|
|
29
|
-
import com.pointrlabs.core.
|
|
30
|
-
import com.pointrlabs.core.
|
|
31
|
-
import com.pointrlabs.core.
|
|
32
|
-
import com.pointrlabs.core.
|
|
33
|
-
import com.pointrlabs.core.map.models.events_listeners.MapEventsListener
|
|
34
|
-
import com.pointrlabs.core.map.models.events_listeners.MarkMyCarDetailsEvent
|
|
35
|
-
import com.pointrlabs.core.map.models.events_listeners.MarkMyCarDetailsEventsListener
|
|
36
|
-
import com.pointrlabs.core.map.models.events_listeners.PathFindingEventsListener
|
|
37
|
-
import com.pointrlabs.core.map.viewmodels.PTRMapWidgetConfiguration
|
|
38
|
-
import com.pointrlabs.core.map.views.PTRMapAnimationType
|
|
39
|
-
import com.pointrlabs.core.map.views.PTRMapFragment
|
|
40
|
-
import com.pointrlabs.core.map.views.PTRMapWidgetFragment
|
|
41
|
-
import com.pointrlabs.core.map.views.pathfinding.MarkMyCarBottomSheet
|
|
22
|
+
import com.pointrlabs.core.management.models.deeplink.PTRMapWidgetAction
|
|
23
|
+
import com.pointrlabs.core.management.models.deeplink.PTRMapWidgetBuildingLocation
|
|
24
|
+
import com.pointrlabs.core.management.models.deeplink.PTRMapWidgetFocusAction
|
|
25
|
+
import com.pointrlabs.core.management.models.deeplink.PTRMapWidgetLevelLocation
|
|
26
|
+
import com.pointrlabs.core.management.models.deeplink.PTRMapWidgetMarkMyCarAction
|
|
27
|
+
import com.pointrlabs.core.management.models.deeplink.PTRMapWidgetPoiLocation
|
|
28
|
+
import com.pointrlabs.core.management.models.deeplink.PTRMapWidgetShowMyCarAction
|
|
29
|
+
import com.pointrlabs.core.management.models.deeplink.PTRMapWidgetSiteLocation
|
|
30
|
+
import com.pointrlabs.core.management.models.deeplink.PTRMapWidgetWayfindingAction
|
|
42
31
|
import com.pointrlabs.core.nativecore.wrappers.Plog
|
|
43
|
-
import com.pointrlabs.core.pathfinding.PathManager
|
|
44
|
-
import com.pointrlabs.core.pathfinding.session.PathSession
|
|
45
|
-
import com.pointrlabs.core.pathfinding.session.PathSessionState
|
|
46
|
-
import com.pointrlabs.core.positioning.model.PositioningTypes
|
|
47
32
|
import com.pointrlabs.core.site.SiteManager
|
|
33
|
+
import com.pointrlabs.core.util.models.error.PTRError
|
|
34
|
+
import com.pointrlabs.core.wayfinding.WayfindingManager
|
|
35
|
+
import com.pointrlabs.ui.map.models.PTRMapSymbolLayer
|
|
36
|
+
import com.pointrlabs.ui.map.models.events_listeners.MapEventsListener
|
|
37
|
+
import com.pointrlabs.ui.map.models.events_listeners.MarkMyCarDetailsEvent
|
|
38
|
+
import com.pointrlabs.ui.map.models.events_listeners.MarkMyCarDetailsEventsListener
|
|
39
|
+
import com.pointrlabs.ui.map.views.PTRMapFragment
|
|
40
|
+
import com.pointrlabs.ui.map.views.PTRMapWidgetFragment
|
|
41
|
+
import com.pointrlabs.ui.map.views.wayfinding.MarkMyCarBottomSheet
|
|
48
42
|
import java.util.concurrent.Semaphore
|
|
49
43
|
|
|
50
44
|
|
|
@@ -54,36 +48,20 @@ class PTRMapWidgetManager(private val reactContext: ReactApplicationContext) :
|
|
|
54
48
|
|
|
55
49
|
override fun getName() = REACT_CLASS
|
|
56
50
|
|
|
57
|
-
private var markMyCarButtonSheet: MarkMyCarBottomSheet? = null
|
|
58
51
|
private lateinit var frameLayout: FrameLayout
|
|
59
52
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
private val ptrMapWidgetFragment: PTRMapWidgetFragment?
|
|
63
|
-
get() {
|
|
64
|
-
// TODO: Uncomment 1
|
|
65
|
-
// _ptrMapWidgetFragment?.let { return it }
|
|
66
|
-
Log.i("PTRMapWidgetManager", "Creating map widget fragment")
|
|
67
|
-
// TODO: Uncomment 1
|
|
68
|
-
//_ptrMapWidgetFragment = createMapWidgetFragment()
|
|
69
|
-
// TODO: Comment 1
|
|
70
|
-
val _ptrMapWidgetFragment = createMapWidgetFragment()
|
|
71
|
-
Choreographer.getInstance().postFrameCallback(frameCallback)
|
|
72
|
-
_ptrMapWidgetFragment?.addListener(this)
|
|
73
|
-
return _ptrMapWidgetFragment
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
private fun createMapWidgetFragment(): PTRMapWidgetFragment {
|
|
53
|
+
private fun getMapWidgetFragment(action: PTRMapWidgetAction): PTRMapWidgetFragment {
|
|
54
|
+
Log.i("PTRMapWidgetManager", "Creating map widget fragment with action: $action")
|
|
77
55
|
waitForPointrToRun()
|
|
78
|
-
|
|
79
|
-
val configuration = PointrMapWidgetActivity.mapWidgetConfiguration
|
|
80
|
-
configuration.isExitButtonShown = false
|
|
81
|
-
@Suppress("DEPRECATION")
|
|
82
|
-
val widget = PTRMapWidgetFragment.newInstance(configuration).show(
|
|
56
|
+
val ptrMapWidgetFragment = PTRMapWidgetFragment.newInstance(
|
|
83
57
|
(reactContext.currentActivity as FragmentActivity).supportFragmentManager,
|
|
84
|
-
frameLayout.id
|
|
58
|
+
frameLayout.id,
|
|
59
|
+
PointrModule.mapWidgetConfiguration,
|
|
60
|
+
action
|
|
85
61
|
)
|
|
86
|
-
|
|
62
|
+
Choreographer.getInstance().postFrameCallback(frameCallback)
|
|
63
|
+
ptrMapWidgetFragment.addListener(this)
|
|
64
|
+
return ptrMapWidgetFragment
|
|
87
65
|
}
|
|
88
66
|
|
|
89
67
|
/**
|
|
@@ -102,182 +80,167 @@ class PTRMapWidgetManager(private val reactContext: ReactApplicationContext) :
|
|
|
102
80
|
) {
|
|
103
81
|
super.receiveCommand(root, command, args)
|
|
104
82
|
val args1 = args ?: return
|
|
105
|
-
|
|
106
|
-
Log.e(
|
|
107
|
-
"PTRMapWidgetManager",
|
|
108
|
-
"PTRMapWidgetFragment is null"
|
|
109
|
-
)
|
|
110
|
-
return
|
|
111
|
-
}
|
|
112
|
-
// TODO: Uncomment 1
|
|
113
|
-
// clearPath(ptrMapWidgetFragment)
|
|
114
|
-
// dismissMarkMyCarDetails(ptrMapWidgetFragment)
|
|
115
|
-
executeCommand(ptrMapWidgetFragment, command, args1)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
private fun dismissMarkMyCarDetails(ptrMapWidgetFragment: PTRMapWidgetFragment) {
|
|
119
|
-
val markMyCarButtonSheet = markMyCarButtonSheet ?: return
|
|
120
|
-
val handler = ptrMapWidgetFragment.markMyCarEventsHandler
|
|
121
|
-
?: return Plog.w("Mark my car events handler is null")
|
|
122
|
-
Plog.i("Dismissing mark my car details")
|
|
123
|
-
handler.onMarkMyCarDetailsEvent(markMyCarButtonSheet, MarkMyCarDetailsEvent.Cancel)
|
|
124
|
-
handler.onMarkMyCarDetailsEvent(markMyCarButtonSheet, MarkMyCarDetailsEvent.Close)
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
private fun clearPath(ptrMapWidgetFragment: PTRMapWidgetFragment) {
|
|
128
|
-
ptrMapWidgetFragment.mapFragment?.removeAllFeatures { isSuccess, message ->
|
|
129
|
-
if (!isSuccess) {
|
|
130
|
-
Log.e(
|
|
131
|
-
"PTRMapWidgetManager",
|
|
132
|
-
"Error removing features: $message"
|
|
133
|
-
)
|
|
134
|
-
}
|
|
135
|
-
ptrMapWidgetFragment.mapFragment?.removeLayer(LAYER_STATIC_PATH) { b, e ->
|
|
136
|
-
if (!b) {
|
|
137
|
-
Log.e(
|
|
138
|
-
"PTRMapWidgetManager",
|
|
139
|
-
"Error removing layer: $e"
|
|
140
|
-
)
|
|
141
|
-
}
|
|
142
|
-
ptrMapWidgetFragment.mapFragment?.currentPath = null
|
|
143
|
-
ptrMapWidgetFragment.mapFragment?.currentPathSession?.abort()
|
|
144
|
-
}
|
|
145
|
-
}
|
|
83
|
+
executeCommand(command, args1)
|
|
146
84
|
}
|
|
147
85
|
|
|
148
86
|
private fun executeCommand(
|
|
149
|
-
ptrMapWidgetFragment: PTRMapWidgetFragment,
|
|
150
87
|
command: String,
|
|
151
|
-
|
|
88
|
+
args: ReadableArray
|
|
152
89
|
) {
|
|
153
|
-
when (command) {
|
|
154
|
-
PTRMapWidgetCommandType.SITE ->
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
)
|
|
90
|
+
val action: PTRMapWidgetAction = when (command) {
|
|
91
|
+
PTRMapWidgetCommandType.SITE -> {
|
|
92
|
+
val siteId = args.getString(0).orEmpty()
|
|
93
|
+
val location = PTRMapWidgetSiteLocation(siteId, isExternalIdentifier = true)
|
|
94
|
+
PTRMapWidgetFocusAction(location)
|
|
95
|
+
}
|
|
160
96
|
|
|
161
|
-
PTRMapWidgetCommandType.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
97
|
+
PTRMapWidgetCommandType.BUILDING -> {
|
|
98
|
+
val siteId = args.getString(0).orEmpty()
|
|
99
|
+
val buildingId = args.getString(1).orEmpty()
|
|
100
|
+
val location =
|
|
101
|
+
PTRMapWidgetBuildingLocation(siteId, buildingId, isExternalIdentifier = true)
|
|
102
|
+
PTRMapWidgetFocusAction(location)
|
|
103
|
+
}
|
|
167
104
|
|
|
168
|
-
PTRMapWidgetCommandType.
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
105
|
+
PTRMapWidgetCommandType.LEVEL -> {
|
|
106
|
+
val siteId = args.getString(0).orEmpty()
|
|
107
|
+
val buildingId = args.getString(1).orEmpty()
|
|
108
|
+
val location = PTRMapWidgetLevelLocation(
|
|
109
|
+
siteId,
|
|
110
|
+
buildingId,
|
|
111
|
+
args.getInt(2),
|
|
112
|
+
isExternalIdentifier = true
|
|
113
|
+
)
|
|
114
|
+
PTRMapWidgetFocusAction(location)
|
|
115
|
+
}
|
|
173
116
|
|
|
174
|
-
PTRMapWidgetCommandType.
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
117
|
+
PTRMapWidgetCommandType.POI -> {
|
|
118
|
+
val siteId = args.getString(0).orEmpty()
|
|
119
|
+
val poiId = args.getString(1).orEmpty()
|
|
120
|
+
val location = PTRMapWidgetPoiLocation(siteId, poiId, isExternalIdentifier = true)
|
|
121
|
+
PTRMapWidgetFocusAction(location)
|
|
122
|
+
}
|
|
179
123
|
|
|
180
|
-
PTRMapWidgetCommandType.
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
124
|
+
PTRMapWidgetCommandType.PATH -> {
|
|
125
|
+
val siteId = args.getString(0).orEmpty()
|
|
126
|
+
val poiId = args.getString(1).orEmpty()
|
|
127
|
+
val location = PTRMapWidgetPoiLocation(siteId, poiId, isExternalIdentifier = true)
|
|
128
|
+
PTRMapWidgetWayfindingAction(location)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
PTRMapWidgetCommandType.STATIC_PATH -> {
|
|
132
|
+
val siteId = args.getString(0).orEmpty()
|
|
133
|
+
val fromPoiId = args.getString(1).orEmpty()
|
|
134
|
+
val toPoiId = args.getString(2).orEmpty()
|
|
135
|
+
val location =
|
|
136
|
+
PTRMapWidgetPoiLocation(siteId, fromPoiId, isExternalIdentifier = true)
|
|
137
|
+
val action1 = PTRMapWidgetFocusAction(location)
|
|
138
|
+
val ptrMapWidgetFragment = getMapWidgetFragment(action1)
|
|
139
|
+
action1.onComplete = onComplete@{ error ->
|
|
140
|
+
if (error != null) {
|
|
141
|
+
mapWidgetDidEndLoading(
|
|
142
|
+
command,
|
|
143
|
+
*args.toArrayList().mapNotNull { it }.toTypedArray(),
|
|
144
|
+
error
|
|
145
|
+
)
|
|
146
|
+
return@onComplete
|
|
147
|
+
}
|
|
148
|
+
Plog.i("Focus action completed, showing static path")
|
|
149
|
+
|
|
150
|
+
showStaticPath(
|
|
151
|
+
ptrMapWidgetFragment,
|
|
152
|
+
siteId,
|
|
153
|
+
fromPoiId,
|
|
154
|
+
toPoiId
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
return
|
|
158
|
+
}
|
|
186
159
|
|
|
187
160
|
PTRMapWidgetCommandType.MARK_MY_CAR_SITE -> {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
shouldShowPopup = args1.getBoolean(1),
|
|
192
|
-
animationType = args1.getInt(2)
|
|
193
|
-
)
|
|
161
|
+
val siteId = args.getString(0).orEmpty()
|
|
162
|
+
val location = PTRMapWidgetSiteLocation(siteId, isExternalIdentifier = true)
|
|
163
|
+
PTRMapWidgetMarkMyCarAction(location, shouldShowPopup = args.getBoolean(1))
|
|
194
164
|
}
|
|
195
165
|
|
|
196
166
|
PTRMapWidgetCommandType.MARK_MY_CAR_LEVEL -> {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
args1.getInt(4)
|
|
167
|
+
val siteId = args.getString(0).orEmpty()
|
|
168
|
+
val location = PTRMapWidgetLevelLocation(
|
|
169
|
+
siteId,
|
|
170
|
+
args.getString(1).orEmpty(),
|
|
171
|
+
args.getInt(2),
|
|
172
|
+
isExternalIdentifier = true
|
|
204
173
|
)
|
|
174
|
+
PTRMapWidgetMarkMyCarAction(location, shouldShowPopup = args.getBoolean(3))
|
|
205
175
|
}
|
|
206
176
|
|
|
207
|
-
PTRMapWidgetCommandType.
|
|
208
|
-
|
|
177
|
+
PTRMapWidgetCommandType.SHOW_MY_CAR_SITE -> {
|
|
178
|
+
val siteId = args.getString(0).orEmpty()
|
|
179
|
+
val location = PTRMapWidgetSiteLocation(siteId, isExternalIdentifier = true)
|
|
180
|
+
PTRMapWidgetShowMyCarAction(location, shouldShowPopup = args.getBoolean(1))
|
|
209
181
|
}
|
|
210
182
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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
|
|
214
197
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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)
|
|
235
230
|
}
|
|
236
|
-
Plog.i("Mark my car details is shown")
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
231
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
shouldShowPopup: Boolean,
|
|
246
|
-
animationType: Int
|
|
247
|
-
) {
|
|
232
|
+
else -> return
|
|
233
|
+
}
|
|
234
|
+
action.onComplete = { error ->
|
|
235
|
+
val list = args.toArrayList()
|
|
236
|
+
list.add(error ?: "")
|
|
248
237
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
PTRMapAnimationType.entries[animationType],
|
|
254
|
-
shouldShowPopup
|
|
255
|
-
) onComplete@{ error ->
|
|
256
|
-
if (buildingExternalIdentifier == null || levelIndex == null || levelIndex == PositioningTypes.INVALID_INTEGER) {
|
|
257
|
-
this@PTRMapWidgetManager.mapWidgetDidEndLoading(
|
|
258
|
-
PTRMapWidgetCommandType.MARK_MY_CAR_LEVEL,
|
|
259
|
-
siteExternalIdentifier,
|
|
260
|
-
buildingExternalIdentifier ?: "",
|
|
261
|
-
levelIndex ?: PositioningTypes.INVALID_INTEGER,
|
|
262
|
-
shouldShowPopup,
|
|
263
|
-
animationType,
|
|
264
|
-
error ?: ""
|
|
265
|
-
)
|
|
266
|
-
} else {
|
|
267
|
-
this@PTRMapWidgetManager.mapWidgetDidEndLoading(
|
|
268
|
-
PTRMapWidgetCommandType.MARK_MY_CAR_SITE,
|
|
269
|
-
siteExternalIdentifier,
|
|
270
|
-
shouldShowPopup,
|
|
271
|
-
animationType,
|
|
272
|
-
error ?: ""
|
|
273
|
-
)
|
|
274
|
-
}
|
|
275
|
-
error?.let {
|
|
276
|
-
Plog.e("Error showing mark my car details: $it")
|
|
277
|
-
return@onComplete
|
|
278
|
-
}
|
|
279
|
-
Plog.i("Mark my car details is shown")
|
|
238
|
+
mapWidgetDidEndLoading(
|
|
239
|
+
command,
|
|
240
|
+
*list.mapNotNull { it }.toTypedArray(),
|
|
241
|
+
)
|
|
280
242
|
}
|
|
243
|
+
getMapWidgetFragment(action)
|
|
281
244
|
}
|
|
282
245
|
|
|
283
246
|
private fun mapWidgetDidEndLoading(
|
|
@@ -301,7 +264,7 @@ class PTRMapWidgetManager(private val reactContext: ReactApplicationContext) :
|
|
|
301
264
|
PTRMapWidgetCommandType.LEVEL -> {
|
|
302
265
|
event.putString("siteExternalIdentifier", args[0] as String)
|
|
303
266
|
event.putString("buildingExternalIdentifier", args[1] as String)
|
|
304
|
-
event.putInt("levelIndex", args[2] as
|
|
267
|
+
event.putInt("levelIndex", (args[2] as Number).toInt())
|
|
305
268
|
event.putString("error", args[3] as String)
|
|
306
269
|
}
|
|
307
270
|
|
|
@@ -324,6 +287,66 @@ class PTRMapWidgetManager(private val reactContext: ReactApplicationContext) :
|
|
|
324
287
|
event.putString("error", args[3] as String)
|
|
325
288
|
}
|
|
326
289
|
|
|
290
|
+
PTRMapWidgetCommandType.MARK_MY_CAR_SITE -> {
|
|
291
|
+
event.putString("siteExternalIdentifier", args[0] as String)
|
|
292
|
+
event.putBoolean("shouldShowPopup", args[1] as Boolean)
|
|
293
|
+
event.putInt("animationType", (args[2] as Number).toInt())
|
|
294
|
+
event.putString("error", args[3] as String)
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
PTRMapWidgetCommandType.MARK_MY_CAR_LEVEL -> {
|
|
298
|
+
event.putString("siteExternalIdentifier", args[0] as String)
|
|
299
|
+
event.putString("buildingExternalIdentifier", args[1] as String)
|
|
300
|
+
event.putInt("levelIndex", (args[2] as Number).toInt())
|
|
301
|
+
event.putBoolean("shouldShowPopup", args[3] as Boolean)
|
|
302
|
+
event.putInt("animationType", (args[4] as Number).toInt())
|
|
303
|
+
event.putString("error", args[5] as String)
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
PTRMapWidgetCommandType.SHOW_MY_CAR_SITE -> {
|
|
307
|
+
event.putString("siteExternalIdentifier", args[0] as String)
|
|
308
|
+
event.putBoolean("shouldShowPopup", args[1] as Boolean)
|
|
309
|
+
event.putInt("animationType", (args[2] as Number).toInt())
|
|
310
|
+
event.putString("error", args[3] as String)
|
|
311
|
+
}
|
|
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
|
+
|
|
327
350
|
else -> {
|
|
328
351
|
return
|
|
329
352
|
}
|
|
@@ -404,7 +427,7 @@ class PTRMapWidgetManager(private val reactContext: ReactApplicationContext) :
|
|
|
404
427
|
)
|
|
405
428
|
return
|
|
406
429
|
}
|
|
407
|
-
val
|
|
430
|
+
val wayfindingManager = Pointr.getPointr()?.wayfindingManager ?: run {
|
|
408
431
|
mapWidgetDidEndLoading(
|
|
409
432
|
PTRMapWidgetCommandType.STATIC_PATH,
|
|
410
433
|
site,
|
|
@@ -414,7 +437,7 @@ class PTRMapWidgetManager(private val reactContext: ReactApplicationContext) :
|
|
|
414
437
|
)
|
|
415
438
|
return
|
|
416
439
|
}
|
|
417
|
-
val
|
|
440
|
+
val route = wayfindingManager.calculateRoute(source, listOf(target)) ?: run {
|
|
418
441
|
mapWidgetDidEndLoading(
|
|
419
442
|
PTRMapWidgetCommandType.STATIC_PATH,
|
|
420
443
|
site,
|
|
@@ -424,217 +447,66 @@ class PTRMapWidgetManager(private val reactContext: ReactApplicationContext) :
|
|
|
424
447
|
)
|
|
425
448
|
return
|
|
426
449
|
}
|
|
427
|
-
val
|
|
428
|
-
|
|
450
|
+
val layer = PTRMapSymbolLayer(
|
|
451
|
+
LAYER_STATIC_PATH
|
|
452
|
+
)
|
|
453
|
+
ptrMapWidgetFragment.mapFragment?.addLayer(layer) { isSuccess, message ->
|
|
454
|
+
if (!isSuccess) {
|
|
429
455
|
mapWidgetDidEndLoading(
|
|
430
456
|
PTRMapWidgetCommandType.STATIC_PATH,
|
|
431
457
|
site,
|
|
432
458
|
fromPoi,
|
|
433
459
|
toPoi,
|
|
434
|
-
"
|
|
460
|
+
"Failed to add static path layer: $message"
|
|
435
461
|
)
|
|
436
|
-
|
|
437
|
-
return@let
|
|
462
|
+
return@addLayer
|
|
438
463
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
source
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
toPoi,
|
|
455
|
-
"Error adding layer: $e1"
|
|
456
|
-
)
|
|
457
|
-
Plog.e("Error adding layer: $e1")
|
|
458
|
-
return@addLayer
|
|
459
|
-
}
|
|
460
|
-
mapFragment.addFeatures(
|
|
461
|
-
listOf(source, target), layer.identifier
|
|
462
|
-
) { b2, e2 ->
|
|
463
|
-
if (!b2) {
|
|
464
|
-
mapWidgetDidEndLoading(
|
|
465
|
-
PTRMapWidgetCommandType.STATIC_PATH,
|
|
466
|
-
site,
|
|
467
|
-
fromPoi,
|
|
468
|
-
toPoi,
|
|
469
|
-
"Error adding features: $e2"
|
|
470
|
-
)
|
|
471
|
-
Plog.e("Error adding features: $e2")
|
|
472
|
-
return@addFeatures
|
|
473
|
-
}
|
|
474
|
-
mapFragment.currentPath = path
|
|
475
|
-
mapWidgetDidEndLoading(
|
|
476
|
-
PTRMapWidgetCommandType.STATIC_PATH,
|
|
477
|
-
site,
|
|
478
|
-
fromPoi,
|
|
479
|
-
toPoi,
|
|
480
|
-
""
|
|
481
|
-
)
|
|
482
|
-
Plog.i("Path shown")
|
|
483
|
-
}
|
|
464
|
+
Log.i("PTRMapWidgetManager", "Static path layer added successfully")
|
|
465
|
+
|
|
466
|
+
ptrMapWidgetFragment.mapFragment?.addFeatures(
|
|
467
|
+
listOf(source, target),
|
|
468
|
+
LAYER_STATIC_PATH
|
|
469
|
+
) { isSuccess1, message1 ->
|
|
470
|
+
if (!isSuccess1) {
|
|
471
|
+
mapWidgetDidEndLoading(
|
|
472
|
+
PTRMapWidgetCommandType.STATIC_PATH,
|
|
473
|
+
site,
|
|
474
|
+
fromPoi,
|
|
475
|
+
toPoi,
|
|
476
|
+
"Failed to add POI features: $message1"
|
|
477
|
+
)
|
|
478
|
+
return@addFeatures
|
|
484
479
|
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
source.level?.let {
|
|
488
|
-
ptrMapWidgetFragment.showLevel(it, onComplete = onCompleted)
|
|
489
|
-
} ?: ptrMapWidgetFragment.showSite(
|
|
490
|
-
source.location.site?.internalIdentifier ?: 0, onComplete = onCompleted
|
|
491
|
-
)
|
|
492
|
-
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
private fun showPath(ptrMapWidgetFragment: PTRMapWidgetFragment, site: String, toPoi: String) {
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
val siteObject = getSite(site) ?: run {
|
|
499
|
-
mapWidgetDidEndLoading(
|
|
500
|
-
PTRMapWidgetCommandType.PATH,
|
|
501
|
-
site,
|
|
502
|
-
toPoi,
|
|
503
|
-
"Site not found"
|
|
504
|
-
)
|
|
505
|
-
return
|
|
506
|
-
}
|
|
507
|
-
if (!waitForSiteData(siteObject)) {
|
|
508
|
-
mapWidgetDidEndLoading(
|
|
509
|
-
PTRMapWidgetCommandType.PATH,
|
|
510
|
-
site,
|
|
511
|
-
toPoi,
|
|
512
|
-
"Site data not found"
|
|
513
|
-
)
|
|
514
|
-
return
|
|
515
|
-
}
|
|
516
|
-
val target =
|
|
517
|
-
Pointr.getPointr()?.poiManager?.getPoiByExternalIdentifier(siteObject, toPoi) ?: run {
|
|
480
|
+
Log.i("PTRMapWidgetManager", "POI features added successfully")
|
|
481
|
+
ptrMapWidgetFragment.mapFragment?.currentRoute = route
|
|
518
482
|
mapWidgetDidEndLoading(
|
|
519
|
-
PTRMapWidgetCommandType.
|
|
483
|
+
PTRMapWidgetCommandType.STATIC_PATH,
|
|
520
484
|
site,
|
|
485
|
+
fromPoi,
|
|
521
486
|
toPoi,
|
|
522
|
-
"
|
|
487
|
+
""
|
|
523
488
|
)
|
|
524
|
-
return
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
val action = PTRDeepLinkPathfindingAction(
|
|
528
|
-
PTRDeepLinkPoiLocation(
|
|
529
|
-
siteObject.internalIdentifier,
|
|
530
|
-
target.id
|
|
531
|
-
)
|
|
532
|
-
)
|
|
533
|
-
ptrMapWidgetFragment.performDeepLinkAction(action) { error ->
|
|
534
|
-
this@PTRMapWidgetManager.mapWidgetDidEndLoading(
|
|
535
|
-
PTRMapWidgetCommandType.PATH,
|
|
536
|
-
site,
|
|
537
|
-
toPoi,
|
|
538
|
-
error ?: ""
|
|
539
|
-
)
|
|
540
|
-
error?.let {
|
|
541
|
-
Plog.e("Error showing path: $it")
|
|
542
|
-
return@performDeepLinkAction
|
|
543
|
-
}
|
|
544
|
-
Plog.i("Path shown")
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
private fun showPoi(ptrMapWidgetFragment: PTRMapWidgetFragment, site: String, poi: String) {
|
|
549
|
-
ptrMapWidgetFragment.showPoiDetails(site, poi) { error ->
|
|
550
|
-
this@PTRMapWidgetManager.mapWidgetDidEndLoading(
|
|
551
|
-
PTRMapWidgetCommandType.POI,
|
|
552
|
-
site,
|
|
553
|
-
poi,
|
|
554
|
-
error ?: ""
|
|
555
|
-
)
|
|
556
|
-
error?.let {
|
|
557
|
-
Plog.e("Error showing poi: $it")
|
|
558
|
-
return@showPoiDetails
|
|
559
|
-
}
|
|
560
|
-
Plog.i("Poi shown")
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
private fun showLevel(
|
|
565
|
-
ptrMapWidgetFragment: PTRMapWidgetFragment,
|
|
566
|
-
site: String,
|
|
567
|
-
building: String,
|
|
568
|
-
level: Int
|
|
569
|
-
) {
|
|
570
|
-
ptrMapWidgetFragment.showLevel(site, building, level) showLevelInternal@{ error ->
|
|
571
|
-
this@PTRMapWidgetManager.mapWidgetDidEndLoading(
|
|
572
|
-
PTRMapWidgetCommandType.LEVEL,
|
|
573
|
-
site,
|
|
574
|
-
building,
|
|
575
|
-
level,
|
|
576
|
-
error ?: ""
|
|
577
|
-
)
|
|
578
|
-
error?.let {
|
|
579
|
-
Plog.e("Error showing level: $it")
|
|
580
|
-
return@showLevelInternal
|
|
581
|
-
}
|
|
582
|
-
Plog.i("Level shown")
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
private fun showBuilding(
|
|
587
|
-
ptrMapWidgetFragment: PTRMapWidgetFragment,
|
|
588
|
-
site: String,
|
|
589
|
-
building: String
|
|
590
|
-
) {
|
|
591
|
-
ptrMapWidgetFragment.showBuilding(site, building) showBuildingInternal@{ error ->
|
|
592
|
-
this@PTRMapWidgetManager.mapWidgetDidEndLoading(
|
|
593
|
-
PTRMapWidgetCommandType.BUILDING,
|
|
594
|
-
site,
|
|
595
|
-
building,
|
|
596
|
-
error ?: ""
|
|
597
|
-
)
|
|
598
|
-
error?.let {
|
|
599
|
-
Plog.e("Error showing building: $it")
|
|
600
|
-
return@showBuildingInternal
|
|
601
|
-
}
|
|
602
|
-
Plog.i("Building shown")
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
private fun showSite(ptrMapWidgetFragment: PTRMapWidgetFragment, site: String) {
|
|
607
|
-
ptrMapWidgetFragment.showSite(site) showSiteInternal@{ error ->
|
|
608
|
-
this@PTRMapWidgetManager.mapWidgetDidEndLoading(
|
|
609
|
-
PTRMapWidgetCommandType.SITE,
|
|
610
|
-
site,
|
|
611
|
-
error ?: ""
|
|
612
|
-
)
|
|
613
|
-
error?.let {
|
|
614
|
-
Plog.e("Error showing site: $it")
|
|
615
|
-
return@showSiteInternal
|
|
616
489
|
}
|
|
617
|
-
Plog.i("Site shown")
|
|
618
490
|
}
|
|
619
491
|
}
|
|
620
492
|
|
|
621
493
|
// region Show path
|
|
622
494
|
|
|
623
495
|
private fun waitForPathManager(theSite: Site): Boolean {
|
|
624
|
-
val
|
|
496
|
+
val wayfindingManager = Pointr.getPointr()?.wayfindingManager ?: return false
|
|
625
497
|
val semaphore = Semaphore(0)
|
|
626
|
-
val listener = object :
|
|
627
|
-
override fun
|
|
498
|
+
val listener = object : WayfindingManager.Listener {
|
|
499
|
+
override fun onWayfindingManagerReadyForSite(site: Site) {
|
|
628
500
|
if (site != theSite) return
|
|
629
501
|
semaphore.release()
|
|
630
502
|
}
|
|
631
503
|
}
|
|
632
|
-
|
|
633
|
-
if (!
|
|
504
|
+
wayfindingManager.addListener(listener)
|
|
505
|
+
if (!wayfindingManager.isReadyForSite(theSite)) {
|
|
634
506
|
semaphore.tryAcquire(15, java.util.concurrent.TimeUnit.SECONDS)
|
|
635
507
|
}
|
|
636
|
-
|
|
637
|
-
return
|
|
508
|
+
wayfindingManager.removeListener(listener)
|
|
509
|
+
return wayfindingManager.isReadyForSite(theSite)
|
|
638
510
|
}
|
|
639
511
|
|
|
640
512
|
private fun waitForSiteData(theSite: Site): Boolean {
|
|
@@ -661,7 +533,7 @@ class PTRMapWidgetManager(private val reactContext: ReactApplicationContext) :
|
|
|
661
533
|
return Pointr.getPointr()?.poiManager?.hasContentForSite(theSite) == true
|
|
662
534
|
}
|
|
663
535
|
|
|
664
|
-
private fun getSite(
|
|
536
|
+
private fun getSite(siteExternalId: String): Site? {
|
|
665
537
|
val siteManager = Pointr.getPointr()?.siteManager ?: return null
|
|
666
538
|
val semaphore = Semaphore(0)
|
|
667
539
|
val listener = object : SiteManager.Listener {
|
|
@@ -670,11 +542,11 @@ class PTRMapWidgetManager(private val reactContext: ReactApplicationContext) :
|
|
|
670
542
|
}
|
|
671
543
|
}
|
|
672
544
|
siteManager.addListener(listener)
|
|
673
|
-
if (siteManager.
|
|
545
|
+
if (siteManager.sites.isEmpty()) {
|
|
674
546
|
semaphore.tryAcquire(10, java.util.concurrent.TimeUnit.SECONDS)
|
|
675
547
|
}
|
|
676
548
|
siteManager.removeListener(listener)
|
|
677
|
-
return siteManager.
|
|
549
|
+
return siteManager.getSiteByExternalIdentifier(siteExternalId)
|
|
678
550
|
}
|
|
679
551
|
|
|
680
552
|
// endregion
|
|
@@ -748,7 +620,6 @@ class PTRMapWidgetManager(private val reactContext: ReactApplicationContext) :
|
|
|
748
620
|
markMyCarDetailsEvent: MarkMyCarDetailsEvent
|
|
749
621
|
) {
|
|
750
622
|
super.onMarkMyCarDetailsEvent(markMyCarSheet, markMyCarDetailsEvent)
|
|
751
|
-
this.markMyCarButtonSheet = markMyCarSheet
|
|
752
623
|
Plog.i("Mark my car details event: $markMyCarDetailsEvent")
|
|
753
624
|
}
|
|
754
625
|
|