dm-2
This commit is contained in:
parent
809af3a86f
commit
93fa0fd931
2 changed files with 13 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package com.example.login_v3.data.api.api_class
|
||||
|
||||
import com.example.login_v3.R
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
|
|
@ -62,3 +63,12 @@ data class Reaction(
|
|||
@Json(name = "count") val count: Int,
|
||||
@Json(name = "me_reacted") val meReacted: Boolean
|
||||
)
|
||||
|
||||
val Partner.fullContactAvatarUrl: Any
|
||||
get() = if (avatarUrl.isNullOrBlank()) {
|
||||
R.drawable.avatar_v1 // 如果沒網址,直接回傳預設圖片資源
|
||||
} else if (avatarUrl.startsWith("http")) {
|
||||
avatarUrl // 已經是完整網址就直接用
|
||||
} else {
|
||||
"http://192.168.0.217$avatarUrl" // 否則補上 Base URL
|
||||
}
|
||||
|
|
@ -65,6 +65,7 @@ import androidx.navigation.compose.composable
|
|||
import androidx.navigation.compose.rememberNavController
|
||||
import coil.compose.AsyncImage
|
||||
import com.example.login_v3.data.api.api_class.ChatRoom
|
||||
import com.example.login_v3.data.api.api_class.fullContactAvatarUrl
|
||||
import com.example.login_v3.home.Message.UI.Detail.Message_add_contact
|
||||
import com.example.login_v3.home.Message.UI.Detail.Message_contact_list
|
||||
import com.example.login_v3.home.Message.UI.Detail.Scan_QRcode
|
||||
|
|
@ -295,7 +296,7 @@ fun RoomItem(
|
|||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
// 1. 頭像處理
|
||||
val imageUrl = room.roomIconUrl ?: room.partner?.avatarUrl
|
||||
val imageUrl = room.roomIconUrl ?: room.partner?.fullContactAvatarUrl
|
||||
AsyncImage(
|
||||
model = imageUrl,
|
||||
contentDescription = "Avatar",
|
||||
|
|
|
|||
Loading…
Reference in a new issue