mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 20:06:51 +03:00
Reverse condition for code clarity with ChecksSdkIntAtLeast
This commit is contained in:
parent
0910b118ff
commit
5886245bbf
1 changed files with 8 additions and 8 deletions
|
@ -33,18 +33,18 @@ class VoiceRecorderProvider @Inject constructor(
|
|||
private val buildVersionSdkIntProvider: BuildVersionSdkIntProvider,
|
||||
) {
|
||||
fun provideVoiceRecorder(): VoiceRecorder {
|
||||
return if (useFallbackRecorder()) {
|
||||
VoiceRecorderL(context, Dispatchers.IO)
|
||||
} else {
|
||||
return if (useNativeRecorder()) {
|
||||
VoiceRecorderQ(context)
|
||||
} else {
|
||||
VoiceRecorderL(context, Dispatchers.IO)
|
||||
}
|
||||
}
|
||||
|
||||
@ChecksSdkIntAtLeast(api = 29)
|
||||
private fun useFallbackRecorder(): Boolean {
|
||||
return buildVersionSdkIntProvider.get() < Build.VERSION_CODES.Q ||
|
||||
!hasOpusEncoder() ||
|
||||
vectorFeatures.forceUsageOfOpusEncoder()
|
||||
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.Q)
|
||||
private fun useNativeRecorder(): Boolean {
|
||||
return buildVersionSdkIntProvider.get() >= Build.VERSION_CODES.Q &&
|
||||
hasOpusEncoder() &&
|
||||
!vectorFeatures.forceUsageOfOpusEncoder()
|
||||
}
|
||||
|
||||
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
|
||||
|
|
Loading…
Reference in a new issue