Skip to content

Commit 41b4d04

Browse files
committed
aligning strings with web, making the messages scrollable for longer messages, and is now reactive to server updates
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
1 parent ea15088 commit 41b4d04

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import androidx.compose.foundation.clickable
6565
import androidx.compose.foundation.layout.Arrangement
6666
import androidx.compose.foundation.layout.Box
6767
import androidx.compose.foundation.layout.Column
68+
import androidx.compose.foundation.layout.heightIn
6869
import androidx.compose.foundation.layout.offset
6970
import androidx.compose.foundation.layout.padding
7071
import androidx.compose.foundation.layout.size
@@ -1419,6 +1420,7 @@ class ChatActivity :
14191420
.shadow(4.dp, shape = RoundedCornerShape(16.dp))
14201421
.background(incomingBubbleColor, RoundedCornerShape(16.dp))
14211422
.padding(16.dp)
1423+
.heightIn(max = 100.dp)
14221424
.verticalScroll(scrollState)
14231425
.clickable {
14241426
scrollToMessageWithIdWithOffset(message.id)
@@ -3268,6 +3270,8 @@ class ChatActivity :
32683270
}
32693271
}
32703272

3273+
var shouldRefreshRoom = false
3274+
32713275
for (chatMessage in chatMessageList) {
32723276
chatMessage.activeUser = conversationUser
32733277

@@ -3283,6 +3287,20 @@ class ChatActivity :
32833287
Log.d(TAG, "chatMessage to add:" + chatMessage.message)
32843288
it.addToStart(chatMessage, scrollToBottom)
32853289
}
3290+
3291+
val systemMessageType = chatMessage.systemMessageType
3292+
if (systemMessageType != null &&
3293+
(
3294+
systemMessageType == ChatMessage.SystemMessageType.MESSAGE_PINNED ||
3295+
systemMessageType == ChatMessage.SystemMessageType.MESSAGE_UNPINNED
3296+
)
3297+
) {
3298+
shouldRefreshRoom = true
3299+
}
3300+
}
3301+
3302+
if (shouldRefreshRoom) {
3303+
chatViewModel.refreshRoom()
32863304
}
32873305

32883306
// workaround to jump back to unread messages marker

app/src/main/java/com/nextcloud/talk/chat/viewmodels/ChatViewModel.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,12 @@ class ChatViewModel @Inject constructor(
10551055
}
10561056
}
10571057

1058+
fun refreshRoom() {
1059+
viewModelScope.launch {
1060+
getRoom(chatRoomToken)
1061+
}
1062+
}
1063+
10581064
fun clearThreadTitle() {
10591065
messageDraft.threadTitle = ""
10601066
saveMessageDraft()

app/src/main/java/com/nextcloud/talk/ui/dialog/PinnedMessageOptionsDialog.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ fun PinMessageOptions(
139139
onClick = {
140140
onPin(null)
141141
},
142-
content = { Text(stringResource(R.string.pin_indefinitely)) }
142+
content = { Text(stringResource(R.string.until_unpin)) }
143143
)
144144

145145
HorizontalDivider()

0 commit comments

Comments
 (0)