mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 00:52:43 +02:00
Update recording state after stopping voice broadcast on every cases
This commit is contained in:
+11
-4
@@ -17,6 +17,10 @@
|
||||
import Combine
|
||||
import Foundation
|
||||
|
||||
protocol VoiceBroadcastRecorderServiceDelegate: AnyObject {
|
||||
func voiceBroadcastRecorderService(_ service: VoiceBroadcastRecorderServiceProtocol, didUpdateState state: VoiceBroadcastRecorderState)
|
||||
}
|
||||
|
||||
class VoiceBroadcastRecorderService: VoiceBroadcastRecorderServiceProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
@@ -37,6 +41,8 @@ class VoiceBroadcastRecorderService: VoiceBroadcastRecorderServiceProtocol {
|
||||
private var chunkFileNumber: Int = 0
|
||||
|
||||
// MARK: Public
|
||||
|
||||
weak var serviceDelegate: VoiceBroadcastRecorderServiceDelegate?
|
||||
|
||||
// MARK: - Setup
|
||||
|
||||
@@ -73,10 +79,12 @@ class VoiceBroadcastRecorderService: VoiceBroadcastRecorderServiceProtocol {
|
||||
resetValues()
|
||||
|
||||
voiceBroadcastService?.stopVoiceBroadcast(success: { [weak self] _ in
|
||||
MXLog.debug("[VoiceBroadcastRecorderService] Stopped")
|
||||
|
||||
guard let self = self else { return }
|
||||
|
||||
// update recording state
|
||||
MXLog.debug("[VoiceBroadcastRecorderService] Stopped")
|
||||
// Update state
|
||||
self.serviceDelegate?.voiceBroadcastRecorderService(self, didUpdateState: .stopped)
|
||||
|
||||
// Send current chunk
|
||||
self.sendChunkFile(at: self.chunkFile.url)
|
||||
@@ -92,7 +100,6 @@ class VoiceBroadcastRecorderService: VoiceBroadcastRecorderServiceProtocol {
|
||||
|
||||
voiceBroadcastService?.pauseVoiceBroadcast(success: { [weak self] _ in
|
||||
guard let self = self else { return }
|
||||
// update recording state
|
||||
|
||||
// Send current chunk
|
||||
self.sendChunkFile(at: self.chunkFile.url)
|
||||
@@ -107,7 +114,7 @@ class VoiceBroadcastRecorderService: VoiceBroadcastRecorderServiceProtocol {
|
||||
try? audioEngine.start()
|
||||
|
||||
voiceBroadcastService?.resumeVoiceBroadcast(success: { _ in
|
||||
// update recording state
|
||||
//
|
||||
}, failure: { error in
|
||||
MXLog.error("[VoiceBroadcastRecorderService] Failed to resume voice broadcast", context: error)
|
||||
})
|
||||
|
||||
+3
@@ -18,6 +18,9 @@ import Combine
|
||||
import Foundation
|
||||
|
||||
protocol VoiceBroadcastRecorderServiceProtocol {
|
||||
/// Service delegate
|
||||
var serviceDelegate: VoiceBroadcastRecorderServiceDelegate? { get set }
|
||||
|
||||
/// Start voice broadcast recording.
|
||||
func startRecordingVoiceBroadcast()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user