替换聊天界面发送按钮图标;
修复群聊天界面顶部不显示群头像以及组件异常显示; 修改群聊信息界面群记忆UI
This commit is contained in:
@@ -617,7 +617,7 @@ fun ChatAiInput(
|
|||||||
animationSpec = tween(300)
|
animationSpec = tween(300)
|
||||||
)
|
)
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(R.mipmap.rider_pro_im_send),
|
painter = painterResource(R.mipmap.btn),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(24.dp)
|
.size(24.dp)
|
||||||
.alpha(alpha)
|
.alpha(alpha)
|
||||||
|
|||||||
@@ -650,7 +650,7 @@ fun ChatInput(
|
|||||||
animationSpec = tween(300)
|
animationSpec = tween(300)
|
||||||
)
|
)
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(R.mipmap.rider_pro_im_send),
|
painter = painterResource(R.mipmap.btn),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(24.dp)
|
.size(24.dp)
|
||||||
.alpha(alpha)
|
.alpha(alpha)
|
||||||
|
|||||||
@@ -182,46 +182,22 @@ fun GroupChatScreen(groupId: String,name: String,avatar: String,) {
|
|||||||
colorFilter = ColorFilter.tint(AppColors.text)
|
colorFilter = ColorFilter.tint(AppColors.text)
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.width(16.dp))
|
Spacer(modifier = Modifier.width(16.dp))
|
||||||
|
|
||||||
if (viewModel.groupAvatar.isNotEmpty()) {
|
if (viewModel.groupInfo?.groupAvatar?.isNotEmpty() == true) {
|
||||||
CustomAsyncImage(
|
CustomAsyncImage(
|
||||||
imageUrl = viewModel.groupAvatar,
|
imageUrl = viewModel.groupInfo!!.groupAvatar,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(32.dp)
|
.size(35.dp)
|
||||||
.clip(RoundedCornerShape(8.dp))
|
.clip(RoundedCornerShape(15.dp)),
|
||||||
.noRippleClickable {
|
|
||||||
navController.navigateToGroupInfo(groupId)
|
|
||||||
},
|
|
||||||
contentDescription = "群聊头像"
|
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))
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
Column {
|
Column(
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
horizontalAlignment = Alignment.Start
|
||||||
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = viewModel.groupName,
|
text = viewModel.groupName,
|
||||||
style = TextStyle(
|
style = TextStyle(
|
||||||
@@ -229,24 +205,21 @@ fun GroupChatScreen(groupId: String,name: String,avatar: String,) {
|
|||||||
fontSize = 18.sp,
|
fontSize = 18.sp,
|
||||||
fontWeight = androidx.compose.ui.text.font.FontWeight.Bold
|
fontWeight = androidx.compose.ui.text.font.FontWeight.Bold
|
||||||
),
|
),
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow =TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
Image(
|
||||||
Box {
|
painter = painterResource(R.drawable.rider_pro_more_horizon),
|
||||||
Image(
|
modifier = Modifier
|
||||||
painter = painterResource(R.drawable.rider_pro_more_horizon),
|
.size(28.dp)
|
||||||
modifier = Modifier
|
.noRippleClickable {
|
||||||
.size(28.dp)
|
navController.navigateToGroupInfo(groupId)
|
||||||
.noRippleClickable {
|
},
|
||||||
navController.navigateToGroupInfo(groupId)
|
contentDescription = "更多",
|
||||||
},
|
colorFilter = ColorFilter.tint(AppColors.text)
|
||||||
contentDescription = null,
|
)
|
||||||
colorFilter = ColorFilter.tint(AppColors.text)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -677,7 +650,7 @@ fun GroupChatInput(
|
|||||||
animationSpec = tween(300)
|
animationSpec = tween(300)
|
||||||
)
|
)
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(R.mipmap.rider_pro_im_send),
|
painter = painterResource(R.mipmap.btn),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(24.dp)
|
.size(24.dp)
|
||||||
.alpha(alpha)
|
.alpha(alpha)
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
package com.aiosman.ravenow.ui.chat
|
package com.aiosman.ravenow.ui.chat
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.util.Base64
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
|
import com.aiosman.ravenow.AppStore
|
||||||
import com.aiosman.ravenow.data.api.ApiClient
|
import com.aiosman.ravenow.data.api.ApiClient
|
||||||
import com.aiosman.ravenow.data.api.SendChatAiRequestBody
|
import com.aiosman.ravenow.data.api.SendChatAiRequestBody
|
||||||
import io.openim.android.sdk.enums.ConversationType
|
import io.openim.android.sdk.enums.ConversationType
|
||||||
@@ -50,17 +52,46 @@ class GroupChatViewModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun getGroupInfo() {
|
private suspend fun getGroupInfo() {
|
||||||
// 简化群组信息获取,使用默认信息
|
try {
|
||||||
groupInfo = GroupInfo(
|
val response = ApiClient.api.getRoomDetail(trtcId = groupId)
|
||||||
groupId = groupId,
|
val room = response.body()?.data
|
||||||
groupName = name,
|
groupInfo = room?.let {
|
||||||
groupAvatar = avatar,
|
GroupInfo(
|
||||||
memberCount = 0,
|
groupId = groupId,
|
||||||
ownerId = ""
|
groupName = it.name,
|
||||||
)
|
groupAvatar = if (it.avatar.isNullOrEmpty()) {
|
||||||
groupName = groupInfo?.groupName ?: ""
|
val groupIdBase64 = Base64.encodeToString(
|
||||||
groupAvatar = groupInfo?.groupAvatar ?: ""
|
groupId.toByteArray(),
|
||||||
memberCount = groupInfo?.memberCount ?: 0
|
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> {
|
override fun getConversationParams(): Triple<String, Int, Boolean> {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.aiosman.ravenow.ui.group
|
|||||||
|
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.border
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
@@ -302,8 +303,9 @@ fun GroupChatInfoScreen(groupId: String) {
|
|||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
.border(1.dp, AppColors.decentBackground, RoundedCornerShape(12.dp))
|
||||||
.clip(RoundedCornerShape(12.dp))
|
.clip(RoundedCornerShape(12.dp))
|
||||||
.background(AppColors.decentBackground.copy(alpha = 0.28f))
|
.background(AppColors.background)
|
||||||
.padding(12.dp)
|
.padding(12.dp)
|
||||||
) {
|
) {
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
@@ -340,7 +342,7 @@ fun GroupChatInfoScreen(groupId: String) {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.clip(RoundedCornerShape(20.dp))
|
.clip(RoundedCornerShape(20.dp))
|
||||||
.background(AppColors.background)
|
.background(AppColors.decentBackground)
|
||||||
.padding(vertical = 8.dp)
|
.padding(vertical = 8.dp)
|
||||||
.noRippleClickable {
|
.noRippleClickable {
|
||||||
showAddMemoryDialog = true
|
showAddMemoryDialog = true
|
||||||
@@ -359,7 +361,7 @@ fun GroupChatInfoScreen(groupId: String) {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.clip(RoundedCornerShape(20.dp))
|
.clip(RoundedCornerShape(20.dp))
|
||||||
.background(AppColors.background)
|
.background(AppColors.decentBackground)
|
||||||
.padding(vertical = 8.dp)
|
.padding(vertical = 8.dp)
|
||||||
.noRippleClickable {
|
.noRippleClickable {
|
||||||
showMemoryManageDialog = true
|
showMemoryManageDialog = true
|
||||||
|
|||||||
Reference in New Issue
Block a user