Commit 09d49bcf authored by Adrien Béraud's avatar Adrien Béraud
Browse files

conversation facade: handle call from unknown swarm

Change-Id: I5f3329fa41aab4a938fdb4227ce3a1892adcffc9
parent bb32dd3a
......@@ -21,6 +21,7 @@
package net.jami.services
import io.reactivex.rxjava3.core.Completable
import io.reactivex.rxjava3.core.Maybe
import io.reactivex.rxjava3.core.Observable
import io.reactivex.rxjava3.core.Single
import io.reactivex.rxjava3.disposables.CompositeDisposable
......@@ -497,9 +498,9 @@ class ConversationFacade(
if (contact == null)
null
else
account.getByUri(contact.conversationUri.blockingFirst())
account.getByUri(contact.conversationUri.blockingFirst()) ?: account.getByUri(contact.uri)
else
account.getSwarm(conversationId)
account.getByUri(Uri(Uri.SWARM_SCHEME, conversationId))
val conference = if (conversation != null) (conversation.getConference(call.daemonIdString) ?: Conference(call).apply {
if (newState === CallStatus.OVER) return@onCallStateChange
conversation.addConference(this)
......@@ -658,13 +659,14 @@ class ConversationFacade(
}.subscribe()) })
mDisposableBag.add(mAccountService
.messageStateChanges
.concatMapSingle { e: Interaction ->
.concatMapMaybe { e: Interaction ->
getAccountSubject(e.account!!)
.map { a: Account ->
if (e.conversation == null)
a.getByUri(Uri(Uri.SWARM_SCHEME, e.conversationId!!))!!
else
a.getByUri(e.conversation!!.participant)!!
.flatMapMaybe<Conversation> { a: Account -> Maybe.fromCallable {
if (e.conversation == null)
a.getByUri(Uri(Uri.SWARM_SCHEME, e.conversationId!!))
else
a.getByUri(e.conversation!!.participant)
}
}
.doOnSuccess { conversation -> conversation.updateInteraction(e) }
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment