ReviewOS

also looking at this

craft-native/craft

feat(android): the motion pair, and org.json's numbers — ratchet 54 → 52

#187
Merged glennmichael123 wants to merge feat/android-motion into main
7 files +577 -3
packages/android/templates/CraftBridge.kt.templatemodified+7-0
Changes to packages/android/templates/CraftBridge.kt.template
@@ -2866,6 +2866,11 @@ class CraftBridge(
28662866
28672867 @JavascriptInterface
28682868 fun startMotionUpdates(intervalMs: Int): Boolean {
2869 // The SensorEventListener object is CraftNative's, and so is the
2870 // last-value bookkeeping — which is why stopMotionUpdates has to reach
2871 // the same way, or its own fields stay null and nothing unregisters.
2872 if (CraftNative.startMotionUpdates(activity, intervalMs)) return true
2873
28692874 sensorManager = activity.getSystemService(Context.SENSOR_SERVICE) as SensorManager
28702875 accelerometer = sensorManager?.getDefaultSensor(Sensor.TYPE_ACCELEROMETER)
28712876 gyroscope = sensorManager?.getDefaultSensor(Sensor.TYPE_GYROSCOPE)
@@ -2907,6 +2912,8 @@ class CraftBridge(
29072912
29082913 @JavascriptInterface
29092914 fun stopMotionUpdates() {
2915 if (CraftNative.stopMotionUpdates(activity)) return
2916
29102917 sensorListener?.let { sensorManager?.unregisterListener(it) }
29112918 sensorListener = null
29122919 }