mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 19:38:08 +00:00
Use new core.createChatRoom() that replaces the older version (API change was introduced in SDK release/5.4 branch commit ID dd4b83553fc72ca5449adb6ce72d9882f90ae320)
This commit is contained in:
parent
30364c48b0
commit
4e852601fc
5 changed files with 18 additions and 12 deletions
|
|
@ -1351,14 +1351,13 @@ class CurrentCallViewModel
|
|||
|
||||
@WorkerThread
|
||||
private fun createCurrentCallConversation(call: Call) {
|
||||
val localAddress = call.callLog.localAddress
|
||||
val remoteAddress = call.remoteAddress
|
||||
val participants = arrayOf(remoteAddress)
|
||||
val core = call.core
|
||||
operationInProgress.postValue(true)
|
||||
|
||||
val params = getChatRoomParams(call) ?: return // TODO: show error to user
|
||||
val chatRoom = core.createChatRoom(params, localAddress, participants)
|
||||
val chatRoom = core.createChatRoom(params, participants)
|
||||
if (chatRoom != null) {
|
||||
if (params.chatParams?.backend == ChatRoom.Backend.FlexisipChat) {
|
||||
if (chatRoom.state == ChatRoom.State.Created) {
|
||||
|
|
@ -1398,6 +1397,8 @@ class CurrentCallViewModel
|
|||
params.isChatEnabled = true
|
||||
params.isGroupEnabled = false
|
||||
params.subject = AppUtils.getString(R.string.conversation_one_to_one_hidden_subject)
|
||||
params.account = account
|
||||
|
||||
val chatParams = params.chatParams ?: return null
|
||||
chatParams.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
|
||||
|
||||
|
|
|
|||
|
|
@ -174,6 +174,8 @@ class ConversationForwardMessageViewModel
|
|||
params.isChatEnabled = true
|
||||
params.isGroupEnabled = false
|
||||
params.subject = AppUtils.getString(R.string.conversation_one_to_one_hidden_subject)
|
||||
params.account = account
|
||||
|
||||
val chatParams = params.chatParams ?: return
|
||||
chatParams.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
|
||||
|
||||
|
|
@ -212,7 +214,7 @@ class ConversationForwardMessageViewModel
|
|||
Log.i(
|
||||
"$TAG No existing 1-1 conversation between local account [${localAddress?.asStringUriOnly()}] and remote [${remote.asStringUriOnly()}] was found for given parameters, let's create it"
|
||||
)
|
||||
val chatRoom = core.createChatRoom(params, localAddress, participants)
|
||||
val chatRoom = core.createChatRoom(params, participants)
|
||||
if (chatRoom != null) {
|
||||
if (chatParams.backend == ChatRoom.Backend.FlexisipChat) {
|
||||
if (chatRoom.state == ChatRoom.State.Created) {
|
||||
|
|
|
|||
|
|
@ -112,6 +112,8 @@ class StartConversationViewModel
|
|||
params.isGroupEnabled = true
|
||||
params.subject = groupChatRoomSubject
|
||||
params.securityLevel = Conference.SecurityLevel.EndToEnd
|
||||
params.account = account
|
||||
|
||||
val chatParams = params.chatParams ?: return@postOnCoreThread
|
||||
chatParams.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
|
||||
chatParams.backend = ChatRoom.Backend.FlexisipChat
|
||||
|
|
@ -120,14 +122,9 @@ class StartConversationViewModel
|
|||
for (participant in selection.value.orEmpty()) {
|
||||
participants.add(participant.address)
|
||||
}
|
||||
val localAddress = account.params.identityAddress
|
||||
|
||||
val participantsArray = arrayOf<Address>()
|
||||
val chatRoom = core.createChatRoom(
|
||||
params,
|
||||
localAddress,
|
||||
participants.toArray(participantsArray)
|
||||
)
|
||||
val chatRoom = core.createChatRoom(params, participants.toArray(participantsArray))
|
||||
if (chatRoom != null) {
|
||||
if (chatParams.backend == ChatRoom.Backend.FlexisipChat) {
|
||||
if (chatRoom.state == ChatRoom.State.Created) {
|
||||
|
|
@ -176,6 +173,8 @@ class StartConversationViewModel
|
|||
params.isChatEnabled = true
|
||||
params.isGroupEnabled = false
|
||||
params.subject = AppUtils.getString(R.string.conversation_one_to_one_hidden_subject)
|
||||
params.account = account
|
||||
|
||||
val chatParams = params.chatParams ?: return
|
||||
chatParams.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
|
||||
|
||||
|
|
@ -216,7 +215,7 @@ class StartConversationViewModel
|
|||
Log.i(
|
||||
"$TAG No existing 1-1 conversation between local account [${localAddress?.asStringUriOnly()}] and remote [${remote.asStringUriOnly()}] was found for given parameters, let's create it"
|
||||
)
|
||||
val chatRoom = core.createChatRoom(params, localAddress, participants)
|
||||
val chatRoom = core.createChatRoom(params, participants)
|
||||
if (chatRoom != null) {
|
||||
if (chatParams.backend == ChatRoom.Backend.FlexisipChat) {
|
||||
val state = chatRoom.state
|
||||
|
|
|
|||
|
|
@ -499,6 +499,8 @@ class ContactViewModel
|
|||
params.isChatEnabled = true
|
||||
params.isGroupEnabled = false
|
||||
params.subject = AppUtils.getString(R.string.conversation_one_to_one_hidden_subject)
|
||||
params.account = account
|
||||
|
||||
val chatParams = params.chatParams ?: return
|
||||
chatParams.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
|
||||
|
||||
|
|
@ -546,7 +548,7 @@ class ContactViewModel
|
|||
"$TAG No existing conversation between [$localSipUri] and [$remoteSipUri] was found, let's create it"
|
||||
)
|
||||
operationInProgress.postValue(true)
|
||||
val chatRoom = core.createChatRoom(params, localAddress, participants)
|
||||
val chatRoom = core.createChatRoom(params, participants)
|
||||
if (chatRoom != null) {
|
||||
if (chatParams.backend == ChatRoom.Backend.FlexisipChat) {
|
||||
if (chatRoom.state == ChatRoom.State.Created) {
|
||||
|
|
|
|||
|
|
@ -228,6 +228,8 @@ class HistoryViewModel
|
|||
params.isChatEnabled = true
|
||||
params.isGroupEnabled = false
|
||||
params.subject = AppUtils.getString(R.string.conversation_one_to_one_hidden_subject)
|
||||
params.account = account
|
||||
|
||||
val chatParams = params.chatParams ?: return@postOnCoreThread
|
||||
chatParams.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
|
||||
|
||||
|
|
@ -275,7 +277,7 @@ class HistoryViewModel
|
|||
"$TAG No existing conversation between [$localSipUri] and [$remoteSipUri] was found, let's create it"
|
||||
)
|
||||
operationInProgress.postValue(true)
|
||||
val chatRoom = core.createChatRoom(params, localAddress, participants)
|
||||
val chatRoom = core.createChatRoom(params, participants)
|
||||
if (chatRoom != null) {
|
||||
if (chatParams.backend == ChatRoom.Backend.FlexisipChat) {
|
||||
if (chatRoom.state == ChatRoom.State.Created) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue