auth to server-V53
This commit is contained in:
parent
0e8ecb74b6
commit
160247d05f
2 changed files with 15 additions and 3 deletions
|
|
@ -29,11 +29,20 @@ 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")) {
|
||||||
avatar_url // 已經是完整網址就直接用
|
avatar_url // 已經是完整網址就直接用
|
||||||
} 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
|
||||||
}
|
}
|
||||||
|
|
@ -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(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue