react-native-nitro-location-tracking 0.1.5 → 0.1.7

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.
Files changed (78) hide show
  1. package/README.md +677 -7
  2. package/android/src/main/java/com/margelo/nitro/nitrolocationtracking/GeofenceManager.kt +148 -0
  3. package/android/src/main/java/com/margelo/nitro/nitrolocationtracking/LocationEngine.kt +63 -10
  4. package/android/src/main/java/com/margelo/nitro/nitrolocationtracking/NativeDBWriter.kt +61 -53
  5. package/android/src/main/java/com/margelo/nitro/nitrolocationtracking/NitroLocationTracking.kt +127 -0
  6. package/android/src/main/java/com/margelo/nitro/nitrolocationtracking/ProviderStatusMonitor.kt +73 -0
  7. package/android/src/main/java/com/margelo/nitro/nitrolocationtracking/SpeedMonitor.kt +38 -0
  8. package/android/src/main/java/com/margelo/nitro/nitrolocationtracking/TripCalculator.kt +85 -0
  9. package/ios/GeofenceManager.swift +69 -0
  10. package/ios/LocationEngine.swift +56 -2
  11. package/ios/NativeDBWriter.swift +2 -1
  12. package/ios/NitroLocationTracking.swift +105 -0
  13. package/ios/SpeedMonitor.swift +48 -0
  14. package/ios/TripCalculator.swift +93 -0
  15. package/lib/module/index.js.map +1 -1
  16. package/lib/typescript/src/NitroLocationTracking.nitro.d.ts +44 -0
  17. package/lib/typescript/src/NitroLocationTracking.nitro.d.ts.map +1 -1
  18. package/lib/typescript/src/index.d.ts +1 -1
  19. package/lib/typescript/src/index.d.ts.map +1 -1
  20. package/lib/typescript/test.d.ts +1 -0
  21. package/lib/typescript/test.d.ts.map +1 -0
  22. package/nitrogen/generated/android/c++/JFunc_void_GeofenceEvent_std__string.hpp +78 -0
  23. package/nitrogen/generated/android/c++/JFunc_void_LocationData.hpp +1 -0
  24. package/nitrogen/generated/android/c++/JFunc_void_LocationProviderStatus_LocationProviderStatus.hpp +77 -0
  25. package/nitrogen/generated/android/c++/JFunc_void_SpeedAlertType_double.hpp +77 -0
  26. package/nitrogen/generated/android/c++/JGeofenceEvent.hpp +58 -0
  27. package/nitrogen/generated/android/c++/JGeofenceRegion.hpp +77 -0
  28. package/nitrogen/generated/android/c++/JHybridNitroLocationTrackingSpec.cpp +102 -0
  29. package/nitrogen/generated/android/c++/JHybridNitroLocationTrackingSpec.hpp +16 -0
  30. package/nitrogen/generated/android/c++/JLocationData.hpp +8 -4
  31. package/nitrogen/generated/android/c++/JLocationProviderStatus.hpp +58 -0
  32. package/nitrogen/generated/android/c++/JPermissionStatus.hpp +67 -0
  33. package/nitrogen/generated/android/c++/JSpeedAlertType.hpp +61 -0
  34. package/nitrogen/generated/android/c++/JSpeedConfig.hpp +65 -0
  35. package/nitrogen/generated/android/c++/JTripStats.hpp +73 -0
  36. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/Func_void_GeofenceEvent_std__string.kt +80 -0
  37. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/Func_void_LocationProviderStatus_LocationProviderStatus.kt +80 -0
  38. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/Func_void_SpeedAlertType_double.kt +80 -0
  39. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/GeofenceEvent.kt +23 -0
  40. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/GeofenceRegion.kt +53 -0
  41. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/HybridNitroLocationTrackingSpec.kt +79 -0
  42. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/LocationData.kt +6 -3
  43. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/LocationProviderStatus.kt +23 -0
  44. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/PermissionStatus.kt +26 -0
  45. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/SpeedAlertType.kt +24 -0
  46. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/SpeedConfig.kt +44 -0
  47. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/TripStats.kt +50 -0
  48. package/nitrogen/generated/android/nitrolocationtrackingOnLoad.cpp +6 -0
  49. package/nitrogen/generated/ios/NitroLocationTracking-Swift-Cxx-Bridge.cpp +24 -0
  50. package/nitrogen/generated/ios/NitroLocationTracking-Swift-Cxx-Bridge.hpp +124 -0
  51. package/nitrogen/generated/ios/NitroLocationTracking-Swift-Cxx-Umbrella.hpp +22 -0
  52. package/nitrogen/generated/ios/c++/HybridNitroLocationTrackingSpecSwift.hpp +130 -0
  53. package/nitrogen/generated/ios/swift/Func_void_GeofenceEvent_std__string.swift +46 -0
  54. package/nitrogen/generated/ios/swift/Func_void_LocationProviderStatus_LocationProviderStatus.swift +46 -0
  55. package/nitrogen/generated/ios/swift/Func_void_SpeedAlertType_double.swift +46 -0
  56. package/nitrogen/generated/ios/swift/GeofenceEvent.swift +40 -0
  57. package/nitrogen/generated/ios/swift/GeofenceRegion.swift +54 -0
  58. package/nitrogen/generated/ios/swift/HybridNitroLocationTrackingSpec.swift +16 -0
  59. package/nitrogen/generated/ios/swift/HybridNitroLocationTrackingSpec_cxx.swift +197 -0
  60. package/nitrogen/generated/ios/swift/LocationData.swift +20 -2
  61. package/nitrogen/generated/ios/swift/LocationProviderStatus.swift +40 -0
  62. package/nitrogen/generated/ios/swift/PermissionStatus.swift +52 -0
  63. package/nitrogen/generated/ios/swift/SpeedAlertType.swift +44 -0
  64. package/nitrogen/generated/ios/swift/SpeedConfig.swift +39 -0
  65. package/nitrogen/generated/ios/swift/TripStats.swift +49 -0
  66. package/nitrogen/generated/shared/c++/GeofenceEvent.hpp +76 -0
  67. package/nitrogen/generated/shared/c++/GeofenceRegion.hpp +103 -0
  68. package/nitrogen/generated/shared/c++/HybridNitroLocationTrackingSpec.cpp +16 -0
  69. package/nitrogen/generated/shared/c++/HybridNitroLocationTrackingSpec.hpp +37 -0
  70. package/nitrogen/generated/shared/c++/LocationData.hpp +7 -3
  71. package/nitrogen/generated/shared/c++/LocationProviderStatus.hpp +76 -0
  72. package/nitrogen/generated/shared/c++/PermissionStatus.hpp +88 -0
  73. package/nitrogen/generated/shared/c++/SpeedAlertType.hpp +80 -0
  74. package/nitrogen/generated/shared/c++/SpeedConfig.hpp +91 -0
  75. package/nitrogen/generated/shared/c++/TripStats.hpp +99 -0
  76. package/package.json +1 -1
  77. package/src/NitroLocationTracking.nitro.ts +74 -0
  78. package/src/index.tsx +10 -0
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// Func_void_LocationProviderStatus_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
+ import NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `(_ gps: LocationProviderStatus, _ network: LocationProviderStatus) -> Void` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_void_LocationProviderStatus_LocationProviderStatus {
15
+ public typealias bridge = margelo.nitro.nitrolocationtracking.bridge.swift
16
+
17
+ private let closure: (_ gps: LocationProviderStatus, _ network: LocationProviderStatus) -> Void
18
+
19
+ public init(_ closure: @escaping (_ gps: LocationProviderStatus, _ network: LocationProviderStatus) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(gps: Int32, network: Int32) -> Void {
25
+ self.closure(margelo.nitro.nitrolocationtracking.LocationProviderStatus(rawValue: gps)!, margelo.nitro.nitrolocationtracking.LocationProviderStatus(rawValue: network)!)
26
+ }
27
+
28
+ /**
29
+ * Casts this instance to a retained unsafe raw pointer.
30
+ * This acquires one additional strong reference on the object!
31
+ */
32
+ @inline(__always)
33
+ public func toUnsafe() -> UnsafeMutableRawPointer {
34
+ return Unmanaged.passRetained(self).toOpaque()
35
+ }
36
+
37
+ /**
38
+ * Casts an unsafe pointer to a `Func_void_LocationProviderStatus_LocationProviderStatus`.
39
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_LocationProviderStatus_LocationProviderStatus>`.
40
+ * This removes one strong reference from the object!
41
+ */
42
+ @inline(__always)
43
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_LocationProviderStatus_LocationProviderStatus {
44
+ return Unmanaged<Func_void_LocationProviderStatus_LocationProviderStatus>.fromOpaque(pointer).takeRetainedValue()
45
+ }
46
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// Func_void_SpeedAlertType_double.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
+ * Wraps a Swift `(_ alert: SpeedAlertType, _ currentSpeedKmh: Double) -> Void` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_void_SpeedAlertType_double {
15
+ public typealias bridge = margelo.nitro.nitrolocationtracking.bridge.swift
16
+
17
+ private let closure: (_ alert: SpeedAlertType, _ currentSpeedKmh: Double) -> Void
18
+
19
+ public init(_ closure: @escaping (_ alert: SpeedAlertType, _ currentSpeedKmh: Double) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(alert: Int32, currentSpeedKmh: Double) -> Void {
25
+ self.closure(margelo.nitro.nitrolocationtracking.SpeedAlertType(rawValue: alert)!, currentSpeedKmh)
26
+ }
27
+
28
+ /**
29
+ * Casts this instance to a retained unsafe raw pointer.
30
+ * This acquires one additional strong reference on the object!
31
+ */
32
+ @inline(__always)
33
+ public func toUnsafe() -> UnsafeMutableRawPointer {
34
+ return Unmanaged.passRetained(self).toOpaque()
35
+ }
36
+
37
+ /**
38
+ * Casts an unsafe pointer to a `Func_void_SpeedAlertType_double`.
39
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_SpeedAlertType_double>`.
40
+ * This removes one strong reference from the object!
41
+ */
42
+ @inline(__always)
43
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_SpeedAlertType_double {
44
+ return Unmanaged<Func_void_SpeedAlertType_double>.fromOpaque(pointer).takeRetainedValue()
45
+ }
46
+ }
@@ -0,0 +1,40 @@
1
+ ///
2
+ /// GeofenceEvent.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 `GeofenceEvent`, backed by a C++ enum.
10
+ */
11
+ public typealias GeofenceEvent = margelo.nitro.nitrolocationtracking.GeofenceEvent
12
+
13
+ public extension GeofenceEvent {
14
+ /**
15
+ * Get a GeofenceEvent 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 "enter":
21
+ self = .enter
22
+ case "exit":
23
+ self = .exit
24
+ default:
25
+ return nil
26
+ }
27
+ }
28
+
29
+ /**
30
+ * Get the String value this GeofenceEvent represents.
31
+ */
32
+ var stringValue: String {
33
+ switch self {
34
+ case .enter:
35
+ return "enter"
36
+ case .exit:
37
+ return "exit"
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,54 @@
1
+ ///
2
+ /// GeofenceRegion.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 `GeofenceRegion`, backed by a C++ struct.
12
+ */
13
+ public typealias GeofenceRegion = margelo.nitro.nitrolocationtracking.GeofenceRegion
14
+
15
+ public extension GeofenceRegion {
16
+ private typealias bridge = margelo.nitro.nitrolocationtracking.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `GeofenceRegion`.
20
+ */
21
+ init(id: String, latitude: Double, longitude: Double, radius: Double, notifyOnEntry: Bool, notifyOnExit: Bool) {
22
+ self.init(std.string(id), latitude, longitude, radius, notifyOnEntry, notifyOnExit)
23
+ }
24
+
25
+ @inline(__always)
26
+ var id: String {
27
+ return String(self.__id)
28
+ }
29
+
30
+ @inline(__always)
31
+ var latitude: Double {
32
+ return self.__latitude
33
+ }
34
+
35
+ @inline(__always)
36
+ var longitude: Double {
37
+ return self.__longitude
38
+ }
39
+
40
+ @inline(__always)
41
+ var radius: Double {
42
+ return self.__radius
43
+ }
44
+
45
+ @inline(__always)
46
+ var notifyOnEntry: Bool {
47
+ return self.__notifyOnEntry
48
+ }
49
+
50
+ @inline(__always)
51
+ var notifyOnExit: Bool {
52
+ return self.__notifyOnExit
53
+ }
54
+ }
@@ -28,6 +28,22 @@ public protocol HybridNitroLocationTrackingSpec_protocol: HybridObject {
28
28
  func onConnectionStateChange(callback: @escaping (_ state: ConnectionState) -> Void) throws -> Void
29
29
  func onMessage(callback: @escaping (_ message: String) -> Void) throws -> Void
30
30
  func forceSync() throws -> Promise<Bool>
31
+ func isFakeGpsEnabled() throws -> Bool
32
+ func setRejectMockLocations(reject: Bool) throws -> Void
33
+ func addGeofence(region: GeofenceRegion) throws -> Void
34
+ func removeGeofence(regionId: String) throws -> Void
35
+ func removeAllGeofences() throws -> Void
36
+ func onGeofenceEvent(callback: @escaping (_ event: GeofenceEvent, _ regionId: String) -> Void) throws -> Void
37
+ func configureSpeedMonitor(config: SpeedConfig) throws -> Void
38
+ func onSpeedAlert(callback: @escaping (_ alert: SpeedAlertType, _ currentSpeedKmh: Double) -> Void) throws -> Void
39
+ func getCurrentSpeed() throws -> Double
40
+ func startTripCalculation() throws -> Void
41
+ func stopTripCalculation() throws -> TripStats
42
+ func getTripStats() throws -> TripStats
43
+ func resetTripCalculation() throws -> Void
44
+ func isLocationServicesEnabled() throws -> Bool
45
+ func onProviderStatusChange(callback: @escaping (_ gps: LocationProviderStatus, _ network: LocationProviderStatus) -> Void) throws -> Void
46
+ func getLocationPermissionStatus() throws -> PermissionStatus
31
47
  func showLocalNotification(title: String, body: String) throws -> Void
32
48
  func updateForegroundNotification(title: String, body: String) throws -> Void
33
49
  func destroy() throws -> Void
@@ -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
+ }