Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix : step counter module backward compatibility #36

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"@react-native-community/eslint-config": "^3.2.0",
"@react-native-community/eslint-plugin": "^1.3.0",
"@react-native/metro-config": "^0.72.0",
"@release-it/conventional-changelog": "^7.0.0",
"@release-it/conventional-changelog": "^7.0.2",
"@rnx-kit/align-deps": "^2.2.4",
"@types/jest": "^29.5.3",
"@types/react": "18.2.20",
Expand Down
Loading