react-native-pointr 8.14.3 → 8.15.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/CHANGELOG.md +9 -0
- package/android/.settings/org.eclipse.buildship.core.prefs +2 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/pointr/PTRMapWidgetCommandType.kt +3 -0
- package/android/src/main/java/com/pointr/PTRMapWidgetManager.kt +179 -7
- package/android/src/main/java/com/pointr/PointrModule.kt +10 -1
- package/ios/PTRMapWidgetContainerView.h +2 -2
- package/ios/PTRMapWidgetContainerView.m +26 -28
- package/ios/PTRMapWidgetManager.m +92 -1
- package/ios/PTRNativeLibrary.m +9 -0
- package/ios/PointrApp.swift +32 -38
- package/package.json +1 -1
- package/react-native-pointr.podspec +1 -1
- package/src/PTRCommand.ts +41 -1
- package/src/PTRMapWidgetUtils.ts +28 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [8.15.0]
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
- Added `PTRMyCarSiteCommand`, `PTRMarkMyCarSiteCommand` and `PTRMarkMyCarLevelCommand` commands to show map widget component.
|
|
11
|
+
- Added `isMyCarMarked` API to `PTRNaPTRNativePointrLibrary`.
|
|
12
|
+
|
|
13
|
+
### Updates
|
|
14
|
+
- Mobile SDK 8.15.0 integration.
|
|
15
|
+
|
|
7
16
|
## [8.14.1]
|
|
8
17
|
|
|
9
18
|
### Added
|
package/android/build.gradle
CHANGED
|
@@ -95,7 +95,7 @@ dependencies {
|
|
|
95
95
|
//noinspection GradleDynamicVersion
|
|
96
96
|
implementation "com.facebook.react:react-native:+"
|
|
97
97
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
98
|
-
implementation "com.pointrlabs:pointr:8
|
|
98
|
+
implementation "com.pointrlabs:pointr:8.15.0"
|
|
99
99
|
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
|
100
100
|
implementation 'androidx.appcompat:appcompat:1.7.0'
|
|
101
101
|
implementation 'com.google.android.material:material:1.12.0'
|
|
@@ -13,5 +13,8 @@ annotation class PTRMapWidgetCommandType {
|
|
|
13
13
|
const val POI = "poi"
|
|
14
14
|
const val PATH = "path"
|
|
15
15
|
const val STATIC_PATH = "staticPath"
|
|
16
|
+
const val MARK_MY_CAR_LEVEL = "markMyCarForLevel"
|
|
17
|
+
const val MARK_MY_CAR_SITE = "markMyCarForSite"
|
|
18
|
+
const val MY_CAR_SITE = "myCarForSite"
|
|
16
19
|
}
|
|
17
20
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
package com.pointr
|
|
2
2
|
|
|
3
3
|
import android.annotation.SuppressLint
|
|
4
|
+
import android.os.Handler
|
|
5
|
+
import android.os.Looper.getMainLooper
|
|
4
6
|
import android.util.Log
|
|
5
7
|
import android.view.Choreographer
|
|
6
8
|
import android.view.View
|
|
@@ -13,19 +15,34 @@ import com.facebook.react.bridge.WritableNativeMap
|
|
|
13
15
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
14
16
|
import com.facebook.react.uimanager.ViewGroupManager
|
|
15
17
|
import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
18
|
+
import com.pointrlabs.core.configuration.MutableConfiguration
|
|
16
19
|
import com.pointrlabs.core.management.DataManager
|
|
17
20
|
import com.pointrlabs.core.management.Pointr
|
|
18
21
|
import com.pointrlabs.core.management.interfaces.PointrListener
|
|
19
22
|
import com.pointrlabs.core.management.models.ErrorMessage
|
|
20
23
|
import com.pointrlabs.core.management.models.Site
|
|
24
|
+
import com.pointrlabs.core.map.handlers.MapWidgetEventsHandler
|
|
25
|
+
import com.pointrlabs.core.map.handlers.PathFindingEventsHandler
|
|
26
|
+
import com.pointrlabs.core.map.handlers.PathUpdatesEventHandler
|
|
27
|
+
import com.pointrlabs.core.map.models.PTRDeepLinkAction
|
|
28
|
+
import com.pointrlabs.core.map.models.PTRDeepLinkLocation
|
|
29
|
+
import com.pointrlabs.core.map.models.PTRDeepLinkPathfindingAction
|
|
30
|
+
import com.pointrlabs.core.map.models.PTRDeepLinkPoiLocation
|
|
21
31
|
import com.pointrlabs.core.map.models.PTRError
|
|
22
32
|
import com.pointrlabs.core.map.models.PTRMapSymbolLayer
|
|
23
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
|
|
24
37
|
import com.pointrlabs.core.map.viewmodels.PTRMapWidgetConfiguration
|
|
38
|
+
import com.pointrlabs.core.map.views.PTRMapAnimationType
|
|
25
39
|
import com.pointrlabs.core.map.views.PTRMapFragment
|
|
26
40
|
import com.pointrlabs.core.map.views.PTRMapWidgetFragment
|
|
41
|
+
import com.pointrlabs.core.map.views.pathfinding.MarkMyCarBottomSheet
|
|
27
42
|
import com.pointrlabs.core.nativecore.wrappers.Plog
|
|
28
43
|
import com.pointrlabs.core.pathfinding.PathManager
|
|
44
|
+
import com.pointrlabs.core.pathfinding.session.PathSession
|
|
45
|
+
import com.pointrlabs.core.pathfinding.session.PathSessionState
|
|
29
46
|
import com.pointrlabs.core.positioning.model.PositioningTypes
|
|
30
47
|
import com.pointrlabs.core.site.SiteManager
|
|
31
48
|
import java.util.concurrent.Semaphore
|
|
@@ -33,18 +50,24 @@ import java.util.concurrent.Semaphore
|
|
|
33
50
|
|
|
34
51
|
@SuppressLint("LogNotTimber")
|
|
35
52
|
class PTRMapWidgetManager(private val reactContext: ReactApplicationContext) :
|
|
36
|
-
ViewGroupManager<FrameLayout>(), MapEventsListener {
|
|
53
|
+
ViewGroupManager<FrameLayout>(), MapEventsListener, MarkMyCarDetailsEventsListener {
|
|
37
54
|
|
|
38
55
|
override fun getName() = REACT_CLASS
|
|
39
56
|
|
|
57
|
+
private var markMyCarButtonSheet: MarkMyCarBottomSheet? = null
|
|
40
58
|
private lateinit var frameLayout: FrameLayout
|
|
41
59
|
|
|
42
|
-
|
|
60
|
+
// TODO: Uncomment 1
|
|
61
|
+
// private var _ptrMapWidgetFragment: PTRMapWidgetFragment? = null
|
|
43
62
|
private val ptrMapWidgetFragment: PTRMapWidgetFragment?
|
|
44
63
|
get() {
|
|
45
|
-
|
|
64
|
+
// TODO: Uncomment 1
|
|
65
|
+
// _ptrMapWidgetFragment?.let { return it }
|
|
46
66
|
Log.i("PTRMapWidgetManager", "Creating map widget fragment")
|
|
47
|
-
|
|
67
|
+
// TODO: Uncomment 1
|
|
68
|
+
//_ptrMapWidgetFragment = createMapWidgetFragment()
|
|
69
|
+
// TODO: Comment 1
|
|
70
|
+
val _ptrMapWidgetFragment = createMapWidgetFragment()
|
|
48
71
|
Choreographer.getInstance().postFrameCallback(frameCallback)
|
|
49
72
|
_ptrMapWidgetFragment?.addListener(this)
|
|
50
73
|
return _ptrMapWidgetFragment
|
|
@@ -86,10 +109,21 @@ class PTRMapWidgetManager(private val reactContext: ReactApplicationContext) :
|
|
|
86
109
|
)
|
|
87
110
|
return
|
|
88
111
|
}
|
|
89
|
-
|
|
112
|
+
// TODO: Uncomment 1
|
|
113
|
+
// clearPath(ptrMapWidgetFragment)
|
|
114
|
+
// dismissMarkMyCarDetails(ptrMapWidgetFragment)
|
|
90
115
|
executeCommand(ptrMapWidgetFragment, command, args1)
|
|
91
116
|
}
|
|
92
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
|
+
|
|
93
127
|
private fun clearPath(ptrMapWidgetFragment: PTRMapWidgetFragment) {
|
|
94
128
|
ptrMapWidgetFragment.mapFragment?.removeAllFeatures { isSuccess, message ->
|
|
95
129
|
if (!isSuccess) {
|
|
@@ -150,10 +184,102 @@ class PTRMapWidgetManager(private val reactContext: ReactApplicationContext) :
|
|
|
150
184
|
args1.getString(2)
|
|
151
185
|
)
|
|
152
186
|
|
|
187
|
+
PTRMapWidgetCommandType.MARK_MY_CAR_SITE -> {
|
|
188
|
+
showMarkMyCarDetails(
|
|
189
|
+
ptrMapWidgetFragment,
|
|
190
|
+
args1.getString(0),
|
|
191
|
+
shouldShowPopup = args1.getBoolean(1),
|
|
192
|
+
animationType = args1.getInt(2)
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
PTRMapWidgetCommandType.MARK_MY_CAR_LEVEL -> {
|
|
197
|
+
showMarkMyCarDetails(
|
|
198
|
+
ptrMapWidgetFragment,
|
|
199
|
+
args1.getString(0),
|
|
200
|
+
args1.getString(1),
|
|
201
|
+
args1.getInt(2),
|
|
202
|
+
args1.getBoolean(3),
|
|
203
|
+
args1.getInt(4)
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
PTRMapWidgetCommandType.MY_CAR_SITE -> {
|
|
208
|
+
showMyCarDetails(ptrMapWidgetFragment, args1.getString(0), args1.getInt(1))
|
|
209
|
+
}
|
|
210
|
+
|
|
153
211
|
else -> return
|
|
154
212
|
}
|
|
155
213
|
}
|
|
156
214
|
|
|
215
|
+
private fun showMyCarDetails(
|
|
216
|
+
ptrMapWidgetFragment: PTRMapWidgetFragment,
|
|
217
|
+
siteExternalIdentifier: String,
|
|
218
|
+
animationTypeOrdinal: Int
|
|
219
|
+
) {
|
|
220
|
+
val animationType = PTRMapAnimationType.entries[animationTypeOrdinal]
|
|
221
|
+
ptrMapWidgetFragment.showMyCarDetails(
|
|
222
|
+
siteExternalIdentifier,
|
|
223
|
+
shouldShowDialog = false,
|
|
224
|
+
animationType = animationType
|
|
225
|
+
) onComplete@{ error ->
|
|
226
|
+
this@PTRMapWidgetManager.mapWidgetDidEndLoading(
|
|
227
|
+
PTRMapWidgetCommandType.MY_CAR_SITE,
|
|
228
|
+
siteExternalIdentifier,
|
|
229
|
+
animationType,
|
|
230
|
+
error ?: ""
|
|
231
|
+
)
|
|
232
|
+
error?.let {
|
|
233
|
+
Plog.e("Error showing mark my car details: $it")
|
|
234
|
+
return@onComplete
|
|
235
|
+
}
|
|
236
|
+
Plog.i("Mark my car details is shown")
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
private fun showMarkMyCarDetails(
|
|
241
|
+
ptrMapWidgetFragment: PTRMapWidgetFragment,
|
|
242
|
+
siteExternalIdentifier: String,
|
|
243
|
+
buildingExternalIdentifier: String? = null,
|
|
244
|
+
levelIndex: Int? = null,
|
|
245
|
+
shouldShowPopup: Boolean,
|
|
246
|
+
animationType: Int
|
|
247
|
+
) {
|
|
248
|
+
|
|
249
|
+
ptrMapWidgetFragment.showMarkMyCarDetails(
|
|
250
|
+
siteExternalIdentifier,
|
|
251
|
+
buildingExternalIdentifier,
|
|
252
|
+
levelIndex,
|
|
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")
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
157
283
|
private fun mapWidgetDidEndLoading(
|
|
158
284
|
@PTRMapWidgetCommandType command: String,
|
|
159
285
|
vararg args: Any
|
|
@@ -367,7 +493,44 @@ class PTRMapWidgetManager(private val reactContext: ReactApplicationContext) :
|
|
|
367
493
|
}
|
|
368
494
|
|
|
369
495
|
private fun showPath(ptrMapWidgetFragment: PTRMapWidgetFragment, site: String, toPoi: String) {
|
|
370
|
-
|
|
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 {
|
|
518
|
+
mapWidgetDidEndLoading(
|
|
519
|
+
PTRMapWidgetCommandType.PATH,
|
|
520
|
+
site,
|
|
521
|
+
toPoi,
|
|
522
|
+
"Target POI not found"
|
|
523
|
+
)
|
|
524
|
+
return
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
val action = PTRDeepLinkPathfindingAction(
|
|
528
|
+
PTRDeepLinkPoiLocation(
|
|
529
|
+
siteObject.internalIdentifier,
|
|
530
|
+
target.id
|
|
531
|
+
)
|
|
532
|
+
)
|
|
533
|
+
ptrMapWidgetFragment.performDeepLinkAction(action) { error ->
|
|
371
534
|
this@PTRMapWidgetManager.mapWidgetDidEndLoading(
|
|
372
535
|
PTRMapWidgetCommandType.PATH,
|
|
373
536
|
site,
|
|
@@ -376,7 +539,7 @@ class PTRMapWidgetManager(private val reactContext: ReactApplicationContext) :
|
|
|
376
539
|
)
|
|
377
540
|
error?.let {
|
|
378
541
|
Plog.e("Error showing path: $it")
|
|
379
|
-
return@
|
|
542
|
+
return@performDeepLinkAction
|
|
380
543
|
}
|
|
381
544
|
Plog.i("Path shown")
|
|
382
545
|
}
|
|
@@ -580,6 +743,15 @@ class PTRMapWidgetManager(private val reactContext: ReactApplicationContext) :
|
|
|
580
743
|
Log.e("PTRMapWidgetManager", "Map failed to load: $ptrError")
|
|
581
744
|
}
|
|
582
745
|
|
|
746
|
+
override fun onMarkMyCarDetailsEvent(
|
|
747
|
+
markMyCarSheet: MarkMyCarBottomSheet,
|
|
748
|
+
markMyCarDetailsEvent: MarkMyCarDetailsEvent
|
|
749
|
+
) {
|
|
750
|
+
super.onMarkMyCarDetailsEvent(markMyCarSheet, markMyCarDetailsEvent)
|
|
751
|
+
this.markMyCarButtonSheet = markMyCarSheet
|
|
752
|
+
Plog.i("Mark my car details event: $markMyCarDetailsEvent")
|
|
753
|
+
}
|
|
754
|
+
|
|
583
755
|
private val frameCallback = object : Choreographer.FrameCallback {
|
|
584
756
|
override fun doFrame(frameTimeNanos: Long) {
|
|
585
757
|
frameLayout.measure(
|
|
@@ -154,6 +154,14 @@ class PointrModule(reactContext: ReactApplicationContext) :
|
|
|
154
154
|
Pointr.getPointr()?.stop()
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
@ReactMethod
|
|
158
|
+
fun isMyCarMarked(callback: Callback) {
|
|
159
|
+
val pointr = Pointr.getPointr() ?: return callback.invoke("Pointr is not initialized")
|
|
160
|
+
if (pointr.state != Pointr.State.RUNNING) return callback.invoke("Pointr is not running")
|
|
161
|
+
if (pointr.myCarFeature == null) return callback.invoke("No saved location")
|
|
162
|
+
callback.invoke(null)
|
|
163
|
+
}
|
|
164
|
+
|
|
157
165
|
@ReactMethod
|
|
158
166
|
fun getCurrentLocation(callback: Callback) {
|
|
159
167
|
val pointr = Pointr.getPointr() ?: return callback.invoke(null)
|
|
@@ -410,7 +418,8 @@ class PointrModule(reactContext: ReactApplicationContext) :
|
|
|
410
418
|
// we need to keep the activity to show the dialog
|
|
411
419
|
val activity = mapFragment.activity ?: return
|
|
412
420
|
val ptrMapWidgetFragment = mapFragment.parentFragment ?: return
|
|
413
|
-
ptrMapWidgetFragment.parentFragmentManager.beginTransaction()
|
|
421
|
+
ptrMapWidgetFragment.parentFragmentManager.beginTransaction()
|
|
422
|
+
.remove(ptrMapWidgetFragment).commit()
|
|
414
423
|
val ptrDialogModel = PTRDialog.PtrDialogModel(
|
|
415
424
|
iconDrawableResId = com.pointrlabs.core.R.drawable.error_generic,
|
|
416
425
|
bigTextString = activity.getString(com.pointrlabs.core.R.string.ptr_error_title_map_loading_generic_error),
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
#import <React/RCTComponent.h>
|
|
2
2
|
#import <PointrKit/PointrKit.h>
|
|
3
|
-
#import "react_native_pointr-Swift.h"
|
|
4
3
|
|
|
5
4
|
extern NSString * const kLayerStaticPath;
|
|
6
5
|
|
|
7
|
-
@interface PTRMapWidgetContainerView: UIView<PTRConfigurationManagerDelegate,
|
|
6
|
+
@interface PTRMapWidgetContainerView: UIView<PTRConfigurationManagerDelegate, PTRSiteManagerDelegate, PTRDataManagerDelegate, PTRPathManagerDelegate>
|
|
8
7
|
|
|
9
8
|
@property (nonatomic, copy) RCTBubblingEventBlock onMapWidgetDidEndLoading;
|
|
10
9
|
@property(readonly, atomic, strong) PTRMapWidgetViewController *mapWidget;
|
|
@@ -14,6 +13,7 @@ extern NSString * const kLayerStaticPath;
|
|
|
14
13
|
|
|
15
14
|
- (void)ptrMapWidgetDidEndLoadingWithParameters:(NSDictionary *)parameters;
|
|
16
15
|
-(PTRMapWidgetViewController *) getMapWidget;
|
|
16
|
+
-(void) present:(PTRMapWidgetViewController *) mapWidget;
|
|
17
17
|
-(void) showStaticPath:(NSString *) siteExternalIdentifier fromPoiExternalIdentifier:(NSString *) fromPoiExternalIdentifier toPoiExternalIdentifier:(NSString *) toPoiExternalIdentifier;
|
|
18
18
|
|
|
19
19
|
@end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#import "PTRMapWidgetContainerView.h"
|
|
2
|
+
#import "react_native_pointr-Swift.h"
|
|
2
3
|
|
|
3
4
|
NSString * const kLayerStaticPath = @"static-path";
|
|
4
5
|
|
|
@@ -10,31 +11,29 @@ NSString * const kLayerStaticPath = @"static-path";
|
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
-(PTRMapWidgetViewController *) getMapWidget {
|
|
14
|
-
if (self
|
|
15
|
-
self
|
|
16
|
-
|
|
17
|
-
[self.mapWidget.mapViewController removeLayerWithLayerIdentifier: kLayerStaticPath];
|
|
18
|
-
return self.mapWidget;
|
|
19
|
-
}
|
|
20
|
-
if ([self waitForPointrState] != PointrStateRunning) {
|
|
14
|
+
-(nonnull PTRMapWidgetViewController *) getMapWidget {
|
|
15
|
+
if ([self waitForPointrState] == PointrStateRunning) {
|
|
16
|
+
[self waitForConfiguration];
|
|
17
|
+
} else {
|
|
21
18
|
NSLog(@"Pointr is not running");
|
|
22
19
|
}
|
|
23
|
-
[self waitForConfiguration];
|
|
24
20
|
NSLog(@"initializing map widget");
|
|
25
21
|
PTRMapWidgetConfiguration *config = [PointrApp.sharedApp getMapWidgetConfiguration];
|
|
26
22
|
PTRMapwidgetExitButtonConfiguration *exitButtonConfiguration = [[PTRMapwidgetExitButtonConfiguration alloc] initWithPreferredPosition:PTRMapwidgetExitButtonPositionTopRight visibility:PTRMapwidgetExitButtonVisibilityNotVisible];
|
|
27
23
|
config.exitButtonConfiguration = exitButtonConfiguration;
|
|
28
24
|
_mapWidget = [[PTRMapWidgetViewController alloc] initWithConfiguration:config];
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
return self.mapWidget;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
-(void) present:(PTRMapWidgetViewController *) mapWidget {
|
|
29
|
+
[self addSubview: mapWidget.view];
|
|
30
|
+
mapWidget.view.translatesAutoresizingMaskIntoConstraints = NO;
|
|
31
31
|
[NSLayoutConstraint activateConstraints:@[
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
-
[
|
|
35
|
-
[
|
|
32
|
+
[mapWidget.view.leadingAnchor constraintEqualToAnchor:self.leadingAnchor],
|
|
33
|
+
[mapWidget.view.trailingAnchor constraintEqualToAnchor:self.trailingAnchor],
|
|
34
|
+
[mapWidget.view.topAnchor constraintEqualToAnchor:self.topAnchor],
|
|
35
|
+
[mapWidget.view.bottomAnchor constraintEqualToAnchor:self.bottomAnchor],
|
|
36
36
|
]];
|
|
37
|
-
return self.mapWidget;
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
-(void) showStaticPath:(NSString *) siteExternalIdentifier fromPoiExternalIdentifier:(NSString *) fromPoiExternalIdentifier toPoiExternalIdentifier:(NSString *) toPoiExternalIdentifier {
|
|
@@ -112,6 +111,7 @@ NSString * const kLayerStaticPath = @"static-path";
|
|
|
112
111
|
NSLog(@"ready");
|
|
113
112
|
}];
|
|
114
113
|
}
|
|
114
|
+
[self present: mapWidget];
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
|
|
@@ -264,20 +264,18 @@ NSString * const kLayerStaticPath = @"static-path";
|
|
|
264
264
|
|
|
265
265
|
- (PointrState) waitForPointrState {
|
|
266
266
|
NSLog(@"waiting for pointr to run");
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
if (state != PointrStateRunning && state > PointrStateOff) {
|
|
271
|
-
dispatch_semaphore_wait(self.semaphore, DISPATCH_TIME_FOREVER);
|
|
267
|
+
PointrState state1 = [Pointr shared].state;
|
|
268
|
+
if (state1 == PointrStateRunning || state1 < PointrStateOff) {
|
|
269
|
+
return [Pointr shared].state;
|
|
272
270
|
}
|
|
273
|
-
|
|
271
|
+
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
|
272
|
+
[[Pointr shared] startWithParams:PointrApp.params onStateChanged:^(PointrState state) {
|
|
273
|
+
if (state == PointrStateRunning || state < PointrStateOff) {
|
|
274
|
+
dispatch_semaphore_signal(semaphore);
|
|
275
|
+
}
|
|
276
|
+
}];
|
|
277
|
+
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
|
|
274
278
|
return [Pointr shared].state;
|
|
275
279
|
}
|
|
276
280
|
|
|
277
|
-
- (void)pointrStateDidChangeTo:(PointrState)state {
|
|
278
|
-
if (state == PointrStateRunning || state <= PointrStateOff) {
|
|
279
|
-
dispatch_semaphore_signal(self.semaphore);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
281
|
@end
|
|
@@ -42,6 +42,7 @@ RCT_EXPORT_METHOD(site:(nonnull NSNumber*) reactTag siteExternalIdentifier:(NSSt
|
|
|
42
42
|
}
|
|
43
43
|
NSLog(@"ready");
|
|
44
44
|
}];
|
|
45
|
+
[ptrMapWidgetContainerView present:mapWidget];
|
|
45
46
|
});
|
|
46
47
|
}];
|
|
47
48
|
}
|
|
@@ -67,7 +68,8 @@ RCT_EXPORT_METHOD(building:(nonnull NSNumber*) reactTag siteExternalIdentifier:(
|
|
|
67
68
|
};
|
|
68
69
|
[ptrMapWidgetContainerView ptrMapWidgetDidEndLoadingWithParameters: ptrCommand];
|
|
69
70
|
}];
|
|
70
|
-
|
|
71
|
+
[ptrMapWidgetContainerView present:mapWidget];
|
|
72
|
+
});
|
|
71
73
|
}];
|
|
72
74
|
}
|
|
73
75
|
|
|
@@ -93,6 +95,7 @@ RCT_EXPORT_METHOD(level:(nonnull NSNumber*) reactTag siteExternalIdentifier:(NSS
|
|
|
93
95
|
};
|
|
94
96
|
[ptrMapWidgetContainerView ptrMapWidgetDidEndLoadingWithParameters: ptrCommand];
|
|
95
97
|
}];
|
|
98
|
+
[ptrMapWidgetContainerView present:mapWidget];
|
|
96
99
|
});
|
|
97
100
|
}];
|
|
98
101
|
}
|
|
@@ -118,6 +121,7 @@ RCT_EXPORT_METHOD(poi:(nonnull NSNumber*) reactTag siteExternalIdentifier:(NSStr
|
|
|
118
121
|
};
|
|
119
122
|
[ptrMapWidgetContainerView ptrMapWidgetDidEndLoadingWithParameters: ptrCommand];
|
|
120
123
|
}];
|
|
124
|
+
[ptrMapWidgetContainerView present:mapWidget];
|
|
121
125
|
});
|
|
122
126
|
}];
|
|
123
127
|
}
|
|
@@ -143,6 +147,7 @@ RCT_EXPORT_METHOD(path:(nonnull NSNumber*) reactTag siteExternalIdentifier:(NSSt
|
|
|
143
147
|
};
|
|
144
148
|
[ptrMapWidgetContainerView ptrMapWidgetDidEndLoadingWithParameters: ptrCommand];
|
|
145
149
|
}];
|
|
150
|
+
[ptrMapWidgetContainerView present:mapWidget];
|
|
146
151
|
});
|
|
147
152
|
}];
|
|
148
153
|
}
|
|
@@ -162,4 +167,90 @@ RCT_EXPORT_METHOD(staticPath:(nonnull NSNumber*) reactTag siteExternalIdentifier
|
|
|
162
167
|
}];
|
|
163
168
|
}
|
|
164
169
|
|
|
170
|
+
RCT_EXPORT_METHOD(markMyCarForLevel:(nonnull NSNumber*) reactTag siteExternalIdentifier:(nonnull NSString*) siteExternalIdentifier buildingExternalIdentifier:(nonnull NSString*) buildingExternalIdentifier levelIndex:(NSInteger) levelIndex shouldShowPopup:(BOOL) shouldShowPopup animationType:(NSInteger) animationType) {
|
|
171
|
+
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
172
|
+
UIView *view = viewRegistry[reactTag];
|
|
173
|
+
if (!view || ![view isKindOfClass:[PTRMapWidgetContainerView class]]) {
|
|
174
|
+
RCTLogError(@"Cannot find PTRMapWidgetContainerView with tag #%@", reactTag);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
NSLog(@"found PTRMapWidgetContainerView");
|
|
178
|
+
PTRMapWidgetContainerView *ptrMapWidgetContainerView = (PTRMapWidgetContainerView *)view;
|
|
179
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
180
|
+
PTRMapWidgetViewController *mapWidget = [ptrMapWidgetContainerView getMapWidget];
|
|
181
|
+
NSLog(@"calling show mark my car method of mapWidget");
|
|
182
|
+
if (levelIndex == [PTRPositioningTypes invalidInteger]) {
|
|
183
|
+
NSLog(@"Level index cannot be invalid");
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
[mapWidget showMarkMyCarDetailsWithSiteExternalIdentifier:siteExternalIdentifier buildingExternalIdentifier:buildingExternalIdentifier levelIndex:levelIndex showPopup:shouldShowPopup animationType:(PTRMapAnimationType)animationType completion:^(PTRMapWidgetError * _Nullable error) {
|
|
187
|
+
NSDictionary *ptrCommand = @{
|
|
188
|
+
@"command": @"markMyCarForLevel",
|
|
189
|
+
@"siteExternalIdentifier": siteExternalIdentifier,
|
|
190
|
+
@"buildingExternalIdentifier": buildingExternalIdentifier,
|
|
191
|
+
@"levelIndex": [NSNumber numberWithInteger: levelIndex],
|
|
192
|
+
@"shouldShowPopup": @(shouldShowPopup),
|
|
193
|
+
@"animationType": @(animationType),
|
|
194
|
+
@"error": error ? error.errorCode : @""
|
|
195
|
+
};
|
|
196
|
+
[ptrMapWidgetContainerView ptrMapWidgetDidEndLoadingWithParameters: ptrCommand];
|
|
197
|
+
}];
|
|
198
|
+
[ptrMapWidgetContainerView present:mapWidget];
|
|
199
|
+
});
|
|
200
|
+
}];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
RCT_EXPORT_METHOD(markMyCarForSite:(nonnull NSNumber*) reactTag siteExternalIdentifier:(nonnull NSString*) siteExternalIdentifier shouldShowPopup:(BOOL) shouldShowPopup animationType:(NSInteger) animationType) {
|
|
204
|
+
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
205
|
+
UIView *view = viewRegistry[reactTag];
|
|
206
|
+
if (!view || ![view isKindOfClass:[PTRMapWidgetContainerView class]]) {
|
|
207
|
+
RCTLogError(@"Cannot find PTRMapWidgetContainerView with tag #%@", reactTag);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
NSLog(@"found PTRMapWidgetContainerView");
|
|
211
|
+
PTRMapWidgetContainerView *ptrMapWidgetContainerView = (PTRMapWidgetContainerView *)view;
|
|
212
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
213
|
+
PTRMapWidgetViewController *mapWidget = [ptrMapWidgetContainerView getMapWidget];
|
|
214
|
+
NSLog(@"calling show mark my car method of mapWidget");
|
|
215
|
+
[mapWidget showMarkMyCarDetailsWithSiteExternalIdentifier:siteExternalIdentifier showPopup:shouldShowPopup animationType: (PTRMapAnimationType) animationType completion:^(PTRMapWidgetError * _Nullable error) {
|
|
216
|
+
NSDictionary *ptrCommand = @{
|
|
217
|
+
@"command": @"markMyCarForSite",
|
|
218
|
+
@"siteExternalIdentifier": siteExternalIdentifier,
|
|
219
|
+
@"shouldShowPopup": @(shouldShowPopup),
|
|
220
|
+
@"animationType": @(animationType),
|
|
221
|
+
@"error": error ? error.errorCode : @""
|
|
222
|
+
};
|
|
223
|
+
[ptrMapWidgetContainerView ptrMapWidgetDidEndLoadingWithParameters: ptrCommand];
|
|
224
|
+
}];
|
|
225
|
+
[ptrMapWidgetContainerView present:mapWidget];
|
|
226
|
+
});
|
|
227
|
+
}];
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
RCT_EXPORT_METHOD(myCarForSite:(nonnull NSNumber*) reactTag siteExternalIdentifier:(nonnull NSString*) siteExternalIdentifier animationType:(NSInteger) animationType) {
|
|
231
|
+
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
232
|
+
UIView *view = viewRegistry[reactTag];
|
|
233
|
+
if (!view || ![view isKindOfClass:[PTRMapWidgetContainerView class]]) {
|
|
234
|
+
RCTLogError(@"Cannot find PTRMapWidgetContainerView with tag #%@", reactTag);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
NSLog(@"found PTRMapWidgetContainerView");
|
|
238
|
+
PTRMapWidgetContainerView *ptrMapWidgetContainerView = (PTRMapWidgetContainerView *)view;
|
|
239
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
240
|
+
PTRMapWidgetViewController *mapWidget = [ptrMapWidgetContainerView getMapWidget];
|
|
241
|
+
NSLog(@"calling show mark my car method of mapWidget");
|
|
242
|
+
[mapWidget showMyCarDetailsWithSiteExternalIdentifier: siteExternalIdentifier animationType: (PTRMapAnimationType) animationType completion:^(PTRMapWidgetError * _Nullable error) {
|
|
243
|
+
NSDictionary *ptrCommand = @{
|
|
244
|
+
@"command": @"myCarForSite",
|
|
245
|
+
@"siteExternalIdentifier": siteExternalIdentifier,
|
|
246
|
+
@"animationType": @(animationType),
|
|
247
|
+
@"error": error ? error.errorCode : @""
|
|
248
|
+
};
|
|
249
|
+
[ptrMapWidgetContainerView ptrMapWidgetDidEndLoadingWithParameters: ptrCommand];
|
|
250
|
+
}];
|
|
251
|
+
[ptrMapWidgetContainerView present:mapWidget];
|
|
252
|
+
});
|
|
253
|
+
}];
|
|
254
|
+
}
|
|
255
|
+
|
|
165
256
|
@end
|
package/ios/PTRNativeLibrary.m
CHANGED
|
@@ -129,6 +129,15 @@ RCT_EXPORT_METHOD(requestPermissions) {
|
|
|
129
129
|
[PointrApp.sharedApp requestPermissions];
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
RCT_EXPORT_METHOD(isMyCarMarked:(RCTResponseSenderBlock)callback) {
|
|
133
|
+
PTRFeature *feature = [Pointr.shared getMyCarFeature];
|
|
134
|
+
if (feature == nil) {
|
|
135
|
+
callback(@[@"No saved location"]);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
callback(@[]);
|
|
139
|
+
}
|
|
140
|
+
|
|
132
141
|
#pragma mark Event Manager Delegate
|
|
133
142
|
|
|
134
143
|
- (void)onPositionManagerCalculatedLocationWithLocation:(NSDictionary<NSString *,id> * _Nonnull)location {
|
package/ios/PointrApp.swift
CHANGED
|
@@ -23,11 +23,11 @@ import PointrKit
|
|
|
23
23
|
|
|
24
24
|
@objc public static var shouldRequestPermissionsAtStartup: Bool = true
|
|
25
25
|
|
|
26
|
-
let params = PTRParams()
|
|
26
|
+
@objc public static let params = PTRParams()
|
|
27
27
|
|
|
28
28
|
let dispatchGroup = DispatchGroup()
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var ptrMapWidget: PTRMapWidgetViewController? = nil
|
|
31
31
|
|
|
32
32
|
var configuration: Dictionary<String,Any>? = nil
|
|
33
33
|
|
|
@@ -81,14 +81,14 @@ import PointrKit
|
|
|
81
81
|
func initialize(licenseKey: String, baseUrl: String, clientIdentifier: String, environment: String = "prod", logLevel: Int = 4, rootViewController: UIViewController) {
|
|
82
82
|
Pointr.shared.permissionManager?.delegate = self
|
|
83
83
|
self.rootViewController = rootViewController
|
|
84
|
-
|
|
84
|
+
PointrApp.params.mode = PointrDebugMode()
|
|
85
85
|
// No need to set environment
|
|
86
|
-
|
|
86
|
+
PointrApp.params.loggerLevel = PTRLoggerLevel.init(rawValue: Int32(logLevel)) ?? .error
|
|
87
87
|
|
|
88
88
|
// Enter you license key
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
PointrApp.params.licenseKey = licenseKey
|
|
90
|
+
PointrApp.params.baseUrl = baseUrl
|
|
91
|
+
PointrApp.params.clientIdentifier = clientIdentifier
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
func getEnvironmentFromString(env: String) -> PTREnvironment {
|
|
@@ -156,16 +156,19 @@ import PointrKit
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
func start(completion: @escaping (String) -> Void) {
|
|
159
|
+
let dispatchGroup = DispatchGroup()
|
|
159
160
|
dispatchGroup.enter()
|
|
160
|
-
Pointr.shared.
|
|
161
|
-
|
|
161
|
+
Pointr.shared.start(with: PointrApp.params) { state in
|
|
162
|
+
if (state == .running || state.rawValue <= 0) {
|
|
163
|
+
dispatchGroup.leave()
|
|
164
|
+
}
|
|
165
|
+
}
|
|
162
166
|
dispatchGroup.wait()
|
|
163
|
-
|
|
164
167
|
if Pointr.shared.state == .running {
|
|
165
168
|
Pointr.shared.positionManager?.addListener(self)
|
|
166
169
|
}
|
|
167
170
|
|
|
168
|
-
completion(getPointrStateStringFromPointrState(state: Pointr.shared.state))
|
|
171
|
+
completion(PointrApp.getPointrStateStringFromPointrState(state: Pointr.shared.state))
|
|
169
172
|
}
|
|
170
173
|
|
|
171
174
|
func stop() {
|
|
@@ -188,7 +191,7 @@ import PointrKit
|
|
|
188
191
|
func showSite(siteExternalIdentifier id: String, animationType:Int, completion: @escaping (String?) -> Void) {
|
|
189
192
|
func showSiteWithCompletion(completion: @escaping (String?) -> Void) {
|
|
190
193
|
self.initializeMapWidget()
|
|
191
|
-
self.
|
|
194
|
+
self.ptrMapWidget!.showSite(siteExternalIdentifier: id, animationType: self.getAnimationTypeFromInt(value: animationType)) { error in
|
|
192
195
|
completion(self.getErrorStringFromMapWidgetError(error: error))
|
|
193
196
|
}
|
|
194
197
|
self.presentMapWidgetIfNotPresented()
|
|
@@ -210,7 +213,7 @@ import PointrKit
|
|
|
210
213
|
func showBuilding(siteExternalIdentifier: String, buildingExternalIdentifier: String, animationType:Int, completion: @escaping (String?) -> Void) {
|
|
211
214
|
func showBuildingWithCompletion(completion: @escaping (String?) -> Void) {
|
|
212
215
|
self.initializeMapWidget()
|
|
213
|
-
self.
|
|
216
|
+
self.ptrMapWidget!.showBuilding(siteExternalIdentifier: siteExternalIdentifier, buildingExternalIdentifier: buildingExternalIdentifier, animationType: self.getAnimationTypeFromInt(value: animationType)) { error in
|
|
214
217
|
completion(self.getErrorStringFromMapWidgetError(error: error))
|
|
215
218
|
}
|
|
216
219
|
self.presentMapWidgetIfNotPresented()
|
|
@@ -232,7 +235,7 @@ import PointrKit
|
|
|
232
235
|
func showLevel(siteExternalIdentifier: String, buildingExternalIdentifier: String, levelIndex: Int, animationType:Int, completion: @escaping (String?) -> Void) {
|
|
233
236
|
func showLevelWithCompletion(completion: @escaping (String?) -> Void) {
|
|
234
237
|
self.initializeMapWidget()
|
|
235
|
-
self.
|
|
238
|
+
self.ptrMapWidget!.showLevel(siteExternalIdentifier: siteExternalIdentifier, buildingExternalIdentifier: buildingExternalIdentifier, levelIndex: levelIndex, animationType: self.getAnimationTypeFromInt(value: animationType)) { error in
|
|
236
239
|
completion(self.getErrorStringFromMapWidgetError(error: error))
|
|
237
240
|
}
|
|
238
241
|
self.presentMapWidgetIfNotPresented()
|
|
@@ -254,7 +257,7 @@ import PointrKit
|
|
|
254
257
|
func showPoiDetails(siteExternalIdentifier id: String, poiExternalIdentifier: String, animationType:Int, completion: @escaping (String?) -> Void) {
|
|
255
258
|
func showPoiDetailsWithCompletion(completion: @escaping (String?) -> Void) {
|
|
256
259
|
self.initializeMapWidget()
|
|
257
|
-
self.
|
|
260
|
+
self.ptrMapWidget!.showPoiDetails(siteExternalIdentifier: id, poiExternalIdentifier: poiExternalIdentifier, animationType: self.getAnimationTypeFromInt(value: animationType)) { error in
|
|
258
261
|
completion(self.getErrorStringFromMapWidgetError(error: error))
|
|
259
262
|
}
|
|
260
263
|
self.presentMapWidgetIfNotPresented()
|
|
@@ -276,7 +279,7 @@ import PointrKit
|
|
|
276
279
|
func showPathFindingToPoi(siteExternalIdentifier id: String, poiExternalIdentifier: String, animationType:Int, completion: @escaping (String?) -> Void) {
|
|
277
280
|
func showPathFindingToPoiWithCompletion(completion: @escaping (String?) -> Void) {
|
|
278
281
|
self.initializeMapWidget()
|
|
279
|
-
self.
|
|
282
|
+
self.ptrMapWidget!.showPathFinding(siteExternalIdentifier: id, poiExternalIdentifier: poiExternalIdentifier, animationType: self.getAnimationTypeFromInt(value: animationType)) { error in
|
|
280
283
|
completion(self.getErrorStringFromMapWidgetError(error: error))
|
|
281
284
|
}
|
|
282
285
|
self.presentMapWidgetIfNotPresented()
|
|
@@ -347,16 +350,16 @@ import PointrKit
|
|
|
347
350
|
DispatchQueue.main.async {
|
|
348
351
|
self.initializeMapWidget()
|
|
349
352
|
self.presentMapWidgetIfNotPresented()
|
|
350
|
-
self.
|
|
353
|
+
self.ptrMapWidget!.showLevel(fromLevel, animationType: self.getAnimationTypeFromInt(value: animationType)) { error in
|
|
351
354
|
if let e = error {
|
|
352
355
|
completion(self.getErrorStringFromMapWidgetError(error: e))
|
|
353
356
|
return
|
|
354
357
|
}
|
|
355
358
|
let layer = PTRMapSymbolLayer(identifier: UUID().uuidString)
|
|
356
|
-
self.
|
|
357
|
-
self.
|
|
358
|
-
self.
|
|
359
|
-
self.
|
|
359
|
+
self.ptrMapWidget?.mapViewController.addLayer(layer)
|
|
360
|
+
self.ptrMapWidget?.mapViewController.addFeatures([to, from], toLayer: layer.identifier)
|
|
361
|
+
self.ptrMapWidget?.mapViewController.zoomToCoordinate(to.coordinate)
|
|
362
|
+
self.ptrMapWidget?.mapViewController.currentPath = path
|
|
360
363
|
completion(nil)
|
|
361
364
|
}
|
|
362
365
|
}
|
|
@@ -410,15 +413,15 @@ import PointrKit
|
|
|
410
413
|
}
|
|
411
414
|
|
|
412
415
|
func initializeMapWidget() {
|
|
413
|
-
if self.
|
|
416
|
+
if self.ptrMapWidget != nil { return }
|
|
414
417
|
waitForThemeManager()
|
|
415
|
-
self.
|
|
416
|
-
self.
|
|
417
|
-
self.
|
|
418
|
+
self.ptrMapWidget = PTRMapWidgetViewController(configuration: getMapWidgetConfiguration())
|
|
419
|
+
self.ptrMapWidget?.exitButton?.addListener(self)
|
|
420
|
+
self.ptrMapWidget?.mapViewController.addListener(self)
|
|
418
421
|
}
|
|
419
422
|
|
|
420
423
|
func presentMapWidgetIfNotPresented() {
|
|
421
|
-
guard let viewController =
|
|
424
|
+
guard let viewController = ptrMapWidget else {
|
|
422
425
|
return
|
|
423
426
|
}
|
|
424
427
|
if viewController.view.window != nil {
|
|
@@ -494,7 +497,7 @@ import PointrKit
|
|
|
494
497
|
}
|
|
495
498
|
}
|
|
496
499
|
|
|
497
|
-
func getPointrStateStringFromPointrState(state: PointrState) -> String {
|
|
500
|
+
@objc static func getPointrStateStringFromPointrState(state: PointrState) -> String {
|
|
498
501
|
switch state {
|
|
499
502
|
case .running:
|
|
500
503
|
return "running"
|
|
@@ -537,19 +540,10 @@ extension PointrApp: PTRPositionManagerDelegate {
|
|
|
537
540
|
}
|
|
538
541
|
}
|
|
539
542
|
|
|
540
|
-
extension PointrApp: PointrStateChangeListener {
|
|
541
|
-
public func pointrStateDidChange(to state: PointrState) {
|
|
542
|
-
if state.rawValue <= 0 || state == .running {
|
|
543
|
-
Pointr.shared.removeListener(self)
|
|
544
|
-
dispatchGroup.leave()
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
|
|
549
543
|
extension PointrApp: PTRExitButtonEventsListener {
|
|
550
544
|
public func exitButtonDidTap(_ exitbutton: PointrKit.PTRMapWidgetExitButton) {
|
|
551
|
-
self.
|
|
552
|
-
self.
|
|
545
|
+
self.ptrMapWidget?.view.removeFromSuperview()
|
|
546
|
+
self.ptrMapWidget = nil
|
|
553
547
|
}
|
|
554
548
|
}
|
|
555
549
|
|
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
|
|
19
|
+
s.dependency 'PointrKit', '8.15.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
|
@@ -7,7 +7,10 @@ export enum PTRCommandType {
|
|
|
7
7
|
LEVEL = "level",
|
|
8
8
|
POI = "poi",
|
|
9
9
|
PATH = "path",
|
|
10
|
-
STATIC_PATH = "staticPath"
|
|
10
|
+
STATIC_PATH = "staticPath",
|
|
11
|
+
MARK_MY_CAR_LEVEL = "markMyCarForLevel",
|
|
12
|
+
MARK_MY_CAR_SITE = "markMyCarForSite",
|
|
13
|
+
MY_CAR_SITE = "myCarForSite"
|
|
11
14
|
}
|
|
12
15
|
/**
|
|
13
16
|
* Base class for all Pointr SDK commands
|
|
@@ -76,4 +79,41 @@ export class PTRStaticPathCommand extends PTRCommand {
|
|
|
76
79
|
constructor(public site: string, public fromPoi: string, public toPoi: string) {
|
|
77
80
|
super(PTRCommandType.STATIC_PATH);
|
|
78
81
|
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Command to show mark my car details
|
|
86
|
+
* @param site - the site to show mark my car details
|
|
87
|
+
* @param building - the building to show mark my car details
|
|
88
|
+
* @param level - the level to show mark my car details
|
|
89
|
+
* @param shouldShowPopup - flag to show popup or not
|
|
90
|
+
* @param animationType - animation type to show map loading
|
|
91
|
+
*/
|
|
92
|
+
export class PTRMarkMyCarLevelCommand extends PTRCommand {
|
|
93
|
+
constructor(public site: string, public building: string, public level: number, public shouldShowPopup: boolean = true, public animationType: number = 1) {
|
|
94
|
+
super(PTRCommandType.MARK_MY_CAR_LEVEL);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Command to show mark my car details
|
|
100
|
+
* @param site - the site to show mark my car details
|
|
101
|
+
* @param shouldShowPopup - flag to show popup or not
|
|
102
|
+
* @param animationType - animation type to show map loading
|
|
103
|
+
*/
|
|
104
|
+
export class PTRMarkMyCarSiteCommand extends PTRCommand {
|
|
105
|
+
constructor(public site: string, public shouldShowPopup: boolean = true, public animationType: number = 1) {
|
|
106
|
+
super(PTRCommandType.MARK_MY_CAR_SITE);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Command to show my car details
|
|
112
|
+
* @param site - the site to show my car details
|
|
113
|
+
* @param animationType - animation type to show map loading
|
|
114
|
+
*/
|
|
115
|
+
export class PTRMyCarSiteCommand extends PTRCommand {
|
|
116
|
+
constructor(public site: string, public animationType: number = 1) {
|
|
117
|
+
super(PTRCommandType.MY_CAR_SITE);
|
|
118
|
+
}
|
|
79
119
|
}
|
package/src/PTRMapWidgetUtils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UIManager } from 'react-native';
|
|
2
|
-
import { PTRSiteCommand, PTRBuildingCommand, PTRLevelCommand, PTRPoiCommand, PTRPathCommand, PTRStaticPathCommand, PTRCommand, PTRCommandType } from 'react-native-pointr/src/PTRCommand';
|
|
2
|
+
import { PTRSiteCommand, PTRBuildingCommand, PTRLevelCommand, PTRPoiCommand, PTRPathCommand, PTRStaticPathCommand, PTRCommand, PTRCommandType, PTRMarkMyCarLevelCommand, PTRMarkMyCarSiteCommand, PTRMyCarSiteCommand } from 'react-native-pointr/src/PTRCommand';
|
|
3
3
|
/**
|
|
4
4
|
* Show the map widget with the given command
|
|
5
5
|
* @param reactTag view tag of the map widget
|
|
@@ -62,5 +62,32 @@ export const showMapWidget = (reactTag: number, ptrCommand: PTRCommand) => {
|
|
|
62
62
|
);
|
|
63
63
|
break;
|
|
64
64
|
}
|
|
65
|
+
case PTRCommandType.MARK_MY_CAR_LEVEL: {
|
|
66
|
+
const markMyCarCommand = ptrCommand as PTRMarkMyCarLevelCommand;
|
|
67
|
+
UIManager.dispatchViewManagerCommand(
|
|
68
|
+
reactTag,
|
|
69
|
+
ptrCommand.type,
|
|
70
|
+
[markMyCarCommand.site, markMyCarCommand.building, markMyCarCommand.level, markMyCarCommand.shouldShowPopup, markMyCarCommand.animationType],
|
|
71
|
+
);
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
case PTRCommandType.MARK_MY_CAR_SITE: {
|
|
75
|
+
const markMyCarCommand = ptrCommand as PTRMarkMyCarSiteCommand;
|
|
76
|
+
UIManager.dispatchViewManagerCommand(
|
|
77
|
+
reactTag,
|
|
78
|
+
ptrCommand.type,
|
|
79
|
+
[markMyCarCommand.site, markMyCarCommand.shouldShowPopup, markMyCarCommand.animationType],
|
|
80
|
+
);
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
case PTRCommandType.MY_CAR_SITE: {
|
|
84
|
+
const myCarCommand = ptrCommand as PTRMyCarSiteCommand;
|
|
85
|
+
UIManager.dispatchViewManagerCommand(
|
|
86
|
+
reactTag,
|
|
87
|
+
ptrCommand.type,
|
|
88
|
+
[myCarCommand.site, myCarCommand.animationType],
|
|
89
|
+
);
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
65
92
|
}
|
|
66
93
|
}
|