auth to server-V53

This commit is contained in:
Eric85710 2026-05-05 17:04:42 +08:00
parent 0e8ecb74b6
commit 160247d05f
2 changed files with 15 additions and 3 deletions

View file

@ -29,7 +29,7 @@ data class UserProfileUpdateRequest(
val status: String? = null val status: String? = null
) )
val UserProfile.fullAvatarUrl: Any? val UserProfile.fullAvatarUrl: Any
get() = if (avatar_url.isNullOrBlank()) { get() = if (avatar_url.isNullOrBlank()) {
R.drawable.avatar_v1 // 如果沒網址,直接回傳預設圖片資源 R.drawable.avatar_v1 // 如果沒網址,直接回傳預設圖片資源
} else if (avatar_url.startsWith("http")) { } else if (avatar_url.startsWith("http")) {
@ -37,3 +37,12 @@ val UserProfile.fullAvatarUrl: Any?
} else { } else {
"http://192.168.0.217$avatar_url" // 否則補上 Base URL "http://192.168.0.217$avatar_url" // 否則補上 Base URL
} }
val UserProfile.fullBannerUrl: Any
get() = if (banner_url.isNullOrBlank()) {
R.drawable.thumbnail_v1 // 如果沒網址,直接回傳預設圖片資源
} else if (banner_url.startsWith("http")) {
banner_url // 已經是完整網址就直接用
} else {
"http://192.168.0.217$banner_url" // 否則補上 Base URL
}

View file

@ -165,11 +165,14 @@ fun Loaded_setting_profile_page(
){ ){
// 1. 封面圖 (背景) // 1. 封面圖 (背景)
AsyncImage( AsyncImage(
model = profile.banner_url, model = profile.fullAvatarUrl,
contentDescription = "Avatar of ${profile.display_name}", contentDescription = "Avatar of ${profile.display_name}",
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.height(180.dp) .height(180.dp)
.clickable {
bannerLauncher.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly))
}
, ,
contentScale = ContentScale.Crop, contentScale = ContentScale.Crop,
error = painterResource(R.drawable.thumbnail_v1) error = painterResource(R.drawable.thumbnail_v1)
@ -347,7 +350,7 @@ fun Loaded_setting_profile_page(
if (activeEditTarget != null) { if (activeEditTarget != null) {
AlertDialog( AlertDialog(
onDismissRequest = { activeEditTarget = null }, onDismissRequest = { activeEditTarget = null },
containerColor = MaterialTheme.colorScheme.primary, containerColor = Color.White,
title = { Text(activeEditTarget?.title ?: "") }, title = { Text(activeEditTarget?.title ?: "") },
text = { text = {
TextField( TextField(