Session.configureAndStart now handle registering to webRtcPeerConnectionManager...

This commit is contained in:
Benoit Marty 2020-07-03 11:16:58 +02:00
parent 10f8aebde2
commit 5f60d7fd3b
3 changed files with 14 additions and 4 deletions

View file

@ -137,8 +137,12 @@ class VectorApplication :
if (authenticationService.hasAuthenticatedSessions() && !activeSessionHolder.hasActiveSession()) {
val lastAuthenticatedSession = authenticationService.getLastAuthenticatedSession()!!
activeSessionHolder.setActiveSession(lastAuthenticatedSession)
lastAuthenticatedSession.configureAndStart(applicationContext, pushRuleTriggerListener, sessionListener)
lastAuthenticatedSession.callSignalingService().addCallListener(webRtcPeerConnectionManager)
lastAuthenticatedSession.configureAndStart(
applicationContext,
pushRuleTriggerListener,
webRtcPeerConnectionManager,
sessionListener
)
}
ProcessLifecycleOwner.get().lifecycle.addObserver(object : LifecycleObserver {
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)

View file

@ -24,12 +24,14 @@ import im.vector.matrix.android.api.session.Session
import im.vector.matrix.android.api.session.crypto.keysbackup.KeysBackupState
import im.vector.matrix.android.api.session.sync.FilterService
import im.vector.riotx.core.services.VectorSyncService
import im.vector.riotx.features.call.WebRtcPeerConnectionManager
import im.vector.riotx.features.notifications.PushRuleTriggerListener
import im.vector.riotx.features.session.SessionListener
import timber.log.Timber
fun Session.configureAndStart(context: Context,
pushRuleTriggerListener: PushRuleTriggerListener,
webRtcPeerConnectionManager: WebRtcPeerConnectionManager,
sessionListener: SessionListener) {
open()
addListener(sessionListener)
@ -38,6 +40,7 @@ fun Session.configureAndStart(context: Context,
startSyncing(context)
refreshPushers()
pushRuleTriggerListener.startWithSession(this)
callSignalingService().addCallListener(webRtcPeerConnectionManager)
}
fun Session.startSyncing(context: Context) {

View file

@ -667,8 +667,11 @@ class LoginViewModel @AssistedInject constructor(
private fun onSessionCreated(session: Session) {
activeSessionHolder.setActiveSession(session)
session.configureAndStart(applicationContext, pushRuleTriggerListener, sessionListener)
session.callSignalingService().addCallListener(webRtcPeerConnectionManager)
session.configureAndStart(
applicationContext,
pushRuleTriggerListener,
webRtcPeerConnectionManager,
sessionListener)
setState {
copy(
asyncLoginAction = Success(Unit)