Skip to content

Commit

Permalink
fix: step counter module backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriciolcs committed Oct 4, 2023
1 parent 73b9694 commit e114df6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions android/src/main/java/com/stepcounter/StepCounterModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class StepCounterModule internal constructor(context: ReactApplicationContext) :
* @see VERSION_CODES.KITKAT
* @see WritableMap
*/
@ReactMethod
override fun isStepCountingSupported(promise: Promise) {
Log.d(TAG_NAME, "hardware_step_counter? $supported")
Log.d(TAG_NAME, "step_counter granted? $stepsOK")
Expand All @@ -98,6 +99,7 @@ class StepCounterModule internal constructor(context: ReactApplicationContext) :
* Start the step counter sensor.
* @param from the number of steps to start from
*/
@ReactMethod
override fun startStepCounterUpdate(from: Double) {
stepCounterListener = stepCounterListener ?: if (stepsOK) {
StepCounterService(this, sensorManager)
Expand All @@ -112,6 +114,7 @@ class StepCounterModule internal constructor(context: ReactApplicationContext) :
* Stop the step counter sensor.
* @return Nothing.
*/
@ReactMethod
override fun stopStepCounterUpdate() {
Log.d(TAG_NAME, "stopStepCounterUpdate")
stepCounterListener!!.stopService()
Expand All @@ -121,13 +124,15 @@ class StepCounterModule internal constructor(context: ReactApplicationContext) :
* Keep: Required for RN built in Event Emitter Support.
* @param eventName the name of the event. usually "stepCounterUpdate".
*/
@ReactMethod
override fun addListener(eventName: String) {}

/**
* Keep: Required for RN built in Event Emitter Support.
* @param count the number of listeners to remove.
* not implemented.
*/
@ReactMethod
override fun removeListeners(count: Double) {}

/**
Expand Down

0 comments on commit e114df6

Please sign in to comment.