Reverse condition for code clarity with `ChecksSdkIntAtLeast`
This commit is contained in:
parent
0910b118ff
commit
5886245bbf
|
@ -33,18 +33,18 @@ class VoiceRecorderProvider @Inject constructor(
|
||||||
private val buildVersionSdkIntProvider: BuildVersionSdkIntProvider,
|
private val buildVersionSdkIntProvider: BuildVersionSdkIntProvider,
|
||||||
) {
|
) {
|
||||||
fun provideVoiceRecorder(): VoiceRecorder {
|
fun provideVoiceRecorder(): VoiceRecorder {
|
||||||
return if (useFallbackRecorder()) {
|
return if (useNativeRecorder()) {
|
||||||
VoiceRecorderL(context, Dispatchers.IO)
|
|
||||||
} else {
|
|
||||||
VoiceRecorderQ(context)
|
VoiceRecorderQ(context)
|
||||||
|
} else {
|
||||||
|
VoiceRecorderL(context, Dispatchers.IO)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ChecksSdkIntAtLeast(api = 29)
|
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.Q)
|
||||||
private fun useFallbackRecorder(): Boolean {
|
private fun useNativeRecorder(): Boolean {
|
||||||
return buildVersionSdkIntProvider.get() < Build.VERSION_CODES.Q ||
|
return buildVersionSdkIntProvider.get() >= Build.VERSION_CODES.Q &&
|
||||||
!hasOpusEncoder() ||
|
hasOpusEncoder() &&
|
||||||
vectorFeatures.forceUsageOfOpusEncoder()
|
!vectorFeatures.forceUsageOfOpusEncoder()
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
|
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
|
||||||
|
|
Loading…
Reference in New Issue