Skip to content
This repository was archived by the owner on May 6, 2022. It is now read-only.

Commit b127e05

Browse files
committed
fix(android): check if paused before resuming in start()
- spokestack-android will also add this check, but we'll add here so it works with older versions.
1 parent f77f1a9 commit b127e05

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

android/src/main/java/com/reactnativespokestack/SpokestackModule.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class SpokestackModule(private val reactContext: ReactApplicationContext): React
102102

103103
private fun kebabCase(str: String): String {
104104
return str.replace(Regex("([a-z])([A-Z])")) {
105-
m -> "${m.groupValues[1]}-${m.groupValues[2].toLowerCase()}"
105+
m -> "${m.groupValues[1]}-${m.groupValues[2].toLowerCase()}"
106106
}
107107
}
108108

@@ -319,8 +319,12 @@ class SpokestackModule(private val reactContext: ReactApplicationContext): React
319319
return
320320
}
321321
try {
322-
spokestack!!.start()
323-
spokestack!!.resume()
322+
if (!started()) {
323+
spokestack!!.start()
324+
}
325+
if (spokestack!!.speechPipeline.isPaused) {
326+
spokestack!!.resume()
327+
}
324328
promise.resolve(null)
325329

326330
// Send a start event for parity with iOS

0 commit comments

Comments
 (0)