diff --git a/src/voice-broadcast/hooks/useVoiceBroadcastRecording.tsx b/src/voice-broadcast/hooks/useVoiceBroadcastRecording.tsx index ed27119de1..209b539bf6 100644 --- a/src/voice-broadcast/hooks/useVoiceBroadcastRecording.tsx +++ b/src/voice-broadcast/hooks/useVoiceBroadcastRecording.tsx @@ -68,7 +68,7 @@ export const useVoiceBroadcastRecording = (recording: VoiceBroadcastRecording) = const live = [ VoiceBroadcastInfoState.Started, VoiceBroadcastInfoState.Paused, - VoiceBroadcastInfoState.Running, + VoiceBroadcastInfoState.Resumed, ].includes(recordingState); return { diff --git a/src/voice-broadcast/index.ts b/src/voice-broadcast/index.ts index 39149c0a78..1ed5ff5377 100644 --- a/src/voice-broadcast/index.ts +++ b/src/voice-broadcast/index.ts @@ -49,7 +49,7 @@ export const VoiceBroadcastChunkEventType = "io.element.voice_broadcast_chunk"; export enum VoiceBroadcastInfoState { Started = "started", Paused = "paused", - Running = "running", + Resumed = "resumed", Stopped = "stopped", } diff --git a/src/voice-broadcast/models/VoiceBroadcastRecording.ts b/src/voice-broadcast/models/VoiceBroadcastRecording.ts index 28cdd72301..c025dc1a2a 100644 --- a/src/voice-broadcast/models/VoiceBroadcastRecording.ts +++ b/src/voice-broadcast/models/VoiceBroadcastRecording.ts @@ -105,15 +105,15 @@ export class VoiceBroadcastRecording public async resume(): Promise { if (this.state !== VoiceBroadcastInfoState.Paused) return; - this.setState(VoiceBroadcastInfoState.Running); + this.setState(VoiceBroadcastInfoState.Resumed); await this.getRecorder().start(); - await this.sendInfoStateEvent(VoiceBroadcastInfoState.Running); + await this.sendInfoStateEvent(VoiceBroadcastInfoState.Resumed); } public toggle = async (): Promise => { if (this.getState() === VoiceBroadcastInfoState.Paused) return this.resume(); - if ([VoiceBroadcastInfoState.Started, VoiceBroadcastInfoState.Running].includes(this.getState())) { + if ([VoiceBroadcastInfoState.Started, VoiceBroadcastInfoState.Resumed].includes(this.getState())) { return this.pause(); } }; diff --git a/test/voice-broadcast/components/molecules/VoiceBroadcastRecordingBody-test.tsx b/test/voice-broadcast/components/molecules/VoiceBroadcastRecordingBody-test.tsx index 25e1f7c215..36b2b4c5a7 100644 --- a/test/voice-broadcast/components/molecules/VoiceBroadcastRecordingBody-test.tsx +++ b/test/voice-broadcast/components/molecules/VoiceBroadcastRecordingBody-test.tsx @@ -50,7 +50,7 @@ describe("VoiceBroadcastRecordingBody", () => { room: roomId, user: userId, }); - recording = new VoiceBroadcastRecording(infoEvent, client, VoiceBroadcastInfoState.Running); + recording = new VoiceBroadcastRecording(infoEvent, client, VoiceBroadcastInfoState.Resumed); }); describe("when rendering a live broadcast", () => { diff --git a/test/voice-broadcast/components/molecules/VoiceBroadcastRecordingPip-test.tsx b/test/voice-broadcast/components/molecules/VoiceBroadcastRecordingPip-test.tsx index 4cd85d37ef..f07b7dd0bd 100644 --- a/test/voice-broadcast/components/molecules/VoiceBroadcastRecordingPip-test.tsx +++ b/test/voice-broadcast/components/molecules/VoiceBroadcastRecordingPip-test.tsx @@ -118,7 +118,7 @@ describe("VoiceBroadcastRecordingPip", () => { }); it("should resume the recording", () => { - expect(recording.getState()).toBe(VoiceBroadcastInfoState.Running); + expect(recording.getState()).toBe(VoiceBroadcastInfoState.Resumed); }); }); }); diff --git a/test/voice-broadcast/models/VoiceBroadcastPlayback-test.ts b/test/voice-broadcast/models/VoiceBroadcastPlayback-test.ts index ec28a95fd6..8471727026 100644 --- a/test/voice-broadcast/models/VoiceBroadcastPlayback-test.ts +++ b/test/voice-broadcast/models/VoiceBroadcastPlayback-test.ts @@ -190,9 +190,9 @@ describe("VoiceBroadcastPlayback", () => { onStateChanged = jest.fn(); }); - describe("when there is a running broadcast without chunks yet", () => { + describe(`when there is a ${VoiceBroadcastInfoState.Resumed} broadcast without chunks yet`, () => { beforeEach(() => { - infoEvent = mkInfoEvent(VoiceBroadcastInfoState.Running); + infoEvent = mkInfoEvent(VoiceBroadcastInfoState.Resumed); playback = mkPlayback(); setUpChunkEvents([]); }); @@ -236,9 +236,9 @@ describe("VoiceBroadcastPlayback", () => { }); }); - describe("when there is a running voice broadcast with some chunks", () => { + describe(`when there is a ${VoiceBroadcastInfoState.Resumed} voice broadcast with some chunks`, () => { beforeEach(() => { - infoEvent = mkInfoEvent(VoiceBroadcastInfoState.Running); + infoEvent = mkInfoEvent(VoiceBroadcastInfoState.Resumed); playback = mkPlayback(); setUpChunkEvents([chunk2Event, chunk0Event, chunk1Event]); }); diff --git a/test/voice-broadcast/models/VoiceBroadcastRecording-test.ts b/test/voice-broadcast/models/VoiceBroadcastRecording-test.ts index b3076d72c0..b8b8008c13 100644 --- a/test/voice-broadcast/models/VoiceBroadcastRecording-test.ts +++ b/test/voice-broadcast/models/VoiceBroadcastRecording-test.ts @@ -423,15 +423,15 @@ describe("VoiceBroadcastRecording", () => { await action(); }); - itShouldBeInState(VoiceBroadcastInfoState.Running); - itShouldSendAnInfoEvent(VoiceBroadcastInfoState.Running); + itShouldBeInState(VoiceBroadcastInfoState.Resumed); + itShouldSendAnInfoEvent(VoiceBroadcastInfoState.Resumed); it("should start the recorder", () => { expect(mocked(voiceBroadcastRecorder.start)).toHaveBeenCalled(); }); - it("should emit a running state changed event", () => { - expect(onStateChanged).toHaveBeenCalledWith(VoiceBroadcastInfoState.Running); + it(`should emit a ${VoiceBroadcastInfoState.Resumed} state changed event`, () => { + expect(onStateChanged).toHaveBeenCalledWith(VoiceBroadcastInfoState.Resumed); }); }); }); diff --git a/test/voice-broadcast/utils/hasRoomLiveVoiceBroadcast-test.ts b/test/voice-broadcast/utils/hasRoomLiveVoiceBroadcast-test.ts index 40b50ec883..a984ed5fd6 100644 --- a/test/voice-broadcast/utils/hasRoomLiveVoiceBroadcast-test.ts +++ b/test/voice-broadcast/utils/hasRoomLiveVoiceBroadcast-test.ts @@ -121,7 +121,7 @@ describe("hasRoomLiveVoiceBroadcast", () => { // all there are kind of live states VoiceBroadcastInfoState.Started, VoiceBroadcastInfoState.Paused, - VoiceBroadcastInfoState.Running, + VoiceBroadcastInfoState.Resumed, ])("when there is a live broadcast (%s) from the current user", (state: VoiceBroadcastInfoState) => { beforeEach(() => { addVoiceBroadcastInfoEvent(state, client.getUserId()); @@ -132,7 +132,7 @@ describe("hasRoomLiveVoiceBroadcast", () => { describe("when there was a live broadcast, that has been stopped", () => { beforeEach(() => { - addVoiceBroadcastInfoEvent(VoiceBroadcastInfoState.Running, client.getUserId()); + addVoiceBroadcastInfoEvent(VoiceBroadcastInfoState.Resumed, client.getUserId()); addVoiceBroadcastInfoEvent(VoiceBroadcastInfoState.Stopped, client.getUserId()); }); @@ -141,7 +141,7 @@ describe("hasRoomLiveVoiceBroadcast", () => { describe("when there is a live broadcast from another user", () => { beforeEach(() => { - addVoiceBroadcastInfoEvent(VoiceBroadcastInfoState.Running, otherUserId); + addVoiceBroadcastInfoEvent(VoiceBroadcastInfoState.Resumed, otherUserId); }); itShouldReturnTrueFalse(); diff --git a/test/voice-broadcast/utils/shouldDisplayAsVoiceBroadcastRecordingTile-test.ts b/test/voice-broadcast/utils/shouldDisplayAsVoiceBroadcastRecordingTile-test.ts index 7673dc4d7b..fc4ec2c04b 100644 --- a/test/voice-broadcast/utils/shouldDisplayAsVoiceBroadcastRecordingTile-test.ts +++ b/test/voice-broadcast/utils/shouldDisplayAsVoiceBroadcastRecordingTile-test.ts @@ -40,7 +40,7 @@ const testCases = [ [ "@user1:example.com", "@user1:example.com", - VoiceBroadcastInfoState.Running, + VoiceBroadcastInfoState.Resumed, true, ], [ diff --git a/test/voice-broadcast/utils/shouldDisplayAsVoiceBroadcastTile-test.ts b/test/voice-broadcast/utils/shouldDisplayAsVoiceBroadcastTile-test.ts index 3d9e87ee3b..394b8c4c11 100644 --- a/test/voice-broadcast/utils/shouldDisplayAsVoiceBroadcastTile-test.ts +++ b/test/voice-broadcast/utils/shouldDisplayAsVoiceBroadcastTile-test.ts @@ -128,7 +128,7 @@ describe("shouldDisplayAsVoiceBroadcastTile", () => { describe.each( [ VoiceBroadcastInfoState.Paused, - VoiceBroadcastInfoState.Running, + VoiceBroadcastInfoState.Resumed, VoiceBroadcastInfoState.Stopped, ], )("when a voice broadcast info event in state %s occurs", (state: VoiceBroadcastInfoState) => { diff --git a/test/voice-broadcast/utils/startNewVoiceBroadcastRecording-test.ts b/test/voice-broadcast/utils/startNewVoiceBroadcastRecording-test.ts index b19ea3c691..dc72868c83 100644 --- a/test/voice-broadcast/utils/startNewVoiceBroadcastRecording-test.ts +++ b/test/voice-broadcast/utils/startNewVoiceBroadcastRecording-test.ts @@ -161,7 +161,7 @@ describe("startNewVoiceBroadcastRecording", () => { room.currentState.setStateEvents([ mkVoiceBroadcastInfoStateEvent( roomId, - VoiceBroadcastInfoState.Running, + VoiceBroadcastInfoState.Resumed, client.getUserId(), client.getDeviceId(), ), @@ -184,7 +184,7 @@ describe("startNewVoiceBroadcastRecording", () => { room.currentState.setStateEvents([ mkVoiceBroadcastInfoStateEvent( roomId, - VoiceBroadcastInfoState.Running, + VoiceBroadcastInfoState.Resumed, otherUserId, "ASD123", ),