spotny-sdk 1.0.37 → 1.0.39
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.
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
|
|
10
10
|
<!-- Location is required for beacon scanning on API < 31 -->
|
|
11
11
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
12
|
-
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
|
13
12
|
<!-- Background location required for background scanning -->
|
|
14
13
|
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
|
15
14
|
|
|
@@ -4,7 +4,7 @@ import android.app.NotificationChannel
|
|
|
4
4
|
import android.app.NotificationManager
|
|
5
5
|
import android.content.Context
|
|
6
6
|
import android.os.Build
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
import android.util.Log
|
|
9
9
|
import androidx.core.app.NotificationCompat
|
|
10
10
|
import com.facebook.react.bridge.*
|
|
@@ -163,13 +163,11 @@ class SpotnySdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
override fun stopScanner(promise: Promise) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
beaconManager.stopMonitoringBeaconsInRegion(region)
|
|
172
|
-
} catch (_: RemoteException) {}
|
|
166
|
+
beaconManager.removeAllMonitorNotifiers()
|
|
167
|
+
beaconManager.removeAllRangeNotifiers()
|
|
168
|
+
val region = Region("SpotnySDK_General", Identifier.parse(BEACON_UUID), null, null)
|
|
169
|
+
beaconManager.stopRangingBeacons(region)
|
|
170
|
+
beaconManager.stopMonitoring(region)
|
|
173
171
|
|
|
174
172
|
cleanupAllState()
|
|
175
173
|
|
|
@@ -270,6 +268,9 @@ class SpotnySdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
270
268
|
}
|
|
271
269
|
|
|
272
270
|
override fun clearDebounceCache(promise: Promise) {
|
|
271
|
+
lastProximityEventSent.clear()
|
|
272
|
+
lastImpressionEventSent.clear()
|
|
273
|
+
lastProximityDistance.clear()
|
|
273
274
|
promise.resolve("Debounce cache cleared")
|
|
274
275
|
}
|
|
275
276
|
|
|
@@ -297,8 +298,8 @@ class SpotnySdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
297
298
|
beaconManager.addRangeNotifier(rangeNotifier)
|
|
298
299
|
beaconManager.addMonitorNotifier(monitorNotifier)
|
|
299
300
|
|
|
300
|
-
beaconManager.
|
|
301
|
-
beaconManager.
|
|
301
|
+
beaconManager.startRangingBeacons(region)
|
|
302
|
+
beaconManager.startMonitoring(region)
|
|
302
303
|
|
|
303
304
|
Log.d(TAG, "Scanning for UUID $BEACON_UUID")
|
|
304
305
|
}
|
|
@@ -437,7 +438,7 @@ class SpotnySdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
437
438
|
putString("event", "enter")
|
|
438
439
|
}
|
|
439
440
|
sendEvent("onBeaconRegionEvent", payload)
|
|
440
|
-
|
|
441
|
+
beaconManager.startRangingBeacons(region)
|
|
441
442
|
}
|
|
442
443
|
|
|
443
444
|
override fun didExitRegion(region: Region) {
|
|
@@ -449,7 +450,7 @@ class SpotnySdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
449
450
|
sendEvent("onBeaconRegionEvent", payload)
|
|
450
451
|
// FIX #3: delegate to cleanupAllState which now uses lastProximityEventSent
|
|
451
452
|
cleanupAllState()
|
|
452
|
-
|
|
453
|
+
beaconManager.stopRangingBeacons(region)
|
|
453
454
|
}
|
|
454
455
|
|
|
455
456
|
override fun didDetermineStateForRegion(state: Int, region: Region) {
|