Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
248dcf8
adapt context message results for threads
mahibi Sep 16, 2025
ed7d827
convert getContextChatMessages to kotlin flow
mahibi Sep 16, 2025
94aa9fb
refactor ContextChatView dialog
mahibi Sep 16, 2025
7c8dd5a
refactor ContextChatView dialog
mahibi Sep 16, 2025
aea2b80
hide quoted thread parent message inside message search
mahibi Sep 16, 2025
229eb28
add thread title for thread messages in message search for normal chat
mahibi Sep 16, 2025
0b37a9d
modify left/right padding
mahibi Sep 17, 2025
d7d857b
fix broken design of long messages
mahibi Sep 17, 2025
444f206
chnage deisgn of thread title
mahibi Sep 17, 2025
094b8c2
style chat bubble content by using IntrinsicSize.Max
mahibi Sep 17, 2025
a662862
simplify bubble
mahibi Sep 17, 2025
07ef79c
simplify bubble
mahibi Sep 17, 2025
5bbc90c
rename "followed threads" to "threads"
mahibi Sep 17, 2025
21ba479
show time under message when it has linebreaks
mahibi Sep 17, 2025
40059b9
format code
mahibi Sep 17, 2025
328e0db
set searchresult subline if available
mahibi Sep 17, 2025
4997f7e
resolve detekt warnings...
mahibi Sep 18, 2025
d6e8976
pass threadId to search when message was not found in jumpToQuotedMes…
mahibi Sep 18, 2025
12a9c85
add missing SPDX-FileCopyrightTexts
mahibi Sep 18, 2025
8d456b4
fix to correctly sort out only child thread messages in message searc…
mahibi Sep 18, 2025
e809aeb
fix to also show the message itself for link previews in message search
mahibi Sep 18, 2025
a2386cc
fix test
mahibi Sep 18, 2025
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Nextcloud Talk - Android Client
*
* SPDX-FileCopyrightText: 2025 Your Name <your@email.com>
* SPDX-FileCopyrightText: 2025 Julius Linus <juliuslinus1@gmail.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*/
package com.nextcloud.talk.account
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Nextcloud Talk - Android Client
*
* SPDX-FileCopyrightText: 2025 Your Name <your@email.com>
* SPDX-FileCopyrightText: 2025 Julius Linus <juliuslinus1@gmail.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*/

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/nextcloud/talk/api/NcApiCoroutines.kt
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ interface NcApiCoroutines {
suspend fun getContextOfChatMessage(
@Header("Authorization") authorization: String,
@Url url: String,
@Query("limit") limit: Int
@Query("limit") limit: Int,
@Query("threadId") threadId: Int?
): ChatOverall

@GET
Expand Down
37 changes: 20 additions & 17 deletions app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.ui.platform.ComposeView
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.content.ContextCompat
import androidx.core.content.FileProvider
import androidx.core.content.PermissionChecker
import androidx.core.content.PermissionChecker.PERMISSION_GRANTED
Expand Down Expand Up @@ -134,6 +135,8 @@ import com.nextcloud.talk.application.NextcloudTalkApplication
import com.nextcloud.talk.chat.data.model.ChatMessage
import com.nextcloud.talk.chat.viewmodels.ChatViewModel
import com.nextcloud.talk.chat.viewmodels.MessageInputViewModel
import com.nextcloud.talk.contextchat.ContextChatView
import com.nextcloud.talk.contextchat.ContextChatViewModel
import com.nextcloud.talk.conversationinfo.ConversationInfoActivity
import com.nextcloud.talk.conversationinfo.viewmodel.ConversationInfoViewModel
import com.nextcloud.talk.conversationlist.ConversationsListActivity
Expand Down Expand Up @@ -168,7 +171,6 @@ import com.nextcloud.talk.ui.PlaybackSpeed
import com.nextcloud.talk.ui.PlaybackSpeedControl
import com.nextcloud.talk.ui.StatusDrawable
import com.nextcloud.talk.ui.bottom.sheet.ProfileBottomSheet
import com.nextcloud.talk.ui.dialog.ContextChatCompose
import com.nextcloud.talk.ui.dialog.DateTimeCompose
import com.nextcloud.talk.ui.dialog.FileAttachmentPreviewFragment
import com.nextcloud.talk.ui.dialog.MessageActionsDialog
Expand Down Expand Up @@ -246,7 +248,6 @@ import java.util.Locale
import java.util.concurrent.ExecutionException
import javax.inject.Inject
import kotlin.math.roundToInt
import androidx.core.content.ContextCompat

@Suppress("TooManyFunctions")
@AutoInjector(NextcloudTalkApplication::class)
Expand Down Expand Up @@ -287,6 +288,7 @@ class ChatActivity :
lateinit var chatViewModel: ChatViewModel

lateinit var conversationInfoViewModel: ConversationInfoViewModel
lateinit var contextChatViewModel: ContextChatViewModel
lateinit var messageInputViewModel: MessageInputViewModel

private var chatMenu: Menu? = null
Expand Down Expand Up @@ -323,28 +325,27 @@ class ChatActivity :
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
executeIfResultOk(it) { intent ->
runBlocking {
val id = intent?.getStringExtra(MessageSearchActivity.RESULT_KEY_MESSAGE_ID)
id?.let {
startContextChatWindowForMessage(id)
val messageId = intent?.getStringExtra(MessageSearchActivity.RESULT_KEY_MESSAGE_ID)
val threadId = intent?.getStringExtra(MessageSearchActivity.RESULT_KEY_THREAD_ID)
messageId?.let {
startContextChatWindowForMessage(messageId, threadId)
}
}
}
}

private fun startContextChatWindowForMessage(id: String?) {
private fun startContextChatWindowForMessage(messageId: String?, threadId: String?) {
binding.genericComposeView.apply {
val shouldDismiss = mutableStateOf(false)
setContent {
val bundle = bundleOf()
bundle.putString(BundleKeys.KEY_CREDENTIALS, credentials!!)
bundle.putString(BundleKeys.KEY_BASE_URL, conversationUser!!.baseUrl)
bundle.putString(KEY_ROOM_TOKEN, roomToken)
bundle.putString(BundleKeys.KEY_MESSAGE_ID, id)
bundle.putString(
KEY_CONVERSATION_NAME,
currentConversation!!.displayName
contextChatViewModel.getContextForChatMessages(
credentials = credentials!!,
baseUrl = conversationUser!!.baseUrl!!,
token = roomToken,
threadId = threadId,
messageId = messageId!!,
title = currentConversation!!.displayName
)
ContextChatCompose(bundle).GetDialogView(shouldDismiss, context)
ContextChatView(context, contextChatViewModel)
}
}
Log.d(TAG, "Should open something else")
Expand Down Expand Up @@ -514,6 +515,8 @@ class ChatActivity :

conversationInfoViewModel = ViewModelProvider(this, viewModelFactory)[ConversationInfoViewModel::class.java]

contextChatViewModel = ViewModelProvider(this, viewModelFactory)[ContextChatViewModel::class.java]

val urlForChatting = ApiUtils.getUrlForChat(chatApiVersion, conversationUser?.baseUrl, roomToken)
val credentials = ApiUtils.getCredentials(conversationUser!!.username, conversationUser!!.token)
chatViewModel.initData(
Expand Down Expand Up @@ -4431,7 +4434,7 @@ class ChatActivity :
}
if (!foundMessage) {
Log.d(TAG, "quoted message with id " + parentMessage.id + " was not found in adapter")
startContextChatWindowForMessage(parentMessage.id)
startContextChatWindowForMessage(parentMessage.id, conversationThreadId.toString())
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Nextcloud Talk - Android Client
*
* SPDX-FileCopyrightText: 2024 Your Name <your@email.com>
* SPDX-FileCopyrightText: 2025 Marcel Hibbe <dev@mhibbe.de>
* SPDX-License-Identifier: GPL-3.0-or-later
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ interface ChatNetworkDataSource {
baseUrl: String,
token: String,
messageId: String,
limit: Int
limit: Int,
threadId: Int?
): List<ChatMessageJson>
suspend fun getOpenGraph(credentials: String, baseUrl: String, extractedLinkToPreview: String): Reference?
suspend fun unbindRoom(credentials: String, baseUrl: String, roomToken: String): GenericOverall
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,11 @@ class RetrofitChatNetwork(private val ncApi: NcApi, private val ncApiCoroutines:
baseUrl: String,
token: String,
messageId: String,
limit: Int
limit: Int,
threadId: Int?
): List<ChatMessageJson> {
val url = ApiUtils.getUrlForChatMessageContext(baseUrl, token, messageId)
return ncApiCoroutines.getContextOfChatMessage(credentials, url, limit).ocs?.data ?: listOf()
return ncApiCoroutines.getContextOfChatMessage(credentials, url, limit, threadId).ocs?.data ?: listOf()
}

override suspend fun getOpenGraph(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import com.nextcloud.talk.models.domain.ConversationModel
import com.nextcloud.talk.models.domain.ReactionAddedModel
import com.nextcloud.talk.models.domain.ReactionDeletedModel
import com.nextcloud.talk.models.json.capabilities.SpreedCapability
import com.nextcloud.talk.models.json.chat.ChatMessageJson
import com.nextcloud.talk.models.json.chat.ChatOverallSingleMessage
import com.nextcloud.talk.models.json.conversations.RoomOverall
import com.nextcloud.talk.models.json.generic.GenericOverall
Expand Down Expand Up @@ -171,10 +170,6 @@ class ChatViewModel @Inject constructor(
val voiceMessagePlaybackSpeedPreferences: LiveData<Map<String, PlaybackSpeed>>
get() = _voiceMessagePlaybackSpeedPreferences

private val _getContextChatMessages: MutableLiveData<List<ChatMessageJson>> = MutableLiveData()
val getContextChatMessages: LiveData<List<ChatMessageJson>>
get() = _getContextChatMessages

private val _threadRetrieveState = MutableStateFlow<ThreadRetrieveUiState>(ThreadRetrieveUiState.None)
val threadRetrieveState: StateFlow<ThreadRetrieveUiState> = _threadRetrieveState

Expand Down Expand Up @@ -944,20 +939,6 @@ class ChatViewModel @Inject constructor(
}
}

fun getContextForChatMessages(credentials: String, baseUrl: String, token: String, messageId: String, limit: Int) {
viewModelScope.launch {
val messages = chatNetworkDataSource.getContextForChatMessage(
credentials,
baseUrl,
token,
messageId,
limit
)

_getContextChatMessages.value = messages
}
}

fun getOpenGraph(credentials: String, baseUrl: String, urlToPreview: String) {
viewModelScope.launch {
_getOpenGraph.value = chatNetworkDataSource.getOpenGraph(credentials, baseUrl, urlToPreview)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Nextcloud Talk - Android Client
*
* SPDX-FileCopyrightText: 2024 Your Name <your@email.com>
* SPDX-FileCopyrightText: 2024 Sowjanya Kota <sowjanya.kch@gmail.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*/

Expand Down
Loading
Loading