Skip to content

Commit ef22205

Browse files
authored
fix: 0.80 react-native compatibility (#260)
1 parent cab2236 commit ef22205

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

android/src/main/java/com/livekit/reactnative/LivekitReactNativeModule.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import com.oney.WebRTCModule.WebRTCModuleOptions
1818
import org.webrtc.audio.WebRtcAudioTrackHelper
1919
import kotlin.time.Duration.Companion.milliseconds
2020

21+
// NOTE: As of 0.80 react-native new architecture requires all
22+
// @ReactMethod(isBlockingSynchronousMethod = true)
23+
// annotated methods to be non-void.
2124

2225
class LivekitReactNativeModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
2326

@@ -142,9 +145,10 @@ class LivekitReactNativeModule(reactContext: ReactApplicationContext) : ReactCon
142145
}
143146

144147
@ReactMethod(isBlockingSynchronousMethod = true)
145-
fun deleteVolumeProcessor(reactTag: String, pcId: Int, trackId: String) {
148+
fun deleteVolumeProcessor(reactTag: String, pcId: Int, trackId: String): Boolean {
146149
audioSinkManager.detachSinkFromTrack(reactTag, pcId, trackId)
147150
audioSinkManager.unregisterSink(reactTag)
151+
return true
148152
}
149153

150154
@ReactMethod(isBlockingSynchronousMethod = true)
@@ -171,7 +175,7 @@ class LivekitReactNativeModule(reactContext: ReactApplicationContext) : ReactCon
171175
}
172176

173177
@ReactMethod(isBlockingSynchronousMethod = true)
174-
fun deleteMultibandVolumeProcessor(reactTag: String, pcId: Int, trackId: String) {
178+
fun deleteMultibandVolumeProcessor(reactTag: String, pcId: Int, trackId: String): Boolean {
175179
val volumeProcessor =
176180
audioSinkManager.getSink(reactTag) ?: throw IllegalArgumentException("Can't find volume processor for $reactTag")
177181
audioSinkManager.detachSinkFromTrack(volumeProcessor, pcId, trackId)
@@ -182,7 +186,10 @@ class LivekitReactNativeModule(reactContext: ReactApplicationContext) : ReactCon
182186
multibandVolumeProcessor.release()
183187
} else {
184188
Log.w(name, "deleteMultibandVolumeProcessor called, but non-MultibandVolumeProcessor found?!")
189+
return false
185190
}
191+
192+
return true
186193
}
187194

188195
@ReactMethod

0 commit comments

Comments
 (0)