mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 01:15:54 +03:00
Not start broadcasting if there is already a live broadcast in the room
This commit is contained in:
parent
d04afb898f
commit
14d742d504
1 changed files with 3 additions and 2 deletions
|
@ -49,14 +49,15 @@ class GetVoiceBroadcastStateEventUseCase @Inject constructor(
|
|||
* Get the most recent event related to the given voice broadcast.
|
||||
*/
|
||||
private fun getMostRecentRelatedEvent(room: Room, voiceBroadcast: VoiceBroadcast): VoiceBroadcastEvent? {
|
||||
val startedEvent = room.getTimelineEvent(voiceBroadcast.voiceBroadcastId)
|
||||
return if (startedEvent?.root?.isRedacted().orTrue()) {
|
||||
val startedEvent = room.getTimelineEvent(voiceBroadcast.voiceBroadcastId)?.root
|
||||
return if (startedEvent?.isRedacted().orTrue()) {
|
||||
null
|
||||
} else {
|
||||
room.timelineService().getTimelineEventsRelatedTo(RelationType.REFERENCE, voiceBroadcast.voiceBroadcastId)
|
||||
.mapNotNull { timelineEvent -> timelineEvent.root.asVoiceBroadcastEvent() }
|
||||
.filterNot { it.root.isRedacted() }
|
||||
.maxByOrNull { it.root.originServerTs ?: 0 }
|
||||
?: startedEvent?.asVoiceBroadcastEvent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue