mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 19:36:08 +03:00
Inject ActiveSessionHolder in GetOngoingVoiceBroadcastsUseCase
This commit is contained in:
parent
443d573205
commit
23b4f6d42f
1 changed files with 3 additions and 2 deletions
|
@ -16,21 +16,22 @@
|
||||||
|
|
||||||
package im.vector.app.features.voicebroadcast.usecase
|
package im.vector.app.features.voicebroadcast.usecase
|
||||||
|
|
||||||
|
import im.vector.app.core.di.ActiveSessionHolder
|
||||||
import im.vector.app.features.voicebroadcast.VoiceBroadcastConstants
|
import im.vector.app.features.voicebroadcast.VoiceBroadcastConstants
|
||||||
import im.vector.app.features.voicebroadcast.model.VoiceBroadcastEvent
|
import im.vector.app.features.voicebroadcast.model.VoiceBroadcastEvent
|
||||||
import im.vector.app.features.voicebroadcast.model.VoiceBroadcastState
|
import im.vector.app.features.voicebroadcast.model.VoiceBroadcastState
|
||||||
import im.vector.app.features.voicebroadcast.model.asVoiceBroadcastEvent
|
import im.vector.app.features.voicebroadcast.model.asVoiceBroadcastEvent
|
||||||
import org.matrix.android.sdk.api.query.QueryStringValue
|
import org.matrix.android.sdk.api.query.QueryStringValue
|
||||||
import org.matrix.android.sdk.api.session.Session
|
|
||||||
import org.matrix.android.sdk.api.session.getRoom
|
import org.matrix.android.sdk.api.session.getRoom
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class GetOngoingVoiceBroadcastsUseCase @Inject constructor(
|
class GetOngoingVoiceBroadcastsUseCase @Inject constructor(
|
||||||
private val session: Session,
|
private val activeSessionHolder: ActiveSessionHolder,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun execute(roomId: String): List<VoiceBroadcastEvent> {
|
fun execute(roomId: String): List<VoiceBroadcastEvent> {
|
||||||
|
val session = activeSessionHolder.getSafeActiveSession() ?: return emptyList()
|
||||||
val room = session.getRoom(roomId) ?: error("Unknown roomId: $roomId")
|
val room = session.getRoom(roomId) ?: error("Unknown roomId: $roomId")
|
||||||
|
|
||||||
Timber.d("## GetLastVoiceBroadcastUseCase: get last voice broadcast in $roomId")
|
Timber.d("## GetLastVoiceBroadcastUseCase: get last voice broadcast in $roomId")
|
||||||
|
|
Loading…
Reference in a new issue