mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 20:38:40 +00:00
Update plugin ktlint to v12.1.0 (#2200)
* Update plugin ktlint to v12.1.0 * Run `./gradlew ktlintFormat` and fix some issues manually. * Fix other issues reproted by Ktlint * Limit false positives, KtLint removes unnecessary curly brace in String templates. * Remove useless Unit * Minor improvements over ktlint changes * Restore `AlertDialogContent` behaviour * Update screenshots --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Benoit Marty <benoit@matrix.org> Co-authored-by: Jorge Martín <jorgem@element.io> Co-authored-by: ElementBot <benoitm+elementbot@element.io>
This commit is contained in:
+1
-2
@@ -104,7 +104,7 @@ class VoiceRecorderImpl @Inject constructor(
|
||||
is Audio.Data -> {
|
||||
val audioLevel = audioLevelCalculator.calculateAudioLevel(audio.buffer)
|
||||
|
||||
lock.withLock{
|
||||
lock.withLock {
|
||||
levels.add(audioLevel)
|
||||
_state.emit(VoiceRecorderState.Recording(elapsedTime, levels.toList()))
|
||||
}
|
||||
@@ -136,7 +136,6 @@ class VoiceRecorderImpl @Inject constructor(
|
||||
audioReader = null
|
||||
encoder.release()
|
||||
|
||||
|
||||
lock.withLock {
|
||||
if (cancelled) {
|
||||
deleteRecording()
|
||||
|
||||
+2
-1
@@ -29,7 +29,8 @@ import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class AndroidAudioReader
|
||||
@RequiresPermission(Manifest.permission.RECORD_AUDIO) private constructor(
|
||||
@RequiresPermission(Manifest.permission.RECORD_AUDIO)
|
||||
private constructor(
|
||||
private val config: AudioConfig,
|
||||
private val dispatchers: CoroutineDispatchers,
|
||||
) : AudioReader {
|
||||
|
||||
-1
@@ -33,5 +33,4 @@ interface AudioReader {
|
||||
interface Factory {
|
||||
fun create(config: AudioConfig, dispatchers: CoroutineDispatchers): AudioReader
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ class DefaultEncoder @Inject constructor(
|
||||
config: AudioConfig,
|
||||
) : Encoder {
|
||||
private val bitRate = config.bitRate
|
||||
private val sampleRate = config.sampleRate.asEncoderModel()
|
||||
private val sampleRate = config.sampleRate.asEncoderModel()
|
||||
|
||||
private var encoder: OggOpusEncoder? = null
|
||||
override fun init(
|
||||
|
||||
+1
-1
@@ -155,7 +155,7 @@ class VoiceRecorderImplTest {
|
||||
|
||||
companion object {
|
||||
const val FILE_ID: String = "recording"
|
||||
const val FILE_PATH = "voice_recordings/${FILE_ID}.ogg"
|
||||
const val FILE_PATH = "voice_recordings/$FILE_ID.ogg"
|
||||
private lateinit var AUDIO_FORMAT: AudioFormat
|
||||
|
||||
// FakeEncoder doesn't actually encode, it just writes the data to the file
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ import io.element.android.libraries.voicerecorder.impl.audio.AudioReader
|
||||
|
||||
class FakeAudioRecorderFactory(
|
||||
private val audio: List<Audio>
|
||||
): AudioReader.Factory {
|
||||
) : AudioReader.Factory {
|
||||
override fun create(config: AudioConfig, dispatchers: CoroutineDispatchers): AudioReader {
|
||||
return FakeAudioReader(dispatchers, audio)
|
||||
}
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ class FakeFileSystem {
|
||||
val files = mutableMapOf<File, String>()
|
||||
|
||||
fun createFile(file: File) {
|
||||
if(files.containsKey(file)) {
|
||||
if (files.containsKey(file)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user