mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-22 01:22:46 +02:00
VoiceBroadcast: Manage app crash cases when recording (#7188)
* Cancel automatically a Voice Broadcast from a room after an app crash * We limit for the moment the uncompleted voice broadcast cleaning to the breadcrumbs rooms list By considering potential performance issues, we decided to limit the uncompleted VB cleaning in the recents list service: - we run the process only once when the application is resumed - we run the process only on the breadcrumbs rooms list This prevent us from checking several times in parallel the same room (because a room may be listed in several recents sections) This prevent us from checking several times the same room (each room should be checked only once after the app resume) If a room is not checked from the recents list, a sanity check is still done in RoomViewController (to clean the room when the user opens it)
This commit is contained in:
@@ -30,6 +30,7 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
|
||||
public private(set) var query: String?
|
||||
public private(set) var space: MXSpace?
|
||||
private var fetchersCreated: Bool = false
|
||||
private var uncompletedVoiceBroadcastCleaningDone: Bool = false
|
||||
|
||||
// MARK: - Fetchers
|
||||
|
||||
@@ -757,6 +758,7 @@ public class RecentsListService: NSObject, RecentsListServiceProtocol {
|
||||
forSection: section,
|
||||
totalCountsChanged: totalCountsChanged) }
|
||||
} else {
|
||||
stopUncompletedVoiceBroadcastIfNeeded()
|
||||
multicastDelegate.invoke { $0.recentsListServiceDidChangeData?(self,
|
||||
totalCountsChanged: totalCountsChanged) }
|
||||
}
|
||||
@@ -784,6 +786,31 @@ extension RecentsListService: MXRoomListDataFetcherDelegate {
|
||||
|
||||
}
|
||||
|
||||
// MARK: - VoiceBroadcast
|
||||
extension RecentsListService {
|
||||
|
||||
private func stopUncompletedVoiceBroadcastIfNeeded() {
|
||||
guard uncompletedVoiceBroadcastCleaningDone == false,
|
||||
let breadcrumbsFetcher = breadcrumbsRoomListDataFetcher else {
|
||||
return
|
||||
}
|
||||
// We limit for the moment the uncompleted voice broadcast cleaning to the breadcrumbs rooms list
|
||||
stopUncompletedVoiceBroadcastIfNeeded(for: breadcrumbsFetcher)
|
||||
uncompletedVoiceBroadcastCleaningDone = true
|
||||
}
|
||||
|
||||
private func stopUncompletedVoiceBroadcastIfNeeded(for fetcher: MXRoomListDataFetcher) {
|
||||
fetcher.data?.rooms.forEach({ roomSummary in
|
||||
guard let roomSummary = roomSummary as? MXRoomSummary,
|
||||
let room = roomSummary.room else {
|
||||
return
|
||||
}
|
||||
|
||||
room.stopUncompletedVoiceBroadcastIfNeeded()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - FetcherTypes
|
||||
|
||||
private struct FetcherTypes: OptionSet {
|
||||
|
||||
Reference in New Issue
Block a user