react-native-nitro-location-tracking 0.1.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.
Files changed (101) hide show
  1. package/LICENSE +20 -0
  2. package/NitroLocationTracking.podspec +29 -0
  3. package/README.md +39 -0
  4. package/android/CMakeLists.txt +24 -0
  5. package/android/build.gradle +122 -0
  6. package/android/src/main/AndroidManifest.xml +18 -0
  7. package/android/src/main/cpp/cpp-adapter.cpp +6 -0
  8. package/android/src/main/java/com/margelo/nitro/nitrolocationtracking/ConnectionManager.kt +137 -0
  9. package/android/src/main/java/com/margelo/nitro/nitrolocationtracking/LocationEngine.kt +93 -0
  10. package/android/src/main/java/com/margelo/nitro/nitrolocationtracking/LocationForegroundService.kt +65 -0
  11. package/android/src/main/java/com/margelo/nitro/nitrolocationtracking/NativeDBWriter.kt +80 -0
  12. package/android/src/main/java/com/margelo/nitro/nitrolocationtracking/NitroLocationTracking.kt +180 -0
  13. package/android/src/main/java/com/margelo/nitro/nitrolocationtracking/NitroLocationTrackingPackage.kt +22 -0
  14. package/android/src/main/java/com/margelo/nitro/nitrolocationtracking/NotificationService.kt +75 -0
  15. package/ios/ConnectionManager.swift +144 -0
  16. package/ios/LocationEngine.swift +146 -0
  17. package/ios/NativeDBWriter.swift +121 -0
  18. package/ios/NitroLocationTracking.swift +127 -0
  19. package/ios/NotificationService.swift +31 -0
  20. package/lib/module/LocationSmoother.js +33 -0
  21. package/lib/module/LocationSmoother.js.map +1 -0
  22. package/lib/module/NitroLocationTracking.nitro.js +4 -0
  23. package/lib/module/NitroLocationTracking.nitro.js.map +1 -0
  24. package/lib/module/bearing.js +19 -0
  25. package/lib/module/bearing.js.map +1 -0
  26. package/lib/module/db.js +234 -0
  27. package/lib/module/db.js.map +1 -0
  28. package/lib/module/index.js +68 -0
  29. package/lib/module/index.js.map +1 -0
  30. package/lib/module/package.json +1 -0
  31. package/lib/typescript/package.json +1 -0
  32. package/lib/typescript/src/LocationSmoother.d.ts +19 -0
  33. package/lib/typescript/src/LocationSmoother.d.ts.map +1 -0
  34. package/lib/typescript/src/NitroLocationTracking.nitro.d.ts +59 -0
  35. package/lib/typescript/src/NitroLocationTracking.nitro.d.ts.map +1 -0
  36. package/lib/typescript/src/bearing.d.ts +9 -0
  37. package/lib/typescript/src/bearing.d.ts.map +1 -0
  38. package/lib/typescript/src/db.d.ts +1 -0
  39. package/lib/typescript/src/db.d.ts.map +1 -0
  40. package/lib/typescript/src/index.d.ts +21 -0
  41. package/lib/typescript/src/index.d.ts.map +1 -0
  42. package/nitro.json +17 -0
  43. package/nitrogen/generated/android/c++/JAccuracyLevel.hpp +61 -0
  44. package/nitrogen/generated/android/c++/JConnectionConfig.hpp +81 -0
  45. package/nitrogen/generated/android/c++/JConnectionState.hpp +61 -0
  46. package/nitrogen/generated/android/c++/JFunc_void_ConnectionState.hpp +77 -0
  47. package/nitrogen/generated/android/c++/JFunc_void_LocationData.hpp +77 -0
  48. package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +75 -0
  49. package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
  50. package/nitrogen/generated/android/c++/JHybridNitroLocationTrackingSpec.cpp +179 -0
  51. package/nitrogen/generated/android/c++/JHybridNitroLocationTrackingSpec.hpp +83 -0
  52. package/nitrogen/generated/android/c++/JLocationConfig.hpp +91 -0
  53. package/nitrogen/generated/android/c++/JLocationData.hpp +81 -0
  54. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/AccuracyLevel.kt +24 -0
  55. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/ConnectionConfig.kt +56 -0
  56. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/ConnectionState.kt +24 -0
  57. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/Func_void_ConnectionState.kt +80 -0
  58. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/Func_void_LocationData.kt +80 -0
  59. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/Func_void_bool.kt +80 -0
  60. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/Func_void_std__string.kt +80 -0
  61. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/HybridNitroLocationTrackingSpec.kt +146 -0
  62. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/LocationConfig.kt +62 -0
  63. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/LocationData.kt +56 -0
  64. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolocationtracking/nitrolocationtrackingOnLoad.kt +35 -0
  65. package/nitrogen/generated/android/nitrolocationtracking+autolinking.cmake +81 -0
  66. package/nitrogen/generated/android/nitrolocationtracking+autolinking.gradle +27 -0
  67. package/nitrogen/generated/android/nitrolocationtrackingOnLoad.cpp +52 -0
  68. package/nitrogen/generated/android/nitrolocationtrackingOnLoad.hpp +25 -0
  69. package/nitrogen/generated/ios/NitroLocationTracking+autolinking.rb +60 -0
  70. package/nitrogen/generated/ios/NitroLocationTracking-Swift-Cxx-Bridge.cpp +73 -0
  71. package/nitrogen/generated/ios/NitroLocationTracking-Swift-Cxx-Bridge.hpp +231 -0
  72. package/nitrogen/generated/ios/NitroLocationTracking-Swift-Cxx-Umbrella.hpp +61 -0
  73. package/nitrogen/generated/ios/NitroLocationTrackingAutolinking.mm +33 -0
  74. package/nitrogen/generated/ios/NitroLocationTrackingAutolinking.swift +26 -0
  75. package/nitrogen/generated/ios/c++/HybridNitroLocationTrackingSpecSwift.cpp +11 -0
  76. package/nitrogen/generated/ios/c++/HybridNitroLocationTrackingSpecSwift.hpp +206 -0
  77. package/nitrogen/generated/ios/swift/AccuracyLevel.swift +44 -0
  78. package/nitrogen/generated/ios/swift/ConnectionConfig.swift +59 -0
  79. package/nitrogen/generated/ios/swift/ConnectionState.swift +44 -0
  80. package/nitrogen/generated/ios/swift/Func_void_ConnectionState.swift +46 -0
  81. package/nitrogen/generated/ios/swift/Func_void_LocationData.swift +46 -0
  82. package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
  83. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  84. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
  85. package/nitrogen/generated/ios/swift/HybridNitroLocationTrackingSpec.swift +72 -0
  86. package/nitrogen/generated/ios/swift/HybridNitroLocationTrackingSpec_cxx.swift +362 -0
  87. package/nitrogen/generated/ios/swift/LocationConfig.swift +69 -0
  88. package/nitrogen/generated/ios/swift/LocationData.swift +59 -0
  89. package/nitrogen/generated/shared/c++/AccuracyLevel.hpp +80 -0
  90. package/nitrogen/generated/shared/c++/ConnectionConfig.hpp +107 -0
  91. package/nitrogen/generated/shared/c++/ConnectionState.hpp +80 -0
  92. package/nitrogen/generated/shared/c++/HybridNitroLocationTrackingSpec.cpp +38 -0
  93. package/nitrogen/generated/shared/c++/HybridNitroLocationTrackingSpec.hpp +92 -0
  94. package/nitrogen/generated/shared/c++/LocationConfig.hpp +117 -0
  95. package/nitrogen/generated/shared/c++/LocationData.hpp +107 -0
  96. package/package.json +174 -0
  97. package/src/LocationSmoother.ts +46 -0
  98. package/src/NitroLocationTracking.nitro.ts +79 -0
  99. package/src/bearing.ts +22 -0
  100. package/src/db.ts +232 -0
  101. package/src/index.tsx +92 -0
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// Func_void_LocationData.kt
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
+ package com.margelo.nitro.nitrolocationtracking
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import dalvik.annotation.optimization.FastNative
14
+
15
+
16
+ /**
17
+ * Represents the JavaScript callback `(location: struct) => void`.
18
+ * This can be either implemented in C++ (in which case it might be a callback coming from JS),
19
+ * or in Kotlin/Java (in which case it is a native callback).
20
+ */
21
+ @DoNotStrip
22
+ @Keep
23
+ @Suppress("ClassName", "RedundantUnitReturnType")
24
+ fun interface Func_void_LocationData: (LocationData) -> Unit {
25
+ /**
26
+ * Call the given JS callback.
27
+ * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
28
+ */
29
+ @DoNotStrip
30
+ @Keep
31
+ override fun invoke(location: LocationData): Unit
32
+ }
33
+
34
+ /**
35
+ * Represents the JavaScript callback `(location: struct) => void`.
36
+ * This is implemented in C++, via a `std::function<...>`.
37
+ * The callback might be coming from JS.
38
+ */
39
+ @DoNotStrip
40
+ @Keep
41
+ @Suppress(
42
+ "KotlinJniMissingFunction", "unused",
43
+ "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
44
+ "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
45
+ )
46
+ class Func_void_LocationData_cxx: Func_void_LocationData {
47
+ @DoNotStrip
48
+ @Keep
49
+ private val mHybridData: HybridData
50
+
51
+ @DoNotStrip
52
+ @Keep
53
+ private constructor(hybridData: HybridData) {
54
+ mHybridData = hybridData
55
+ }
56
+
57
+ @DoNotStrip
58
+ @Keep
59
+ override fun invoke(location: LocationData): Unit
60
+ = invoke_cxx(location)
61
+
62
+ @FastNative
63
+ private external fun invoke_cxx(location: LocationData): Unit
64
+ }
65
+
66
+ /**
67
+ * Represents the JavaScript callback `(location: struct) => void`.
68
+ * This is implemented in Java/Kotlin, via a `(LocationData) -> Unit`.
69
+ * The callback is always coming from native.
70
+ */
71
+ @DoNotStrip
72
+ @Keep
73
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
74
+ class Func_void_LocationData_java(private val function: (LocationData) -> Unit): Func_void_LocationData {
75
+ @DoNotStrip
76
+ @Keep
77
+ override fun invoke(location: LocationData): Unit {
78
+ return this.function(location)
79
+ }
80
+ }
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// Func_void_bool.kt
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
+ package com.margelo.nitro.nitrolocationtracking
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import dalvik.annotation.optimization.FastNative
14
+
15
+
16
+ /**
17
+ * Represents the JavaScript callback `(isMoving: boolean) => void`.
18
+ * This can be either implemented in C++ (in which case it might be a callback coming from JS),
19
+ * or in Kotlin/Java (in which case it is a native callback).
20
+ */
21
+ @DoNotStrip
22
+ @Keep
23
+ @Suppress("ClassName", "RedundantUnitReturnType")
24
+ fun interface Func_void_bool: (Boolean) -> Unit {
25
+ /**
26
+ * Call the given JS callback.
27
+ * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
28
+ */
29
+ @DoNotStrip
30
+ @Keep
31
+ override fun invoke(isMoving: Boolean): Unit
32
+ }
33
+
34
+ /**
35
+ * Represents the JavaScript callback `(isMoving: boolean) => void`.
36
+ * This is implemented in C++, via a `std::function<...>`.
37
+ * The callback might be coming from JS.
38
+ */
39
+ @DoNotStrip
40
+ @Keep
41
+ @Suppress(
42
+ "KotlinJniMissingFunction", "unused",
43
+ "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
44
+ "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
45
+ )
46
+ class Func_void_bool_cxx: Func_void_bool {
47
+ @DoNotStrip
48
+ @Keep
49
+ private val mHybridData: HybridData
50
+
51
+ @DoNotStrip
52
+ @Keep
53
+ private constructor(hybridData: HybridData) {
54
+ mHybridData = hybridData
55
+ }
56
+
57
+ @DoNotStrip
58
+ @Keep
59
+ override fun invoke(isMoving: Boolean): Unit
60
+ = invoke_cxx(isMoving)
61
+
62
+ @FastNative
63
+ private external fun invoke_cxx(isMoving: Boolean): Unit
64
+ }
65
+
66
+ /**
67
+ * Represents the JavaScript callback `(isMoving: boolean) => void`.
68
+ * This is implemented in Java/Kotlin, via a `(Boolean) -> Unit`.
69
+ * The callback is always coming from native.
70
+ */
71
+ @DoNotStrip
72
+ @Keep
73
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
74
+ class Func_void_bool_java(private val function: (Boolean) -> Unit): Func_void_bool {
75
+ @DoNotStrip
76
+ @Keep
77
+ override fun invoke(isMoving: Boolean): Unit {
78
+ return this.function(isMoving)
79
+ }
80
+ }
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// Func_void_std__string.kt
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
+ package com.margelo.nitro.nitrolocationtracking
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import dalvik.annotation.optimization.FastNative
14
+
15
+
16
+ /**
17
+ * Represents the JavaScript callback `(message: string) => void`.
18
+ * This can be either implemented in C++ (in which case it might be a callback coming from JS),
19
+ * or in Kotlin/Java (in which case it is a native callback).
20
+ */
21
+ @DoNotStrip
22
+ @Keep
23
+ @Suppress("ClassName", "RedundantUnitReturnType")
24
+ fun interface Func_void_std__string: (String) -> Unit {
25
+ /**
26
+ * Call the given JS callback.
27
+ * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
28
+ */
29
+ @DoNotStrip
30
+ @Keep
31
+ override fun invoke(message: String): Unit
32
+ }
33
+
34
+ /**
35
+ * Represents the JavaScript callback `(message: string) => void`.
36
+ * This is implemented in C++, via a `std::function<...>`.
37
+ * The callback might be coming from JS.
38
+ */
39
+ @DoNotStrip
40
+ @Keep
41
+ @Suppress(
42
+ "KotlinJniMissingFunction", "unused",
43
+ "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
44
+ "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
45
+ )
46
+ class Func_void_std__string_cxx: Func_void_std__string {
47
+ @DoNotStrip
48
+ @Keep
49
+ private val mHybridData: HybridData
50
+
51
+ @DoNotStrip
52
+ @Keep
53
+ private constructor(hybridData: HybridData) {
54
+ mHybridData = hybridData
55
+ }
56
+
57
+ @DoNotStrip
58
+ @Keep
59
+ override fun invoke(message: String): Unit
60
+ = invoke_cxx(message)
61
+
62
+ @FastNative
63
+ private external fun invoke_cxx(message: String): Unit
64
+ }
65
+
66
+ /**
67
+ * Represents the JavaScript callback `(message: string) => void`.
68
+ * This is implemented in Java/Kotlin, via a `(String) -> Unit`.
69
+ * The callback is always coming from native.
70
+ */
71
+ @DoNotStrip
72
+ @Keep
73
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
74
+ class Func_void_std__string_java(private val function: (String) -> Unit): Func_void_std__string {
75
+ @DoNotStrip
76
+ @Keep
77
+ override fun invoke(message: String): Unit {
78
+ return this.function(message)
79
+ }
80
+ }
@@ -0,0 +1,146 @@
1
+ ///
2
+ /// HybridNitroLocationTrackingSpec.kt
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
+ package com.margelo.nitro.nitrolocationtracking
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.Promise
14
+ import com.margelo.nitro.core.HybridObject
15
+
16
+ /**
17
+ * A Kotlin class representing the NitroLocationTracking HybridObject.
18
+ * Implement this abstract class to create Kotlin-based instances of NitroLocationTracking.
19
+ */
20
+ @DoNotStrip
21
+ @Keep
22
+ @Suppress(
23
+ "KotlinJniMissingFunction", "unused",
24
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
25
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
26
+ )
27
+ abstract class HybridNitroLocationTrackingSpec: HybridObject() {
28
+ @DoNotStrip
29
+ private var mHybridData: HybridData = initHybrid()
30
+
31
+ init {
32
+ super.updateNative(mHybridData)
33
+ }
34
+
35
+ override fun updateNative(hybridData: HybridData) {
36
+ mHybridData = hybridData
37
+ super.updateNative(hybridData)
38
+ }
39
+
40
+ // Default implementation of `HybridObject.toString()`
41
+ override fun toString(): String {
42
+ return "[HybridObject NitroLocationTracking]"
43
+ }
44
+
45
+ // Properties
46
+
47
+
48
+ // Methods
49
+ @DoNotStrip
50
+ @Keep
51
+ abstract fun configure(config: LocationConfig): Unit
52
+
53
+ @DoNotStrip
54
+ @Keep
55
+ abstract fun startTracking(): Unit
56
+
57
+ @DoNotStrip
58
+ @Keep
59
+ abstract fun stopTracking(): Unit
60
+
61
+ @DoNotStrip
62
+ @Keep
63
+ abstract fun getCurrentLocation(): Promise<LocationData>
64
+
65
+ @DoNotStrip
66
+ @Keep
67
+ abstract fun isTracking(): Boolean
68
+
69
+ abstract fun onLocation(callback: (location: LocationData) -> Unit): Unit
70
+
71
+ @DoNotStrip
72
+ @Keep
73
+ private fun onLocation_cxx(callback: Func_void_LocationData): Unit {
74
+ val __result = onLocation(callback)
75
+ return __result
76
+ }
77
+
78
+ abstract fun onMotionChange(callback: (isMoving: Boolean) -> Unit): Unit
79
+
80
+ @DoNotStrip
81
+ @Keep
82
+ private fun onMotionChange_cxx(callback: Func_void_bool): Unit {
83
+ val __result = onMotionChange(callback)
84
+ return __result
85
+ }
86
+
87
+ @DoNotStrip
88
+ @Keep
89
+ abstract fun configureConnection(config: ConnectionConfig): Unit
90
+
91
+ @DoNotStrip
92
+ @Keep
93
+ abstract fun connectWebSocket(): Unit
94
+
95
+ @DoNotStrip
96
+ @Keep
97
+ abstract fun disconnectWebSocket(): Unit
98
+
99
+ @DoNotStrip
100
+ @Keep
101
+ abstract fun sendMessage(message: String): Unit
102
+
103
+ @DoNotStrip
104
+ @Keep
105
+ abstract fun getConnectionState(): ConnectionState
106
+
107
+ abstract fun onConnectionStateChange(callback: (state: ConnectionState) -> Unit): Unit
108
+
109
+ @DoNotStrip
110
+ @Keep
111
+ private fun onConnectionStateChange_cxx(callback: Func_void_ConnectionState): Unit {
112
+ val __result = onConnectionStateChange(callback)
113
+ return __result
114
+ }
115
+
116
+ abstract fun onMessage(callback: (message: String) -> Unit): Unit
117
+
118
+ @DoNotStrip
119
+ @Keep
120
+ private fun onMessage_cxx(callback: Func_void_std__string): Unit {
121
+ val __result = onMessage(callback)
122
+ return __result
123
+ }
124
+
125
+ @DoNotStrip
126
+ @Keep
127
+ abstract fun forceSync(): Promise<Boolean>
128
+
129
+ @DoNotStrip
130
+ @Keep
131
+ abstract fun showLocalNotification(title: String, body: String): Unit
132
+
133
+ @DoNotStrip
134
+ @Keep
135
+ abstract fun updateForegroundNotification(title: String, body: String): Unit
136
+
137
+ @DoNotStrip
138
+ @Keep
139
+ abstract fun destroy(): Unit
140
+
141
+ private external fun initHybrid(): HybridData
142
+
143
+ companion object {
144
+ protected const val TAG = "HybridNitroLocationTrackingSpec"
145
+ }
146
+ }
@@ -0,0 +1,62 @@
1
+ ///
2
+ /// LocationConfig.kt
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
+ package com.margelo.nitro.nitrolocationtracking
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "LocationConfig".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class LocationConfig(
20
+ @DoNotStrip
21
+ @Keep
22
+ val desiredAccuracy: AccuracyLevel,
23
+ @DoNotStrip
24
+ @Keep
25
+ val distanceFilter: Double,
26
+ @DoNotStrip
27
+ @Keep
28
+ val intervalMs: Double,
29
+ @DoNotStrip
30
+ @Keep
31
+ val fastestIntervalMs: Double,
32
+ @DoNotStrip
33
+ @Keep
34
+ val stopTimeout: Double,
35
+ @DoNotStrip
36
+ @Keep
37
+ val stopOnTerminate: Boolean,
38
+ @DoNotStrip
39
+ @Keep
40
+ val startOnBoot: Boolean,
41
+ @DoNotStrip
42
+ @Keep
43
+ val foregroundNotificationTitle: String,
44
+ @DoNotStrip
45
+ @Keep
46
+ val foregroundNotificationText: String
47
+ ) {
48
+ /* primary constructor */
49
+
50
+ companion object {
51
+ /**
52
+ * Constructor called from C++
53
+ */
54
+ @DoNotStrip
55
+ @Keep
56
+ @Suppress("unused")
57
+ @JvmStatic
58
+ private fun fromCpp(desiredAccuracy: AccuracyLevel, distanceFilter: Double, intervalMs: Double, fastestIntervalMs: Double, stopTimeout: Double, stopOnTerminate: Boolean, startOnBoot: Boolean, foregroundNotificationTitle: String, foregroundNotificationText: String): LocationConfig {
59
+ return LocationConfig(desiredAccuracy, distanceFilter, intervalMs, fastestIntervalMs, stopTimeout, stopOnTerminate, startOnBoot, foregroundNotificationTitle, foregroundNotificationText)
60
+ }
61
+ }
62
+ }
@@ -0,0 +1,56 @@
1
+ ///
2
+ /// LocationData.kt
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
+ package com.margelo.nitro.nitrolocationtracking
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "LocationData".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class LocationData(
20
+ @DoNotStrip
21
+ @Keep
22
+ val latitude: Double,
23
+ @DoNotStrip
24
+ @Keep
25
+ val longitude: Double,
26
+ @DoNotStrip
27
+ @Keep
28
+ val altitude: Double,
29
+ @DoNotStrip
30
+ @Keep
31
+ val speed: Double,
32
+ @DoNotStrip
33
+ @Keep
34
+ val bearing: Double,
35
+ @DoNotStrip
36
+ @Keep
37
+ val accuracy: Double,
38
+ @DoNotStrip
39
+ @Keep
40
+ val timestamp: Double
41
+ ) {
42
+ /* primary constructor */
43
+
44
+ companion object {
45
+ /**
46
+ * Constructor called from C++
47
+ */
48
+ @DoNotStrip
49
+ @Keep
50
+ @Suppress("unused")
51
+ @JvmStatic
52
+ private fun fromCpp(latitude: Double, longitude: Double, altitude: Double, speed: Double, bearing: Double, accuracy: Double, timestamp: Double): LocationData {
53
+ return LocationData(latitude, longitude, altitude, speed, bearing, accuracy, timestamp)
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,35 @@
1
+ ///
2
+ /// nitrolocationtrackingOnLoad.kt
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
+ package com.margelo.nitro.nitrolocationtracking
9
+
10
+ import android.util.Log
11
+
12
+ internal class nitrolocationtrackingOnLoad {
13
+ companion object {
14
+ private const val TAG = "nitrolocationtrackingOnLoad"
15
+ private var didLoad = false
16
+ /**
17
+ * Initializes the native part of "nitrolocationtracking".
18
+ * This method is idempotent and can be called more than once.
19
+ */
20
+ @JvmStatic
21
+ fun initializeNative() {
22
+ if (didLoad) return
23
+ try {
24
+ Log.i(TAG, "Loading nitrolocationtracking C++ library...")
25
+ System.loadLibrary("nitrolocationtracking")
26
+ Log.i(TAG, "Successfully loaded nitrolocationtracking C++ library!")
27
+ didLoad = true
28
+ } catch (e: Error) {
29
+ Log.e(TAG, "Failed to load nitrolocationtracking C++ library! Is it properly installed and linked? " +
30
+ "Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
31
+ throw e
32
+ }
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,81 @@
1
+ #
2
+ # nitrolocationtracking+autolinking.cmake
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
+ # This is a CMake file that adds all files generated by Nitrogen
9
+ # to the current CMake project.
10
+ #
11
+ # To use it, add this to your CMakeLists.txt:
12
+ # ```cmake
13
+ # include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/nitrolocationtracking+autolinking.cmake)
14
+ # ```
15
+
16
+ # Define a flag to check if we are building properly
17
+ add_definitions(-DBUILDING_NITROLOCATIONTRACKING_WITH_GENERATED_CMAKE_PROJECT)
18
+
19
+ # Enable Raw Props parsing in react-native (for Nitro Views)
20
+ add_definitions(-DRN_SERIALIZABLE_STATE)
21
+
22
+ # Add all headers that were generated by Nitrogen
23
+ include_directories(
24
+ "../nitrogen/generated/shared/c++"
25
+ "../nitrogen/generated/android/c++"
26
+ "../nitrogen/generated/android/"
27
+ )
28
+
29
+ # Add all .cpp sources that were generated by Nitrogen
30
+ target_sources(
31
+ # CMake project name (Android C++ library name)
32
+ nitrolocationtracking PRIVATE
33
+ # Autolinking Setup
34
+ ../nitrogen/generated/android/nitrolocationtrackingOnLoad.cpp
35
+ # Shared Nitrogen C++ sources
36
+ ../nitrogen/generated/shared/c++/HybridNitroLocationTrackingSpec.cpp
37
+ # Android-specific Nitrogen C++ sources
38
+ ../nitrogen/generated/android/c++/JHybridNitroLocationTrackingSpec.cpp
39
+ )
40
+
41
+ # From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
42
+ # Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
43
+ target_compile_definitions(
44
+ nitrolocationtracking PRIVATE
45
+ -DFOLLY_NO_CONFIG=1
46
+ -DFOLLY_HAVE_CLOCK_GETTIME=1
47
+ -DFOLLY_USE_LIBCPP=1
48
+ -DFOLLY_CFG_NO_COROUTINES=1
49
+ -DFOLLY_MOBILE=1
50
+ -DFOLLY_HAVE_RECVMMSG=1
51
+ -DFOLLY_HAVE_PTHREAD=1
52
+ # Once we target android-23 above, we can comment
53
+ # the following line. NDK uses GNU style stderror_r() after API 23.
54
+ -DFOLLY_HAVE_XSI_STRERROR_R=1
55
+ )
56
+
57
+ # Add all libraries required by the generated specs
58
+ find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
59
+ find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
60
+ find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
61
+
62
+ # Link all libraries together
63
+ target_link_libraries(
64
+ nitrolocationtracking
65
+ fbjni::fbjni # <-- Facebook C++ JNI helpers
66
+ ReactAndroid::jsi # <-- RN: JSI
67
+ react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
68
+ )
69
+
70
+ # Link react-native (different prefab between RN 0.75 and RN 0.76)
71
+ if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
72
+ target_link_libraries(
73
+ nitrolocationtracking
74
+ ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
75
+ )
76
+ else()
77
+ target_link_libraries(
78
+ nitrolocationtracking
79
+ ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
80
+ )
81
+ endif()
@@ -0,0 +1,27 @@
1
+ ///
2
+ /// nitrolocationtracking+autolinking.gradle
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
+ /// This is a Gradle file that adds all files generated by Nitrogen
9
+ /// to the current Gradle project.
10
+ ///
11
+ /// To use it, add this to your build.gradle:
12
+ /// ```gradle
13
+ /// apply from: '../nitrogen/generated/android/nitrolocationtracking+autolinking.gradle'
14
+ /// ```
15
+
16
+ logger.warn("[NitroModules] 🔥 nitrolocationtracking is boosted by nitro!")
17
+
18
+ android {
19
+ sourceSets {
20
+ main {
21
+ java.srcDirs += [
22
+ // Nitrogen files
23
+ "${project.projectDir}/../nitrogen/generated/android/kotlin"
24
+ ]
25
+ }
26
+ }
27
+ }