Skip to content

Feature/4712/add participant to1to1 #4826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Apr 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions app/src/main/java/com/nextcloud/talk/activities/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,10 @@ class MainActivity : BaseActivity(), ActionBarProvider {
val apiVersion = ApiUtils.getConversationApiVersion(currentUser, intArrayOf(ApiUtils.API_V4, 1))
val credentials = ApiUtils.getCredentials(currentUser?.username, currentUser?.token)
val retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(
apiVersion,
currentUser?.baseUrl!!,
roomType,
null,
userId,
null
version = apiVersion,
baseUrl = currentUser?.baseUrl!!,
roomType = roomType,
invite = userId
)

ncApi.createRoom(
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/java/com/nextcloud/talk/api/NcApiCoroutines.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
* Nextcloud Talk - Android Client
*
* SPDX-FileCopyrightText: 2024 Sowjanya Kota <[email protected]>
* SPDX-FileCopyrightText: 2025 Marcel Hibbe <[email protected]>
* SPDX-License-Identifier: GPL-3.0-or-later
*/

package com.nextcloud.talk.api

import com.nextcloud.talk.conversationinfo.CreateRoomRequest
import com.nextcloud.talk.models.json.autocomplete.AutocompleteOverall
import com.nextcloud.talk.models.json.chat.ChatOverallSingleMessage
import com.nextcloud.talk.models.json.conversations.RoomOverall
Expand Down Expand Up @@ -56,6 +58,13 @@ interface NcApiCoroutines {
@QueryMap options: Map<String, String>?
): RoomOverall

@POST
suspend fun createRoomWithBody(
@Header("Authorization") authorization: String?,
@Url url: String?,
@Body roomRequest: CreateRoomRequest
): RoomOverall

/*
QueryMap items are as follows:
- "roomName" : "newName"
Expand Down
52 changes: 23 additions & 29 deletions app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.PopupMenu
import android.widget.TextView
import android.widget.Toast
import androidx.activity.OnBackPressedCallback
import androidx.activity.result.ActivityResult
import androidx.activity.result.ActivityResultLauncher
Expand Down Expand Up @@ -1597,19 +1598,17 @@ class ChatActivity :
private fun switchToRoom(token: String, startCallAfterRoomSwitch: Boolean, isVoiceOnlyCall: Boolean) {
if (conversationUser != null) {
runOnUiThread {
if (currentConversation?.objectType == ConversationEnums.ObjectType.ROOM) {
Snackbar.make(
binding.root,
context.resources.getString(R.string.switch_to_main_room),
Snackbar.LENGTH_LONG
).show()
val toastInfo = if (currentConversation?.objectType == ConversationEnums.ObjectType.ROOM) {
context.resources.getString(R.string.switch_to_main_room)
} else {
Snackbar.make(
binding.root,
context.resources.getString(R.string.switch_to_breakout_room),
Snackbar.LENGTH_LONG
).show()
context.resources.getString(R.string.switch_to_breakout_room)
}
// do not replace with snackbar, as it would disappear with the activity switch
Toast.makeText(
context,
toastInfo,
Toast.LENGTH_LONG
).show()
}

val bundle = Bundle()
Expand Down Expand Up @@ -3165,12 +3164,10 @@ class ChatActivity :
val apiVersion =
ApiUtils.getConversationApiVersion(conversationUser!!, intArrayOf(ApiUtils.API_V4, 1))
val retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(
apiVersion,
conversationUser?.baseUrl!!,
"1",
null,
message?.user?.id?.substring(INVITE_LENGTH),
null
version = apiVersion,
baseUrl = conversationUser?.baseUrl!!,
roomType = "1",
invite = message?.user?.id?.substring(INVITE_LENGTH)
)
chatViewModel.createRoom(
credentials!!,
Expand Down Expand Up @@ -3598,12 +3595,10 @@ class ChatActivity :
}

val retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(
apiVersion,
conversationUser?.baseUrl!!,
"1",
null,
userMentionClickEvent.userId,
null
version = apiVersion,
baseUrl = conversationUser?.baseUrl!!,
roomType = "1",
invite = userMentionClickEvent.userId
)

chatViewModel.createRoom(
Expand Down Expand Up @@ -3710,12 +3705,11 @@ class ChatActivity :
val apiVersion =
ApiUtils.getConversationApiVersion(conversationUser!!, intArrayOf(ApiUtils.API_V4, 1))
val retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(
apiVersion,
conversationUser?.baseUrl!!,
ROOM_TYPE_ONE_TO_ONE,
ACTOR_TYPE,
userId,
null
version = apiVersion,
baseUrl = conversationUser?.baseUrl!!,
roomType = ROOM_TYPE_ONE_TO_ONE,
source = ACTOR_TYPE,
invite = userId
)
chatViewModel.createRoom(
credentials!!,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ class ContactsRepositoryImpl @Inject constructor(
conversationName: String?
): RoomOverall {
val retrofitBucket: RetrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(
apiVersion,
_currentUser.baseUrl,
roomType,
sourceType,
userId,
conversationName
version = apiVersion,
baseUrl = _currentUser.baseUrl,
roomType = roomType,
source = sourceType,
invite = userId,
conversationName = conversationName
)
val response = ncApiCoroutines.createRoom(
credentials,
Expand Down
Loading
Loading