Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
package net.jami.services package net.jami.services
import io.reactivex.rxjava3.core.Completable import io.reactivex.rxjava3.core.Completable
import io.reactivex.rxjava3.core.Maybe
import io.reactivex.rxjava3.core.Observable import io.reactivex.rxjava3.core.Observable
import io.reactivex.rxjava3.core.Single import io.reactivex.rxjava3.core.Single
import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.disposables.CompositeDisposable
...@@ -497,9 +498,9 @@ class ConversationFacade( ...@@ -497,9 +498,9 @@ class ConversationFacade(
if (contact == null) if (contact == null)
null null
else else
account.getByUri(contact.conversationUri.blockingFirst()) account.getByUri(contact.conversationUri.blockingFirst()) ?: account.getByUri(contact.uri)
else else
account.getSwarm(conversationId) account.getByUri(Uri(Uri.SWARM_SCHEME, conversationId))
val conference = if (conversation != null) (conversation.getConference(call.daemonIdString) ?: Conference(call).apply { val conference = if (conversation != null) (conversation.getConference(call.daemonIdString) ?: Conference(call).apply {
if (newState === CallStatus.OVER) return@onCallStateChange if (newState === CallStatus.OVER) return@onCallStateChange
conversation.addConference(this) conversation.addConference(this)
...@@ -658,13 +659,14 @@ class ConversationFacade( ...@@ -658,13 +659,14 @@ class ConversationFacade(
}.subscribe()) }) }.subscribe()) })
mDisposableBag.add(mAccountService mDisposableBag.add(mAccountService
.messageStateChanges .messageStateChanges
.concatMapSingle { e: Interaction -> .concatMapMaybe { e: Interaction ->
getAccountSubject(e.account!!) getAccountSubject(e.account!!)
.map { a: Account -> .flatMapMaybe<Conversation> { a: Account -> Maybe.fromCallable {
if (e.conversation == null) if (e.conversation == null)
a.getByUri(Uri(Uri.SWARM_SCHEME, e.conversationId!!))!! a.getByUri(Uri(Uri.SWARM_SCHEME, e.conversationId!!))
else else
a.getByUri(e.conversation!!.participant)!! a.getByUri(e.conversation!!.participant)
}
} }
.doOnSuccess { conversation -> conversation.updateInteraction(e) } .doOnSuccess { conversation -> conversation.updateInteraction(e) }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment