Fix UI status at record startup and depending on the recording status

This commit is contained in:
Philippe Loriaux 2022-10-20 11:04:25 +02:00
parent 62b4e822ff
commit eedfc637e9
2 changed files with 4 additions and 3 deletions

View file

@ -37,13 +37,13 @@ struct VoiceBroadcastRecorderView: View {
HStack(alignment: .top, spacing: 16.0) {
Button {
if viewModel.viewState.recordingState == .started {
if viewModel.viewState.recordingState != .stopped {
viewModel.send(viewAction: .stop)
} else {
viewModel.send(viewAction: .start)
}
} label: {
if viewModel.viewState.recordingState == .started {
if viewModel.viewState.recordingState != .stopped {
Image("voice_broadcast_stop")
.renderingMode(.original)
} else {
@ -56,7 +56,7 @@ struct VoiceBroadcastRecorderView: View {
Button {
if viewModel.viewState.recordingState == .paused {
viewModel.send(viewAction: .resume)
} else if viewModel.viewState.recordingState == .started {
} else {
viewModel.send(viewAction: .pause)
}
} label: {

View file

@ -37,6 +37,7 @@ class VoiceBroadcastRecorderViewModel: VoiceBroadcastRecorderViewModelType, Voic
super.init(initialViewState: VoiceBroadcastRecorderViewState(details: details,
recordingState: .stopped,
bindings: VoiceBroadcastRecorderViewStateBindings()))
process(viewAction: .start)
}
// MARK: - Public