react-native-nitro-location-tracking 0.1.11 → 0.1.12

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.
@@ -0,0 +1,145 @@
1
+ package com.margelo.nitro.nitrolocationtracking
2
+
3
+ import android.annotation.SuppressLint
4
+ import android.app.AppOpsManager
5
+ import android.content.Context
6
+ import android.os.Build
7
+ import android.os.Handler
8
+ import android.os.Looper
9
+ import android.provider.Settings
10
+ import android.util.Log
11
+
12
+ /**
13
+ * Periodically polls whether a mock/fake GPS provider is active on the device.
14
+ * This works independently of location tracking — it detects the presence of
15
+ * mock location apps (e.g. Fake GPS, Mock Locations) at the system level.
16
+ *
17
+ * On each poll it checks:
18
+ * - Pre-API 23: Settings.Secure.ALLOW_MOCK_LOCATION
19
+ * - API 23+: AppOpsManager OP_MOCK_LOCATION (op code 58)
20
+ * - Also checks all installed packages for mock location permission
21
+ *
22
+ * The callback fires only when the state changes (deduplicated).
23
+ */
24
+ class MockLocationMonitor(private val context: Context) {
25
+
26
+ companion object {
27
+ private const val TAG = "MockLocationMonitor"
28
+ /** Default poll interval in milliseconds */
29
+ private const val DEFAULT_POLL_INTERVAL_MS = 3000L
30
+ }
31
+
32
+ private val mainHandler = Handler(Looper.getMainLooper())
33
+ private var callback: ((Boolean) -> Unit)? = null
34
+ private var lastState: Boolean? = null
35
+ private var polling = false
36
+ private var pollIntervalMs = DEFAULT_POLL_INTERVAL_MS
37
+
38
+ private val pollRunnable = object : Runnable {
39
+ override fun run() {
40
+ if (!polling) return
41
+ checkAndNotify()
42
+ mainHandler.postDelayed(this, pollIntervalMs)
43
+ }
44
+ }
45
+
46
+ fun setCallback(callback: (Boolean) -> Unit) {
47
+ this.callback = callback
48
+ // Emit current state immediately
49
+ val current = isMockLocationActive()
50
+ lastState = current
51
+ callback.invoke(current)
52
+ // Start polling
53
+ startPolling()
54
+ }
55
+
56
+ fun startPolling() {
57
+ if (polling) return
58
+ polling = true
59
+ mainHandler.postDelayed(pollRunnable, pollIntervalMs)
60
+ Log.d(TAG, "Mock location polling started (interval=${pollIntervalMs}ms)")
61
+ }
62
+
63
+ fun stopPolling() {
64
+ polling = false
65
+ mainHandler.removeCallbacks(pollRunnable)
66
+ Log.d(TAG, "Mock location polling stopped")
67
+ }
68
+
69
+ private fun checkAndNotify() {
70
+ val current = isMockLocationActive()
71
+ if (current != lastState) {
72
+ lastState = current
73
+ Log.d(TAG, "Mock location state changed: isMockEnabled=$current")
74
+ callback?.invoke(current)
75
+ }
76
+ }
77
+
78
+ /**
79
+ * Comprehensive check for mock location activity on the device.
80
+ */
81
+ @SuppressLint("DiscouragedPrivateApi")
82
+ fun isMockLocationActive(): Boolean {
83
+ // Pre-API 23: check the global mock location setting
84
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
85
+ @Suppress("DEPRECATION")
86
+ val mockSetting = Settings.Secure.getString(
87
+ context.contentResolver,
88
+ Settings.Secure.ALLOW_MOCK_LOCATION
89
+ )
90
+ return mockSetting == "1"
91
+ }
92
+
93
+ // API 23+: check if any app holds MOCK_LOCATION permission via AppOpsManager
94
+ try {
95
+ val appOps = context.getSystemService(Context.APP_OPS_SERVICE) as AppOpsManager
96
+ val opMockLocation = 58 // OP_MOCK_LOCATION
97
+ val method = AppOpsManager::class.java.getMethod(
98
+ "checkOp",
99
+ Int::class.javaPrimitiveType,
100
+ Int::class.javaPrimitiveType,
101
+ String::class.java
102
+ )
103
+ val result = method.invoke(
104
+ appOps, opMockLocation, android.os.Process.myUid(), context.packageName
105
+ ) as Int
106
+ if (result == AppOpsManager.MODE_ALLOWED) return true
107
+ } catch (e: Exception) {
108
+ Log.w(TAG, "Could not check mock location app ops: ${e.message}")
109
+ }
110
+
111
+ // Additional check: scan installed packages for known mock location apps
112
+ try {
113
+ val pm = context.packageManager
114
+ val knownMockApps = listOf(
115
+ "com.lexa.fakegps",
116
+ "com.incorporateapps.fakegps.fre",
117
+ "com.fakegps.mock",
118
+ "com.lkr.fakegps",
119
+ "com.fake.gps.go.location.spoofer.free",
120
+ "com.theappninjas.gpsjoystick",
121
+ "com.evezzon.fgl",
122
+ "com.mock.location"
123
+ )
124
+ for (pkg in knownMockApps) {
125
+ try {
126
+ pm.getApplicationInfo(pkg, 0)
127
+ Log.d(TAG, "Known mock location app detected: $pkg")
128
+ return true
129
+ } catch (_: Exception) {
130
+ // Not installed
131
+ }
132
+ }
133
+ } catch (e: Exception) {
134
+ Log.w(TAG, "Could not check for mock location apps: ${e.message}")
135
+ }
136
+
137
+ return false
138
+ }
139
+
140
+ fun destroy() {
141
+ stopPolling()
142
+ callback = null
143
+ lastState = null
144
+ }
145
+ }
@@ -27,6 +27,7 @@ class NitroLocationTracking : HybridNitroLocationTrackingSpec() {
27
27
  private var geofenceManager: GeofenceManager? = null
28
28
  private var providerStatusMonitor: ProviderStatusMonitor? = null
29
29
  private var permissionStatusMonitor: PermissionStatusMonitor? = null
30
+ private var mockLocationMonitor: MockLocationMonitor? = null
30
31
 
31
32
  private var locationCallback: ((LocationData) -> Unit)? = null
32
33
  private var motionCallback: ((Boolean) -> Unit)? = null
@@ -36,6 +37,7 @@ class NitroLocationTracking : HybridNitroLocationTrackingSpec() {
36
37
  private var speedAlertCallback: ((SpeedAlertType, Double) -> Unit)? = null
37
38
  private var providerStatusCallback: ((LocationProviderStatus, LocationProviderStatus) -> Unit)? = null
38
39
  private var permissionStatusCallback: ((PermissionStatus) -> Unit)? = null
40
+ private var mockLocationCallback: ((Boolean) -> Unit)? = null
39
41
 
40
42
  private var locationConfig: LocationConfig? = null
41
43
 
@@ -53,6 +55,7 @@ class NitroLocationTracking : HybridNitroLocationTrackingSpec() {
53
55
  geofenceManager = GeofenceManager(context)
54
56
  providerStatusMonitor = ProviderStatusMonitor(context)
55
57
  permissionStatusMonitor = PermissionStatusMonitor(context)
58
+ mockLocationMonitor = MockLocationMonitor(context)
56
59
  locationEngine?.dbWriter = dbWriter
57
60
  connectionManager.dbWriter = dbWriter
58
61
  Log.d(TAG, "Components initialized successfully")
@@ -186,6 +189,12 @@ class NitroLocationTracking : HybridNitroLocationTrackingSpec() {
186
189
  locationEngine?.rejectMockLocations = reject
187
190
  }
188
191
 
192
+ override fun onMockLocationDetected(callback: (isMockEnabled: Boolean) -> Unit) {
193
+ mockLocationCallback = callback
194
+ ensureInitialized()
195
+ mockLocationMonitor?.setCallback(callback)
196
+ }
197
+
189
198
  // === Geofencing ===
190
199
 
191
200
  override fun addGeofence(region: GeofenceRegion) {
@@ -389,5 +398,6 @@ class NitroLocationTracking : HybridNitroLocationTrackingSpec() {
389
398
  geofenceManager?.destroy()
390
399
  providerStatusMonitor?.destroy()
391
400
  permissionStatusMonitor?.destroy()
401
+ mockLocationMonitor?.destroy()
392
402
  }
393
403
  }
@@ -0,0 +1,120 @@
1
+ import Foundation
2
+ import CoreLocation
3
+
4
+ /// Periodically checks whether the device is using simulated/mock locations.
5
+ /// Works independently of location tracking — fires the callback when the state changes.
6
+ ///
7
+ /// Detection methods:
8
+ /// - iOS 15+: Uses CLLocation.sourceInformation.isSimulatedBySoftware on a one-shot location request
9
+ /// - Simulator: Compile-time detection via #targetEnvironment(simulator)
10
+ /// - Jailbreak indicators: Checks for known mock location tool files
11
+ class MockLocationMonitor: NSObject, CLLocationManagerDelegate {
12
+
13
+ private let locationManager = CLLocationManager()
14
+ private var callback: ((Bool) -> Void)?
15
+ private var lastState: Bool?
16
+ private var pollTimer: Timer?
17
+ private let pollInterval: TimeInterval = 3.0
18
+
19
+ override init() {
20
+ super.init()
21
+ locationManager.delegate = self
22
+ locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters
23
+ }
24
+
25
+ func setCallback(_ callback: @escaping (Bool) -> Void) {
26
+ self.callback = callback
27
+
28
+ // Emit current state immediately
29
+ let current = checkMockLocationSync()
30
+ lastState = current
31
+ callback(current)
32
+
33
+ // Start periodic polling
34
+ startPolling()
35
+ }
36
+
37
+ private func startPolling() {
38
+ stopPolling()
39
+ pollTimer = Timer.scheduledTimer(withTimeInterval: pollInterval, repeats: true) { [weak self] _ in
40
+ self?.performCheck()
41
+ }
42
+ }
43
+
44
+ private func stopPolling() {
45
+ pollTimer?.invalidate()
46
+ pollTimer = nil
47
+ }
48
+
49
+ private func performCheck() {
50
+ // First check compile-time and file-system indicators
51
+ let syncResult = checkMockLocationSync()
52
+ if syncResult != lastState {
53
+ lastState = syncResult
54
+ callback?(syncResult)
55
+ return
56
+ }
57
+
58
+ // On iOS 15+, also do a one-shot location check for runtime detection
59
+ if #available(iOS 15.0, *) {
60
+ let status = CLLocationManager.authorizationStatus()
61
+ if status == .authorizedAlways || status == .authorizedWhenInUse {
62
+ locationManager.requestLocation()
63
+ }
64
+ }
65
+ }
66
+
67
+ // MARK: - Synchronous checks (no location needed)
68
+
69
+ private func checkMockLocationSync() -> Bool {
70
+ #if targetEnvironment(simulator)
71
+ return true
72
+ #else
73
+ // Check for common jailbreak/mock location indicators
74
+ let suspiciousPaths = [
75
+ "/Applications/Cydia.app",
76
+ "/Library/MobileSubstrate/MobileSubstrate.dylib",
77
+ "/usr/sbin/sshd",
78
+ "/etc/apt",
79
+ "/private/var/lib/apt/",
80
+ "/Applications/LocationFaker.app",
81
+ "/Applications/LocationHandle.app",
82
+ "/Applications/LocationChanger.app"
83
+ ]
84
+
85
+ for path in suspiciousPaths {
86
+ if FileManager.default.fileExists(atPath: path) {
87
+ return true
88
+ }
89
+ }
90
+
91
+ return false
92
+ #endif
93
+ }
94
+
95
+ // MARK: - CLLocationManagerDelegate (for iOS 15+ runtime detection)
96
+
97
+ func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
98
+ guard let location = locations.last else { return }
99
+
100
+ if #available(iOS 15.0, *) {
101
+ if let sourceInfo = location.sourceInformation {
102
+ let isMock = sourceInfo.isSimulatedBySoftware
103
+ if isMock != lastState {
104
+ lastState = isMock
105
+ callback?(isMock)
106
+ }
107
+ }
108
+ }
109
+ }
110
+
111
+ func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
112
+ // Silently ignore — this is a best-effort check
113
+ }
114
+
115
+ func destroy() {
116
+ stopPolling()
117
+ callback = nil
118
+ lastState = nil
119
+ }
120
+ }
@@ -8,6 +8,7 @@ class NitroLocationTracking: HybridNitroLocationTrackingSpec {
8
8
  private let dbWriter = NativeDBWriter()
9
9
  private let notificationService = NotificationService()
10
10
  private let geofenceManager = GeofenceManager()
11
+ private let mockLocationMonitor = MockLocationMonitor()
11
12
 
12
13
  private var locationCallback: ((LocationData) -> Void)?
13
14
  private var motionCallback: ((Bool) -> Void)?
@@ -17,6 +18,7 @@ class NitroLocationTracking: HybridNitroLocationTrackingSpec {
17
18
  private var speedAlertCallback: ((SpeedAlertType, Double) -> Void)?
18
19
  private var providerStatusCallback: ((LocationProviderStatus, LocationProviderStatus) -> Void)?
19
20
  private var permissionStatusCallback: ((PermissionStatus) -> Void)?
21
+ private var mockLocationCallback: ((Bool) -> Void)?
20
22
  private var permissionPromise: Promise<PermissionStatus>?
21
23
 
22
24
  override init() {
@@ -125,6 +127,11 @@ class NitroLocationTracking: HybridNitroLocationTrackingSpec {
125
127
  locationEngine.rejectMockLocations = reject
126
128
  }
127
129
 
130
+ func onMockLocationDetected(callback: @escaping (Bool) -> Void) throws {
131
+ mockLocationCallback = callback
132
+ mockLocationMonitor.setCallback(callback)
133
+ }
134
+
128
135
  // MARK: - Geofencing
129
136
 
130
137
  func addGeofence(region: GeofenceRegion) throws {
@@ -270,5 +277,6 @@ class NitroLocationTracking: HybridNitroLocationTrackingSpec {
270
277
  locationEngine.stop()
271
278
  connectionManager.disconnect()
272
279
  geofenceManager.destroy()
280
+ mockLocationMonitor.destroy()
273
281
  }
274
282
  }
@@ -1 +1 @@
1
- {"version":3,"names":["useState","useEffect","useCallback","useRef","NitroModules","NitroLocationModule","createHybridObject","requestLocationPermission","LocationSmoother","shortestRotation","calculateBearing","useDriverLocation","config","location","setLocation","isMoving","setIsMoving","isTracking","setIsTracking","configJson","JSON","stringify","trackingRef","parsed","parse","configure","onLocation","onMotionChange","current","stopTracking","startTracking","useRideConnection","connectionState","setConnectionState","lastMessage","setLastMessage","configureConnection","onConnectionStateChange","onMessage","disconnectWebSocket","connect","connectWebSocket","disconnect","send","m","sendMessage"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,SAAS,EAAEC,WAAW,EAAEC,MAAM,QAAQ,OAAO;AAChE,SAASC,YAAY,QAAQ,4BAA4B;AAQzD,MAAMC,mBAAmB,GACvBD,YAAY,CAACE,kBAAkB,CAC7B,uBACF,CAAC;AAEH,eAAeD,mBAAmB;AAClC,SAASE,yBAAyB,QAAQ,wBAAqB;AAC/D,SAASC,gBAAgB,QAAQ,uBAAoB;AACrD,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,cAAW;AAC9D;;AAmBA,OAAO,SAASC,iBAAiBA,CAACC,MAAsB,EAAE;EACxD,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGd,QAAQ,CAAsB,IAAI,CAAC;EACnE,MAAM,CAACe,QAAQ,EAAEC,WAAW,CAAC,GAAGhB,QAAQ,CAAC,KAAK,CAAC;EAC/C,MAAM,CAACiB,UAAU,EAAEC,aAAa,CAAC,GAAGlB,QAAQ,CAAC,KAAK,CAAC;;EAEnD;EACA,MAAMmB,UAAU,GAAGC,IAAI,CAACC,SAAS,CAACT,MAAM,CAAC;;EAEzC;EACA,MAAMU,WAAW,GAAGnB,MAAM,CAAC,KAAK,CAAC;EAEjCF,SAAS,CAAC,MAAM;IACd,MAAMsB,MAAM,GAAGH,IAAI,CAACI,KAAK,CAACL,UAAU,CAAmB;IACvDd,mBAAmB,CAACoB,SAAS,CAACF,MAAM,CAAC;IACrClB,mBAAmB,CAACqB,UAAU,CAACZ,WAAW,CAAC;IAC3CT,mBAAmB,CAACsB,cAAc,CAACX,WAAW,CAAC;IAC/C,OAAO,MAAM;MACX,IAAIM,WAAW,CAACM,OAAO,EAAE;QACvBvB,mBAAmB,CAACw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ACkC,mBAAmB,CAAC,CAAC,EAC/C,EACF,CAAC;IACDI,IAAI,EAAEzC,WAAW,CAAE0C,CAAS,IAAKvC,mBAAmB,CAACwC,WAAW,CAACD,CAAC,CAAC,EAAE,EAAE;EACzE,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["useState","useEffect","useCallback","useRef","NitroModules","NitroLocationModule","createHybridObject","requestLocationPermission","LocationSmoother","shortestRotation","calculateBearing","useDriverLocation","config","location","setLocation","isMoving","setIsMoving","isTracking","setIsTracking","configJson","JSON","stringify","trackingRef","parsed","parse","configure","onLocation","onMotionChange","current","stopTracking","startTracking","useRideConnection","connectionState","setConnectionState","lastMessage","setLastMessage","configureConnection","onConnectionStateChange","onMessage","disconnectWebSocket","connect","connectWebSocket","disconnect","send","m","sendMessage"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,SAAS,EAAEC,WAAW,EAAEC,MAAM,QAAQ,OAAO;AAChE,SAASC,YAAY,QAAQ,4BAA4B;AAQzD,MAAMC,mBAAmB,GACvBD,YAAY,CAACE,kBAAkB,CAC7B,uBACF,CAAC;AAEH,eAAeD,mBAAmB;AAClC,SAASE,yBAAyB,QAAQ,wBAAqB;AAC/D,SAASC,gBAAgB,QAAQ,uBAAoB;AACrD,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,cAAW;AAC9D;;AAoBA,OAAO,SAASC,iBAAiBA,CAACC,MAAsB,EAAE;EACxD,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGd,QAAQ,CAAsB,IAAI,CAAC;EACnE,MAAM,CAACe,QAAQ,EAAEC,WAAW,CAAC,GAAGhB,QAAQ,CAAC,KAAK,CAAC;EAC/C,MAAM,CAACiB,UAAU,EAAEC,aAAa,CAAC,GAAGlB,QAAQ,CAAC,KAAK,CAAC;;EAEnD;EACA,MAAMmB,UAAU,GAAGC,IAAI,CAACC,SAAS,CAACT,MAAM,CAAC;;EAEzC;EACA,MA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C;IAC/D5B,mBAAmB,CAACiC,SAAS,CAACH,cAAc,CAAC;IAC7C,OAAO,MAAM;MACX9B,mBAAmB,CAACkC,mBAAmB,CAAC,CAAC;IAC3C,CAAC;EACH,CAAC,EAAE,CAAC3B,MAAM,CAAC,CAAC;EAEZ,OAAO;IACLoB,eAAe;IACfE,WAAW;IACXM,OAAO,EAAEtC,WAAW,CAAC,MAAMG,mBAAmB,CAACoC,gBAAgB,CAAC,CAAC,EAAE,EAAE,CAAC;IACtEC,UAAU,EAAExC,WAAW,CACrB,MAAMG,mBAAmB,CAACkC,mBAAmB,CAAC,CAAC,EAC/C,EACF,CAAC;IACDI,IAAI,EAAEzC,WAAW,CAAE0C,CAAS,IAAKvC,mBAAmB,CAACwC,WAAW,CAACD,CAAC,CAAC,EAAE,EAAE;EACzE,CAAC;AACH","ignoreList":[]}
@@ -34,6 +34,7 @@ export interface ConnectionConfig {
34
34
  export type LocationCallback = (location: LocationData) => void;
35
35
  export type ConnectionStateCallback = (state: ConnectionState) => void;
36
36
  export type MessageCallback = (message: string) => void;
37
+ export type MockLocationCallback = (isMockEnabled: boolean) => void;
37
38
  export interface GeofenceRegion {
38
39
  id: string;
39
40
  latitude: number;
@@ -83,6 +84,7 @@ export interface NitroLocationTracking extends HybridObject<{
83
84
  forceSync(): Promise<boolean>;
84
85
  isFakeGpsEnabled(): boolean;
85
86
  setRejectMockLocations(reject: boolean): void;
87
+ onMockLocationDetected(callback: MockLocationCallback): void;
86
88
  addGeofence(region: GeofenceRegion): void;
87
89
  removeGeofence(regionId: string): void;
88
90
  removeAllGeofences(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"NitroLocationTracking.nitro.d.ts","sourceRoot":"","sources":["../../../src/NitroLocationTracking.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI/D,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC;AACxD,MAAM,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CAAC;IAGnE,kBAAkB,CAChB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,MAAM,CAAC;IACV,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAGhD,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzD,4BAA4B,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAGhE,OAAO,IAAI,IAAI,CAAC;CACjB"}
@@ -4,7 +4,7 @@ export default NitroLocationModule;
4
4
  export { requestLocationPermission } from './requestPermission';
5
5
  export { LocationSmoother } from './LocationSmoother';
6
6
  export { shortestRotation, calculateBearing } from './bearing';
7
- export type { NitroLocationTracking, LocationData, LocationConfig, ConnectionConfig, GeofenceRegion, GeofenceEvent, GeofenceCallback, SpeedConfig, SpeedAlertType, SpeedAlertCallback, TripStats, LocationProviderStatus, ProviderStatusCallback, PermissionStatus, PermissionStatusCallback, } from './NitroLocationTracking.nitro';
7
+ export type { NitroLocationTracking, LocationData, LocationConfig, ConnectionConfig, GeofenceRegion, GeofenceEvent, GeofenceCallback, SpeedConfig, SpeedAlertType, SpeedAlertCallback, TripStats, LocationProviderStatus, ProviderStatusCallback, PermissionStatus, PermissionStatusCallback, MockLocationCallback, } from './NitroLocationTracking.nitro';
8
8
  export declare function useDriverLocation(config: LocationConfig): {
9
9
  location: LocationData | null;
10
10
  isMoving: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACd,gBAAgB,EACjB,MAAM,+BAA+B,CAAC;AAEvC,QAAA,MAAM,mBAAmB,uBAGtB,CAAC;AAEJ,eAAe,mBAAmB,CAAC;AACnC,OA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;;;;EAuCvD;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB;;;;;cAuBhC,MAAM;EAE/B"}
@@ -205,6 +205,10 @@ namespace margelo::nitro::nitrolocationtracking {
205
205
  static const auto method = javaClassStatic()->getMethod<void(jboolean /* reject */)>("setRejectMockLocations");
206
206
  method(_javaPart, reject);
207
207
  }
208
+ void JHybridNitroLocationTrackingSpec::onMockLocationDetected(const std::function<void(bool /* isMockEnabled */)>& callback) {
209
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_bool::javaobject> /* callback */)>("onMockLocationDetected_cxx");
210
+ method(_javaPart, JFunc_void_bool_cxx::fromCpp(callback));
211
+ }
208
212
  void JHybridNitroLocationTrackingSpec::addGeofence(const GeofenceRegion& region) {
209
213
  static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JGeofenceRegion> /* region */)>("addGeofence");
210
214
  method(_javaPart, JGeofenceRegion::fromCpp(region));
@@ -72,6 +72,7 @@ namespace margelo::nitro::nitrolocationtracking {
72
72
  std::shared_ptr<Promise<bool>> forceSync() override;
73
73
  bool isFakeGpsEnabled() override;
74
74
  void setRejectMockLocations(bool reject) override;
75
+ void onMockLocationDetected(const std::function<void(bool /* isMockEnabled */)>& callback) override;
75
76
  void addGeofence(const GeofenceRegion& region) override;
76
77
  void removeGeofence(const std::string& regionId) override;
77
78
  void removeAllGeofences() override;
@@ -134,6 +134,15 @@ abstract class HybridNitroLocationTrackingSpec: HybridObject() {
134
134
  @Keep
135
135
  abstract fun setRejectMockLocations(reject: Boolean): Unit
136
136
 
137
+ abstract fun onMockLocationDetected(callback: (isMockEnabled: Boolean) -> Unit): Unit
138
+
139
+ @DoNotStrip
140
+ @Keep
141
+ private fun onMockLocationDetected_cxx(callback: Func_void_bool): Unit {
142
+ val __result = onMockLocationDetected(callback)
143
+ return __result
144
+ }
145
+
137
146
  @DoNotStrip
138
147
  @Keep
139
148
  abstract fun addGeofence(region: GeofenceRegion): Unit
@@ -216,6 +216,12 @@ namespace margelo::nitro::nitrolocationtracking {
216
216
  std::rethrow_exception(__result.error());
217
217
  }
218
218
  }
219
+ inline void onMockLocationDetected(const std::function<void(bool /* isMockEnabled */)>& callback) override {
220
+ auto __result = _swiftPart.onMockLocationDetected(callback);
221
+ if (__result.hasError()) [[unlikely]] {
222
+ std::rethrow_exception(__result.error());
223
+ }
224
+ }
219
225
  inline void addGeofence(const GeofenceRegion& region) override {
220
226
  auto __result = _swiftPart.addGeofence(std::forward<decltype(region)>(region));
221
227
  if (__result.hasError()) [[unlikely]] {
@@ -30,6 +30,7 @@ public protocol HybridNitroLocationTrackingSpec_protocol: HybridObject {
30
30
  func forceSync() throws -> Promise<Bool>
31
31
  func isFakeGpsEnabled() throws -> Bool
32
32
  func setRejectMockLocations(reject: Bool) throws -> Void
33
+ func onMockLocationDetected(callback: @escaping (_ isMockEnabled: Bool) -> Void) throws -> Void
33
34
  func addGeofence(region: GeofenceRegion) throws -> Void
34
35
  func removeGeofence(regionId: String) throws -> Void
35
36
  func removeAllGeofences() throws -> Void
@@ -350,6 +350,22 @@ open class HybridNitroLocationTrackingSpec_cxx {
350
350
  }
351
351
  }
352
352
 
353
+ @inline(__always)
354
+ public final func onMockLocationDetected(callback: bridge.Func_void_bool) -> bridge.Result_void_ {
355
+ do {
356
+ try self.__implementation.onMockLocationDetected(callback: { () -> (Bool) -> Void in
357
+ let __wrappedFunction = bridge.wrap_Func_void_bool(callback)
358
+ return { (__isMockEnabled: Bool) -> Void in
359
+ __wrappedFunction.call(__isMockEnabled)
360
+ }
361
+ }())
362
+ return bridge.create_Result_void_()
363
+ } catch (let __error) {
364
+ let __exceptionPtr = __error.toCpp()
365
+ return bridge.create_Result_void_(__exceptionPtr)
366
+ }
367
+ }
368
+
353
369
  @inline(__always)
354
370
  public final func addGeofence(region: GeofenceRegion) -> bridge.Result_void_ {
355
371
  do {
@@ -31,6 +31,7 @@ namespace margelo::nitro::nitrolocationtracking {
31
31
  prototype.registerHybridMethod("forceSync", &HybridNitroLocationTrackingSpec::forceSync);
32
32
  prototype.registerHybridMethod("isFakeGpsEnabled", &HybridNitroLocationTrackingSpec::isFakeGpsEnabled);
33
33
  prototype.registerHybridMethod("setRejectMockLocations", &HybridNitroLocationTrackingSpec::setRejectMockLocations);
34
+ prototype.registerHybridMethod("onMockLocationDetected", &HybridNitroLocationTrackingSpec::onMockLocationDetected);
34
35
  prototype.registerHybridMethod("addGeofence", &HybridNitroLocationTrackingSpec::addGeofence);
35
36
  prototype.registerHybridMethod("removeGeofence", &HybridNitroLocationTrackingSpec::removeGeofence);
36
37
  prototype.registerHybridMethod("removeAllGeofences", &HybridNitroLocationTrackingSpec::removeAllGeofences);
@@ -99,6 +99,7 @@ namespace margelo::nitro::nitrolocationtracking {
99
99
  virtual std::shared_ptr<Promise<bool>> forceSync() = 0;
100
100
  virtual bool isFakeGpsEnabled() = 0;
101
101
  virtual void setRejectMockLocations(bool reject) = 0;
102
+ virtual void onMockLocationDetected(const std::function<void(bool /* isMockEnabled */)>& callback) = 0;
102
103
  virtual void addGeofence(const GeofenceRegion& region) = 0;
103
104
  virtual void removeGeofence(const std::string& regionId) = 0;
104
105
  virtual void removeAllGeofences() = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nitro-location-tracking",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "A React Native Nitro module for location tracking",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -43,6 +43,7 @@ export interface ConnectionConfig {
43
43
  export type LocationCallback = (location: LocationData) => void;
44
44
  export type ConnectionStateCallback = (state: ConnectionState) => void;
45
45
  export type MessageCallback = (message: string) => void;
46
+ export type MockLocationCallback = (isMockEnabled: boolean) => void;
46
47
 
47
48
  export interface GeofenceRegion {
48
49
  id: string;
@@ -121,6 +122,7 @@ export interface NitroLocationTracking
121
122
  // === Fake GPS Detection ===
122
123
  isFakeGpsEnabled(): boolean;
123
124
  setRejectMockLocations(reject: boolean): void;
125
+ onMockLocationDetected(callback: MockLocationCallback): void;
124
126
 
125
127
  // === Geofencing ===
126
128
  addGeofence(region: GeofenceRegion): void;
package/src/index.tsx CHANGED
@@ -33,6 +33,7 @@ export type {
33
33
  ProviderStatusCallback,
34
34
  PermissionStatus,
35
35
  PermissionStatusCallback,
36
+ MockLocationCallback,
36
37
  } from './NitroLocationTracking.nitro';
37
38
 
38
39
  export function useDriverLocation(config: LocationConfig) {