替换聊天界面发送按钮图标;

修复群聊天界面顶部不显示群头像以及组件异常显示;
修改群聊信息界面群记忆UI
This commit is contained in:
2025-11-27 18:57:54 +08:00
parent fe78b5192b
commit 084eb7bb52
5 changed files with 71 additions and 65 deletions

View File

@@ -617,7 +617,7 @@ fun ChatAiInput(
animationSpec = tween(300)
)
Image(
painter = painterResource(R.mipmap.rider_pro_im_send),
painter = painterResource(R.mipmap.btn),
modifier = Modifier
.size(24.dp)
.alpha(alpha)

View File

@@ -650,7 +650,7 @@ fun ChatInput(
animationSpec = tween(300)
)
Image(
painter = painterResource(R.mipmap.rider_pro_im_send),
painter = painterResource(R.mipmap.btn),
modifier = Modifier
.size(24.dp)
.alpha(alpha)

View File

@@ -183,45 +183,21 @@ fun GroupChatScreen(groupId: String,name: String,avatar: String,) {
)
Spacer(modifier = Modifier.width(16.dp))
if (viewModel.groupAvatar.isNotEmpty()) {
if (viewModel.groupInfo?.groupAvatar?.isNotEmpty() == true) {
CustomAsyncImage(
imageUrl = viewModel.groupAvatar,
imageUrl = viewModel.groupInfo!!.groupAvatar,
modifier = Modifier
.size(32.dp)
.clip(RoundedCornerShape(8.dp))
.noRippleClickable {
navController.navigateToGroupInfo(groupId)
},
.size(35.dp)
.clip(RoundedCornerShape(15.dp)),
contentDescription = "群聊头像"
)
} else {
Box(
modifier = Modifier
.size(24.dp)
.clip(RoundedCornerShape(8.dp))
.background(AppColors.decentBackground)
.noRippleClickable {
navController.navigateToGroupInfo(groupId)
},
contentAlignment = Alignment.Center
) {
Text(
text = viewModel.groupName,
style = TextStyle(
color = AppColors.text,
fontSize = 18.sp,
fontWeight = androidx.compose.ui.text.font.FontWeight.W700
),
maxLines = 1,
overflow =TextOverflow.Ellipsis,
)
}
}
Spacer(modifier = Modifier.width(8.dp))
Column {
Column(
modifier = Modifier.weight(1f),
horizontalAlignment = Alignment.Start
) {
Text(
text = viewModel.groupName,
style = TextStyle(
@@ -229,24 +205,21 @@ fun GroupChatScreen(groupId: String,name: String,avatar: String,) {
fontSize = 18.sp,
fontWeight = androidx.compose.ui.text.font.FontWeight.Bold
),
maxLines = 1,
overflow =TextOverflow.Ellipsis,
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
}
Spacer(modifier = Modifier.weight(1f))
Box {
Image(
painter = painterResource(R.drawable.rider_pro_more_horizon),
modifier = Modifier
.size(28.dp)
.noRippleClickable {
navController.navigateToGroupInfo(groupId)
},
contentDescription = null,
colorFilter = ColorFilter.tint(AppColors.text)
)
}
Image(
painter = painterResource(R.drawable.rider_pro_more_horizon),
modifier = Modifier
.size(28.dp)
.noRippleClickable {
navController.navigateToGroupInfo(groupId)
},
contentDescription = "更多",
colorFilter = ColorFilter.tint(AppColors.text)
)
}
}
},
@@ -677,7 +650,7 @@ fun GroupChatInput(
animationSpec = tween(300)
)
Image(
painter = painterResource(R.mipmap.rider_pro_im_send),
painter = painterResource(R.mipmap.btn),
modifier = Modifier
.size(24.dp)
.alpha(alpha)

View File

@@ -1,11 +1,13 @@
package com.aiosman.ravenow.ui.chat
import android.content.Context
import android.util.Base64
import android.util.Log
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.lifecycle.viewModelScope
import com.aiosman.ravenow.AppStore
import com.aiosman.ravenow.data.api.ApiClient
import com.aiosman.ravenow.data.api.SendChatAiRequestBody
import io.openim.android.sdk.enums.ConversationType
@@ -50,17 +52,46 @@ class GroupChatViewModel(
}
private suspend fun getGroupInfo() {
// 简化群组信息获取,使用默认信息
groupInfo = GroupInfo(
groupId = groupId,
groupName = name,
groupAvatar = avatar,
memberCount = 0,
ownerId = ""
)
groupName = groupInfo?.groupName ?: ""
groupAvatar = groupInfo?.groupAvatar ?: ""
memberCount = groupInfo?.memberCount ?: 0
try {
val response = ApiClient.api.getRoomDetail(trtcId = groupId)
val room = response.body()?.data
groupInfo = room?.let {
GroupInfo(
groupId = groupId,
groupName = it.name,
groupAvatar = if (it.avatar.isNullOrEmpty()) {
val groupIdBase64 = Base64.encodeToString(
groupId.toByteArray(),
Base64.NO_WRAP
)
"${ApiClient.RETROFIT_URL}group/avatar?groupIdBase64=$groupIdBase64&token=${AppStore.token}"
} else {
"${ApiClient.BASE_API_URL}/outside${it.avatar}?token=${AppStore.token}"
},
memberCount = it.userCount,
ownerId = it.creator.userId
)
} ?: GroupInfo(
groupId = groupId,
groupName = name,
groupAvatar = avatar,
memberCount = 0,
ownerId = ""
)
} catch (e: Exception) {
Log.e("GroupChatViewModel", "加载群信息失败: ${e.message}", e)
groupInfo = GroupInfo(
groupId = groupId,
groupName = name,
groupAvatar = avatar,
memberCount = 0,
ownerId = ""
)
} finally {
groupName = groupInfo?.groupName ?: ""
groupAvatar = groupInfo?.groupAvatar ?: ""
memberCount = groupInfo?.memberCount ?: 0
}
}
override fun getConversationParams(): Triple<String, Int, Boolean> {

View File

@@ -2,6 +2,7 @@ package com.aiosman.ravenow.ui.group
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
@@ -302,8 +303,9 @@ fun GroupChatInfoScreen(groupId: String) {
Column(
modifier = Modifier
.fillMaxWidth()
.border(1.dp, AppColors.decentBackground, RoundedCornerShape(12.dp))
.clip(RoundedCornerShape(12.dp))
.background(AppColors.decentBackground.copy(alpha = 0.28f))
.background(AppColors.background)
.padding(12.dp)
) {
Row(verticalAlignment = Alignment.CenterVertically) {
@@ -340,7 +342,7 @@ fun GroupChatInfoScreen(groupId: String) {
modifier = Modifier
.weight(1f)
.clip(RoundedCornerShape(20.dp))
.background(AppColors.background)
.background(AppColors.decentBackground)
.padding(vertical = 8.dp)
.noRippleClickable {
showAddMemoryDialog = true
@@ -359,7 +361,7 @@ fun GroupChatInfoScreen(groupId: String) {
modifier = Modifier
.weight(1f)
.clip(RoundedCornerShape(20.dp))
.background(AppColors.background)
.background(AppColors.decentBackground)
.padding(vertical = 8.dp)
.noRippleClickable {
showMemoryManageDialog = true