react-native-nitro-location-tracking 0.1.5 → 0.1.6
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/README.md +677 -7
- package/android/src/main/java/com/margelo/nitro/nitrolocationtracking/GeofenceManager.kt +148 -0
- package/android/src/main/java/com/margelo/nitro/nitrolocationtracking/LocationEngine.kt +55 -1
- package/android/src/main/java/com/margelo/nitro/nitrolocationtracking/NitroLocationTracking.kt +127 -0
- package/android/src/main/java/com/margelo/nitro/nitrolocationtracking/ProviderStatusMonitor.kt +73 -0
- package/android/src/main/java/com/margelo/nitro/nitrolocationtracking/SpeedMonitor.kt +38 -0
- package/android/src/main/java/com/margelo/nitro/nitrolocationtracking/TripCalculator.kt +85 -0
- package/ios/GeofenceManager.swift +69 -0
- package/ios/LocationEngine.swift +56 -2
- package/ios/NitroLocationTracking.swift +104 -0
- package/ios/SpeedMonitor.swift +48 -0
- package/ios/TripCalculator.swift +93 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NitroLocationTracking.nitro.d.ts +44 -0
- package/lib/typescript/src/NitroLocationTracking.nitro.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/test.d.ts +1 -0
- package/lib/typescript/test.d.ts.map +1 -0
- package/nitrogen/generated/android/c++/JFunc_void_GeofenceEvent_std__string.hpp +78 -0
- package/nitrogen/generated/android/c++/JFunc_void_LocationData.hpp +1 -0
- package/nitrogen/generated/android/c++/JFunc_void_LocationProviderStatus_LocationProviderStatus.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_SpeedAlertType_double.hpp +77 -0
- package/nitrogen/generated/android/c++/JGeofenceEvent.hpp +58 -0
- package/nitrogen/generated/android/c++/JGeofenceRegion.hpp +77 -0
- package/nitrogen/generated/android/c++/JHybridNitroLocationTrackingSpec.cpp +102 -0
- package/nitrogen/generated/android/c++/JHybridNitroLocationTrackingSpec.hpp +16 -0
- package/nitrogen/generated/android/c++/JLocationData.hpp +8 -4
- package/nitrogen/generated/android/c++/JLocationProviderStatus.hpp +58 -0
- package/nitrogen/generated/android/c++/JPermissionStatus.hpp +67 -0
- package/nitrogen/generated/android/c++/JSpeedAlertType.hpp +61 -0
- package/nitrogen/generated/android/c++/JSpeedConfig.hpp +65 -0
- package/nitrogen/generated/android/c++/JTripStats.hpp +73 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/Func_void_GeofenceEvent_std__string.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/Func_void_LocationProviderStatus_LocationProviderStatus.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/Func_void_SpeedAlertType_double.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/GeofenceEvent.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/GeofenceRegion.kt +53 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/HybridNitroLocationTrackingSpec.kt +79 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/LocationData.kt +6 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/LocationProviderStatus.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/PermissionStatus.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/SpeedAlertType.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/SpeedConfig.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/TripStats.kt +50 -0
- package/nitrogen/generated/android/nitrolocationtrackingOnLoad.cpp +6 -0
- package/nitrogen/generated/ios/NitroLocationTracking-Swift-Cxx-Bridge.cpp +24 -0
- package/nitrogen/generated/ios/NitroLocationTracking-Swift-Cxx-Bridge.hpp +124 -0
- package/nitrogen/generated/ios/NitroLocationTracking-Swift-Cxx-Umbrella.hpp +22 -0
- package/nitrogen/generated/ios/c++/HybridNitroLocationTrackingSpecSwift.hpp +130 -0
- package/nitrogen/generated/ios/swift/Func_void_GeofenceEvent_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_LocationProviderStatus_LocationProviderStatus.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_SpeedAlertType_double.swift +46 -0
- package/nitrogen/generated/ios/swift/GeofenceEvent.swift +40 -0
- package/nitrogen/generated/ios/swift/GeofenceRegion.swift +54 -0
- package/nitrogen/generated/ios/swift/HybridNitroLocationTrackingSpec.swift +16 -0
- package/nitrogen/generated/ios/swift/HybridNitroLocationTrackingSpec_cxx.swift +197 -0
- package/nitrogen/generated/ios/swift/LocationData.swift +20 -2
- package/nitrogen/generated/ios/swift/LocationProviderStatus.swift +40 -0
- package/nitrogen/generated/ios/swift/PermissionStatus.swift +52 -0
- package/nitrogen/generated/ios/swift/SpeedAlertType.swift +44 -0
- package/nitrogen/generated/ios/swift/SpeedConfig.swift +39 -0
- package/nitrogen/generated/ios/swift/TripStats.swift +49 -0
- package/nitrogen/generated/shared/c++/GeofenceEvent.hpp +76 -0
- package/nitrogen/generated/shared/c++/GeofenceRegion.hpp +103 -0
- package/nitrogen/generated/shared/c++/HybridNitroLocationTrackingSpec.cpp +16 -0
- package/nitrogen/generated/shared/c++/HybridNitroLocationTrackingSpec.hpp +37 -0
- package/nitrogen/generated/shared/c++/LocationData.hpp +7 -3
- package/nitrogen/generated/shared/c++/LocationProviderStatus.hpp +76 -0
- package/nitrogen/generated/shared/c++/PermissionStatus.hpp +88 -0
- package/nitrogen/generated/shared/c++/SpeedAlertType.hpp +80 -0
- package/nitrogen/generated/shared/c++/SpeedConfig.hpp +91 -0
- package/nitrogen/generated/shared/c++/TripStats.hpp +99 -0
- package/package.json +2 -2
- package/src/NitroLocationTracking.nitro.ts +71 -0
- package/src/index.tsx +10 -0
|
@@ -327,6 +327,203 @@ open class HybridNitroLocationTrackingSpec_cxx {
|
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
+
@inline(__always)
|
|
331
|
+
public final func isFakeGpsEnabled() -> bridge.Result_bool_ {
|
|
332
|
+
do {
|
|
333
|
+
let __result = try self.__implementation.isFakeGpsEnabled()
|
|
334
|
+
let __resultCpp = __result
|
|
335
|
+
return bridge.create_Result_bool_(__resultCpp)
|
|
336
|
+
} catch (let __error) {
|
|
337
|
+
let __exceptionPtr = __error.toCpp()
|
|
338
|
+
return bridge.create_Result_bool_(__exceptionPtr)
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
@inline(__always)
|
|
343
|
+
public final func setRejectMockLocations(reject: Bool) -> bridge.Result_void_ {
|
|
344
|
+
do {
|
|
345
|
+
try self.__implementation.setRejectMockLocations(reject: reject)
|
|
346
|
+
return bridge.create_Result_void_()
|
|
347
|
+
} catch (let __error) {
|
|
348
|
+
let __exceptionPtr = __error.toCpp()
|
|
349
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
@inline(__always)
|
|
354
|
+
public final func addGeofence(region: GeofenceRegion) -> bridge.Result_void_ {
|
|
355
|
+
do {
|
|
356
|
+
try self.__implementation.addGeofence(region: region)
|
|
357
|
+
return bridge.create_Result_void_()
|
|
358
|
+
} catch (let __error) {
|
|
359
|
+
let __exceptionPtr = __error.toCpp()
|
|
360
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
@inline(__always)
|
|
365
|
+
public final func removeGeofence(regionId: std.string) -> bridge.Result_void_ {
|
|
366
|
+
do {
|
|
367
|
+
try self.__implementation.removeGeofence(regionId: String(regionId))
|
|
368
|
+
return bridge.create_Result_void_()
|
|
369
|
+
} catch (let __error) {
|
|
370
|
+
let __exceptionPtr = __error.toCpp()
|
|
371
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
@inline(__always)
|
|
376
|
+
public final func removeAllGeofences() -> bridge.Result_void_ {
|
|
377
|
+
do {
|
|
378
|
+
try self.__implementation.removeAllGeofences()
|
|
379
|
+
return bridge.create_Result_void_()
|
|
380
|
+
} catch (let __error) {
|
|
381
|
+
let __exceptionPtr = __error.toCpp()
|
|
382
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
@inline(__always)
|
|
387
|
+
public final func onGeofenceEvent(callback: bridge.Func_void_GeofenceEvent_std__string) -> bridge.Result_void_ {
|
|
388
|
+
do {
|
|
389
|
+
try self.__implementation.onGeofenceEvent(callback: { () -> (GeofenceEvent, String) -> Void in
|
|
390
|
+
let __wrappedFunction = bridge.wrap_Func_void_GeofenceEvent_std__string(callback)
|
|
391
|
+
return { (__event: GeofenceEvent, __regionId: String) -> Void in
|
|
392
|
+
__wrappedFunction.call(__event.rawValue, std.string(__regionId))
|
|
393
|
+
}
|
|
394
|
+
}())
|
|
395
|
+
return bridge.create_Result_void_()
|
|
396
|
+
} catch (let __error) {
|
|
397
|
+
let __exceptionPtr = __error.toCpp()
|
|
398
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
@inline(__always)
|
|
403
|
+
public final func configureSpeedMonitor(config: SpeedConfig) -> bridge.Result_void_ {
|
|
404
|
+
do {
|
|
405
|
+
try self.__implementation.configureSpeedMonitor(config: config)
|
|
406
|
+
return bridge.create_Result_void_()
|
|
407
|
+
} catch (let __error) {
|
|
408
|
+
let __exceptionPtr = __error.toCpp()
|
|
409
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
@inline(__always)
|
|
414
|
+
public final func onSpeedAlert(callback: bridge.Func_void_SpeedAlertType_double) -> bridge.Result_void_ {
|
|
415
|
+
do {
|
|
416
|
+
try self.__implementation.onSpeedAlert(callback: { () -> (SpeedAlertType, Double) -> Void in
|
|
417
|
+
let __wrappedFunction = bridge.wrap_Func_void_SpeedAlertType_double(callback)
|
|
418
|
+
return { (__alert: SpeedAlertType, __currentSpeedKmh: Double) -> Void in
|
|
419
|
+
__wrappedFunction.call(__alert.rawValue, __currentSpeedKmh)
|
|
420
|
+
}
|
|
421
|
+
}())
|
|
422
|
+
return bridge.create_Result_void_()
|
|
423
|
+
} catch (let __error) {
|
|
424
|
+
let __exceptionPtr = __error.toCpp()
|
|
425
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
@inline(__always)
|
|
430
|
+
public final func getCurrentSpeed() -> bridge.Result_double_ {
|
|
431
|
+
do {
|
|
432
|
+
let __result = try self.__implementation.getCurrentSpeed()
|
|
433
|
+
let __resultCpp = __result
|
|
434
|
+
return bridge.create_Result_double_(__resultCpp)
|
|
435
|
+
} catch (let __error) {
|
|
436
|
+
let __exceptionPtr = __error.toCpp()
|
|
437
|
+
return bridge.create_Result_double_(__exceptionPtr)
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
@inline(__always)
|
|
442
|
+
public final func startTripCalculation() -> bridge.Result_void_ {
|
|
443
|
+
do {
|
|
444
|
+
try self.__implementation.startTripCalculation()
|
|
445
|
+
return bridge.create_Result_void_()
|
|
446
|
+
} catch (let __error) {
|
|
447
|
+
let __exceptionPtr = __error.toCpp()
|
|
448
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
@inline(__always)
|
|
453
|
+
public final func stopTripCalculation() -> bridge.Result_TripStats_ {
|
|
454
|
+
do {
|
|
455
|
+
let __result = try self.__implementation.stopTripCalculation()
|
|
456
|
+
let __resultCpp = __result
|
|
457
|
+
return bridge.create_Result_TripStats_(__resultCpp)
|
|
458
|
+
} catch (let __error) {
|
|
459
|
+
let __exceptionPtr = __error.toCpp()
|
|
460
|
+
return bridge.create_Result_TripStats_(__exceptionPtr)
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
@inline(__always)
|
|
465
|
+
public final func getTripStats() -> bridge.Result_TripStats_ {
|
|
466
|
+
do {
|
|
467
|
+
let __result = try self.__implementation.getTripStats()
|
|
468
|
+
let __resultCpp = __result
|
|
469
|
+
return bridge.create_Result_TripStats_(__resultCpp)
|
|
470
|
+
} catch (let __error) {
|
|
471
|
+
let __exceptionPtr = __error.toCpp()
|
|
472
|
+
return bridge.create_Result_TripStats_(__exceptionPtr)
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
@inline(__always)
|
|
477
|
+
public final func resetTripCalculation() -> bridge.Result_void_ {
|
|
478
|
+
do {
|
|
479
|
+
try self.__implementation.resetTripCalculation()
|
|
480
|
+
return bridge.create_Result_void_()
|
|
481
|
+
} catch (let __error) {
|
|
482
|
+
let __exceptionPtr = __error.toCpp()
|
|
483
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
@inline(__always)
|
|
488
|
+
public final func isLocationServicesEnabled() -> bridge.Result_bool_ {
|
|
489
|
+
do {
|
|
490
|
+
let __result = try self.__implementation.isLocationServicesEnabled()
|
|
491
|
+
let __resultCpp = __result
|
|
492
|
+
return bridge.create_Result_bool_(__resultCpp)
|
|
493
|
+
} catch (let __error) {
|
|
494
|
+
let __exceptionPtr = __error.toCpp()
|
|
495
|
+
return bridge.create_Result_bool_(__exceptionPtr)
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
@inline(__always)
|
|
500
|
+
public final func onProviderStatusChange(callback: bridge.Func_void_LocationProviderStatus_LocationProviderStatus) -> bridge.Result_void_ {
|
|
501
|
+
do {
|
|
502
|
+
try self.__implementation.onProviderStatusChange(callback: { () -> (LocationProviderStatus, LocationProviderStatus) -> Void in
|
|
503
|
+
let __wrappedFunction = bridge.wrap_Func_void_LocationProviderStatus_LocationProviderStatus(callback)
|
|
504
|
+
return { (__gps: LocationProviderStatus, __network: LocationProviderStatus) -> Void in
|
|
505
|
+
__wrappedFunction.call(__gps.rawValue, __network.rawValue)
|
|
506
|
+
}
|
|
507
|
+
}())
|
|
508
|
+
return bridge.create_Result_void_()
|
|
509
|
+
} catch (let __error) {
|
|
510
|
+
let __exceptionPtr = __error.toCpp()
|
|
511
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
@inline(__always)
|
|
516
|
+
public final func getLocationPermissionStatus() -> bridge.Result_PermissionStatus_ {
|
|
517
|
+
do {
|
|
518
|
+
let __result = try self.__implementation.getLocationPermissionStatus()
|
|
519
|
+
let __resultCpp = __result
|
|
520
|
+
return bridge.create_Result_PermissionStatus_(__resultCpp)
|
|
521
|
+
} catch (let __error) {
|
|
522
|
+
let __exceptionPtr = __error.toCpp()
|
|
523
|
+
return bridge.create_Result_PermissionStatus_(__exceptionPtr)
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
330
527
|
@inline(__always)
|
|
331
528
|
public final func showLocalNotification(title: std.string, body: std.string) -> bridge.Result_void_ {
|
|
332
529
|
do {
|
|
@@ -18,8 +18,14 @@ public extension LocationData {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `LocationData`.
|
|
20
20
|
*/
|
|
21
|
-
init(latitude: Double, longitude: Double, altitude: Double, speed: Double, bearing: Double, accuracy: Double, timestamp: Double) {
|
|
22
|
-
self.init(latitude, longitude, altitude, speed, bearing, accuracy, timestamp)
|
|
21
|
+
init(latitude: Double, longitude: Double, altitude: Double, speed: Double, bearing: Double, accuracy: Double, timestamp: Double, isMockLocation: Bool?) {
|
|
22
|
+
self.init(latitude, longitude, altitude, speed, bearing, accuracy, timestamp, { () -> bridge.std__optional_bool_ in
|
|
23
|
+
if let __unwrappedValue = isMockLocation {
|
|
24
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
25
|
+
} else {
|
|
26
|
+
return .init()
|
|
27
|
+
}
|
|
28
|
+
}())
|
|
23
29
|
}
|
|
24
30
|
|
|
25
31
|
@inline(__always)
|
|
@@ -56,4 +62,16 @@ public extension LocationData {
|
|
|
56
62
|
var timestamp: Double {
|
|
57
63
|
return self.__timestamp
|
|
58
64
|
}
|
|
65
|
+
|
|
66
|
+
@inline(__always)
|
|
67
|
+
var isMockLocation: Bool? {
|
|
68
|
+
return { () -> Bool? in
|
|
69
|
+
if bridge.has_value_std__optional_bool_(self.__isMockLocation) {
|
|
70
|
+
let __unwrapped = bridge.get_std__optional_bool_(self.__isMockLocation)
|
|
71
|
+
return __unwrapped
|
|
72
|
+
} else {
|
|
73
|
+
return nil
|
|
74
|
+
}
|
|
75
|
+
}()
|
|
76
|
+
}
|
|
59
77
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// LocationProviderStatus.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the JS union `LocationProviderStatus`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias LocationProviderStatus = margelo.nitro.nitrolocationtracking.LocationProviderStatus
|
|
12
|
+
|
|
13
|
+
public extension LocationProviderStatus {
|
|
14
|
+
/**
|
|
15
|
+
* Get a LocationProviderStatus for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "enabled":
|
|
21
|
+
self = .enabled
|
|
22
|
+
case "disabled":
|
|
23
|
+
self = .disabled
|
|
24
|
+
default:
|
|
25
|
+
return nil
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get the String value this LocationProviderStatus represents.
|
|
31
|
+
*/
|
|
32
|
+
var stringValue: String {
|
|
33
|
+
switch self {
|
|
34
|
+
case .enabled:
|
|
35
|
+
return "enabled"
|
|
36
|
+
case .disabled:
|
|
37
|
+
return "disabled"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PermissionStatus.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the JS union `PermissionStatus`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias PermissionStatus = margelo.nitro.nitrolocationtracking.PermissionStatus
|
|
12
|
+
|
|
13
|
+
public extension PermissionStatus {
|
|
14
|
+
/**
|
|
15
|
+
* Get a PermissionStatus for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "notDetermined":
|
|
21
|
+
self = .notdetermined
|
|
22
|
+
case "denied":
|
|
23
|
+
self = .denied
|
|
24
|
+
case "restricted":
|
|
25
|
+
self = .restricted
|
|
26
|
+
case "whenInUse":
|
|
27
|
+
self = .wheninuse
|
|
28
|
+
case "always":
|
|
29
|
+
self = .always
|
|
30
|
+
default:
|
|
31
|
+
return nil
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get the String value this PermissionStatus represents.
|
|
37
|
+
*/
|
|
38
|
+
var stringValue: String {
|
|
39
|
+
switch self {
|
|
40
|
+
case .notdetermined:
|
|
41
|
+
return "notDetermined"
|
|
42
|
+
case .denied:
|
|
43
|
+
return "denied"
|
|
44
|
+
case .restricted:
|
|
45
|
+
return "restricted"
|
|
46
|
+
case .wheninuse:
|
|
47
|
+
return "whenInUse"
|
|
48
|
+
case .always:
|
|
49
|
+
return "always"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// SpeedAlertType.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the JS union `SpeedAlertType`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias SpeedAlertType = margelo.nitro.nitrolocationtracking.SpeedAlertType
|
|
12
|
+
|
|
13
|
+
public extension SpeedAlertType {
|
|
14
|
+
/**
|
|
15
|
+
* Get a SpeedAlertType for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "exceeded":
|
|
21
|
+
self = .exceeded
|
|
22
|
+
case "normalized":
|
|
23
|
+
self = .normalized
|
|
24
|
+
case "below_minimum":
|
|
25
|
+
self = .belowMinimum
|
|
26
|
+
default:
|
|
27
|
+
return nil
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get the String value this SpeedAlertType represents.
|
|
33
|
+
*/
|
|
34
|
+
var stringValue: String {
|
|
35
|
+
switch self {
|
|
36
|
+
case .exceeded:
|
|
37
|
+
return "exceeded"
|
|
38
|
+
case .normalized:
|
|
39
|
+
return "normalized"
|
|
40
|
+
case .belowMinimum:
|
|
41
|
+
return "below_minimum"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// SpeedConfig.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `SpeedConfig`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias SpeedConfig = margelo.nitro.nitrolocationtracking.SpeedConfig
|
|
14
|
+
|
|
15
|
+
public extension SpeedConfig {
|
|
16
|
+
private typealias bridge = margelo.nitro.nitrolocationtracking.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `SpeedConfig`.
|
|
20
|
+
*/
|
|
21
|
+
init(maxSpeedKmh: Double, minSpeedKmh: Double, checkIntervalMs: Double) {
|
|
22
|
+
self.init(maxSpeedKmh, minSpeedKmh, checkIntervalMs)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@inline(__always)
|
|
26
|
+
var maxSpeedKmh: Double {
|
|
27
|
+
return self.__maxSpeedKmh
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@inline(__always)
|
|
31
|
+
var minSpeedKmh: Double {
|
|
32
|
+
return self.__minSpeedKmh
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@inline(__always)
|
|
36
|
+
var checkIntervalMs: Double {
|
|
37
|
+
return self.__checkIntervalMs
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// TripStats.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `TripStats`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias TripStats = margelo.nitro.nitrolocationtracking.TripStats
|
|
14
|
+
|
|
15
|
+
public extension TripStats {
|
|
16
|
+
private typealias bridge = margelo.nitro.nitrolocationtracking.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `TripStats`.
|
|
20
|
+
*/
|
|
21
|
+
init(distanceMeters: Double, durationMs: Double, averageSpeedKmh: Double, maxSpeedKmh: Double, pointCount: Double) {
|
|
22
|
+
self.init(distanceMeters, durationMs, averageSpeedKmh, maxSpeedKmh, pointCount)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@inline(__always)
|
|
26
|
+
var distanceMeters: Double {
|
|
27
|
+
return self.__distanceMeters
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@inline(__always)
|
|
31
|
+
var durationMs: Double {
|
|
32
|
+
return self.__durationMs
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@inline(__always)
|
|
36
|
+
var averageSpeedKmh: Double {
|
|
37
|
+
return self.__averageSpeedKmh
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@inline(__always)
|
|
41
|
+
var maxSpeedKmh: Double {
|
|
42
|
+
return self.__maxSpeedKmh
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@inline(__always)
|
|
46
|
+
var pointCount: Double {
|
|
47
|
+
return self.__pointCount
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// GeofenceEvent.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::nitrolocationtracking {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (GeofenceEvent).
|
|
30
|
+
*/
|
|
31
|
+
enum class GeofenceEvent {
|
|
32
|
+
ENTER SWIFT_NAME(enter) = 0,
|
|
33
|
+
EXIT SWIFT_NAME(exit) = 1,
|
|
34
|
+
} CLOSED_ENUM;
|
|
35
|
+
|
|
36
|
+
} // namespace margelo::nitro::nitrolocationtracking
|
|
37
|
+
|
|
38
|
+
namespace margelo::nitro {
|
|
39
|
+
|
|
40
|
+
// C++ GeofenceEvent <> JS GeofenceEvent (union)
|
|
41
|
+
template <>
|
|
42
|
+
struct JSIConverter<margelo::nitro::nitrolocationtracking::GeofenceEvent> final {
|
|
43
|
+
static inline margelo::nitro::nitrolocationtracking::GeofenceEvent fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
44
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
45
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
46
|
+
case hashString("enter"): return margelo::nitro::nitrolocationtracking::GeofenceEvent::ENTER;
|
|
47
|
+
case hashString("exit"): return margelo::nitro::nitrolocationtracking::GeofenceEvent::EXIT;
|
|
48
|
+
default: [[unlikely]]
|
|
49
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum GeofenceEvent - invalid value!");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitrolocationtracking::GeofenceEvent arg) {
|
|
53
|
+
switch (arg) {
|
|
54
|
+
case margelo::nitro::nitrolocationtracking::GeofenceEvent::ENTER: return JSIConverter<std::string>::toJSI(runtime, "enter");
|
|
55
|
+
case margelo::nitro::nitrolocationtracking::GeofenceEvent::EXIT: return JSIConverter<std::string>::toJSI(runtime, "exit");
|
|
56
|
+
default: [[unlikely]]
|
|
57
|
+
throw std::invalid_argument("Cannot convert GeofenceEvent to JS - invalid value: "
|
|
58
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
62
|
+
if (!value.isString()) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
66
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
67
|
+
case hashString("enter"):
|
|
68
|
+
case hashString("exit"):
|
|
69
|
+
return true;
|
|
70
|
+
default:
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// GeofenceRegion.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <string>
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::nitrolocationtracking {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (GeofenceRegion).
|
|
39
|
+
*/
|
|
40
|
+
struct GeofenceRegion final {
|
|
41
|
+
public:
|
|
42
|
+
std::string id SWIFT_PRIVATE;
|
|
43
|
+
double latitude SWIFT_PRIVATE;
|
|
44
|
+
double longitude SWIFT_PRIVATE;
|
|
45
|
+
double radius SWIFT_PRIVATE;
|
|
46
|
+
bool notifyOnEntry SWIFT_PRIVATE;
|
|
47
|
+
bool notifyOnExit SWIFT_PRIVATE;
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
GeofenceRegion() = default;
|
|
51
|
+
explicit GeofenceRegion(std::string id, double latitude, double longitude, double radius, bool notifyOnEntry, bool notifyOnExit): id(id), latitude(latitude), longitude(longitude), radius(radius), notifyOnEntry(notifyOnEntry), notifyOnExit(notifyOnExit) {}
|
|
52
|
+
|
|
53
|
+
public:
|
|
54
|
+
friend bool operator==(const GeofenceRegion& lhs, const GeofenceRegion& rhs) = default;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
} // namespace margelo::nitro::nitrolocationtracking
|
|
58
|
+
|
|
59
|
+
namespace margelo::nitro {
|
|
60
|
+
|
|
61
|
+
// C++ GeofenceRegion <> JS GeofenceRegion (object)
|
|
62
|
+
template <>
|
|
63
|
+
struct JSIConverter<margelo::nitro::nitrolocationtracking::GeofenceRegion> final {
|
|
64
|
+
static inline margelo::nitro::nitrolocationtracking::GeofenceRegion fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
65
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
66
|
+
return margelo::nitro::nitrolocationtracking::GeofenceRegion(
|
|
67
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id"))),
|
|
68
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latitude"))),
|
|
69
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "longitude"))),
|
|
70
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "radius"))),
|
|
71
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notifyOnEntry"))),
|
|
72
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notifyOnExit")))
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrolocationtracking::GeofenceRegion& arg) {
|
|
76
|
+
jsi::Object obj(runtime);
|
|
77
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "id"), JSIConverter<std::string>::toJSI(runtime, arg.id));
|
|
78
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "latitude"), JSIConverter<double>::toJSI(runtime, arg.latitude));
|
|
79
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "longitude"), JSIConverter<double>::toJSI(runtime, arg.longitude));
|
|
80
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "radius"), JSIConverter<double>::toJSI(runtime, arg.radius));
|
|
81
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "notifyOnEntry"), JSIConverter<bool>::toJSI(runtime, arg.notifyOnEntry));
|
|
82
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "notifyOnExit"), JSIConverter<bool>::toJSI(runtime, arg.notifyOnExit));
|
|
83
|
+
return obj;
|
|
84
|
+
}
|
|
85
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
86
|
+
if (!value.isObject()) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
jsi::Object obj = value.getObject(runtime);
|
|
90
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id")))) return false;
|
|
94
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latitude")))) return false;
|
|
95
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "longitude")))) return false;
|
|
96
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "radius")))) return false;
|
|
97
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notifyOnEntry")))) return false;
|
|
98
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notifyOnExit")))) return false;
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
} // namespace margelo::nitro
|
|
@@ -29,6 +29,22 @@ namespace margelo::nitro::nitrolocationtracking {
|
|
|
29
29
|
prototype.registerHybridMethod("onConnectionStateChange", &HybridNitroLocationTrackingSpec::onConnectionStateChange);
|
|
30
30
|
prototype.registerHybridMethod("onMessage", &HybridNitroLocationTrackingSpec::onMessage);
|
|
31
31
|
prototype.registerHybridMethod("forceSync", &HybridNitroLocationTrackingSpec::forceSync);
|
|
32
|
+
prototype.registerHybridMethod("isFakeGpsEnabled", &HybridNitroLocationTrackingSpec::isFakeGpsEnabled);
|
|
33
|
+
prototype.registerHybridMethod("setRejectMockLocations", &HybridNitroLocationTrackingSpec::setRejectMockLocations);
|
|
34
|
+
prototype.registerHybridMethod("addGeofence", &HybridNitroLocationTrackingSpec::addGeofence);
|
|
35
|
+
prototype.registerHybridMethod("removeGeofence", &HybridNitroLocationTrackingSpec::removeGeofence);
|
|
36
|
+
prototype.registerHybridMethod("removeAllGeofences", &HybridNitroLocationTrackingSpec::removeAllGeofences);
|
|
37
|
+
prototype.registerHybridMethod("onGeofenceEvent", &HybridNitroLocationTrackingSpec::onGeofenceEvent);
|
|
38
|
+
prototype.registerHybridMethod("configureSpeedMonitor", &HybridNitroLocationTrackingSpec::configureSpeedMonitor);
|
|
39
|
+
prototype.registerHybridMethod("onSpeedAlert", &HybridNitroLocationTrackingSpec::onSpeedAlert);
|
|
40
|
+
prototype.registerHybridMethod("getCurrentSpeed", &HybridNitroLocationTrackingSpec::getCurrentSpeed);
|
|
41
|
+
prototype.registerHybridMethod("startTripCalculation", &HybridNitroLocationTrackingSpec::startTripCalculation);
|
|
42
|
+
prototype.registerHybridMethod("stopTripCalculation", &HybridNitroLocationTrackingSpec::stopTripCalculation);
|
|
43
|
+
prototype.registerHybridMethod("getTripStats", &HybridNitroLocationTrackingSpec::getTripStats);
|
|
44
|
+
prototype.registerHybridMethod("resetTripCalculation", &HybridNitroLocationTrackingSpec::resetTripCalculation);
|
|
45
|
+
prototype.registerHybridMethod("isLocationServicesEnabled", &HybridNitroLocationTrackingSpec::isLocationServicesEnabled);
|
|
46
|
+
prototype.registerHybridMethod("onProviderStatusChange", &HybridNitroLocationTrackingSpec::onProviderStatusChange);
|
|
47
|
+
prototype.registerHybridMethod("getLocationPermissionStatus", &HybridNitroLocationTrackingSpec::getLocationPermissionStatus);
|
|
32
48
|
prototype.registerHybridMethod("showLocalNotification", &HybridNitroLocationTrackingSpec::showLocalNotification);
|
|
33
49
|
prototype.registerHybridMethod("updateForegroundNotification", &HybridNitroLocationTrackingSpec::updateForegroundNotification);
|
|
34
50
|
prototype.registerHybridMethod("destroy", &HybridNitroLocationTrackingSpec::destroy);
|