mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-10-31 08:15:02 +00:00
Drop the comments from the double start guard
Review feedback: the guard, the warning it logs and the test names carry the meaning on their own.
This commit is contained in:
-5
@@ -72,11 +72,6 @@ class DefaultVoiceRecorder(
|
||||
|
||||
@RequiresPermission(Manifest.permission.RECORD_AUDIO)
|
||||
override suspend fun startRecord() = lock.withLock {
|
||||
// The composer can emit a second Start before the first recording has produced its first
|
||||
// buffer, i.e. before the state flips away from Idle. Without this guard the second call
|
||||
// orphans the first job and its AudioReader, which keeps the microphone open and keeps
|
||||
// emitting Recording forever, so Stop and Delete appear to do nothing.
|
||||
// See https://github.com/element-hq/element-x-android/issues/5780
|
||||
if (recordingJob != null) {
|
||||
Timber.w("Voice recorder is already recording, ignoring this start")
|
||||
return@withLock
|
||||
|
||||
-2
@@ -116,7 +116,6 @@ class DefaultVoiceRecorderTest {
|
||||
voiceRecorder.state.test {
|
||||
assertThat(awaitItem()).isEqualTo(VoiceRecorderState.Idle)
|
||||
|
||||
// Two taps landing before the state has flipped away from Idle.
|
||||
voiceRecorder.startRecord()
|
||||
voiceRecorder.startRecord()
|
||||
assertThat(audioReaderFactory.createdCount).isEqualTo(1)
|
||||
@@ -133,7 +132,6 @@ class DefaultVoiceRecorderTest {
|
||||
duration = 5.seconds,
|
||||
)
|
||||
)
|
||||
// An orphaned recording job would keep emitting Recording after the stop.
|
||||
expectNoEvents()
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -16,7 +16,6 @@ import io.element.android.libraries.voicerecorder.impl.audio.AudioReader
|
||||
class FakeAudioReaderFactory(
|
||||
private val audio: List<Audio>
|
||||
) : AudioReader.Factory {
|
||||
/** Number of readers created so far, to assert that a second recording is never started. */
|
||||
var createdCount: Int = 0
|
||||
private set
|
||||
|
||||
|
||||
Reference in New Issue
Block a user