Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Context
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
Expand Down Expand Up @@ -49,6 +50,7 @@ import daily.dayo.presentation.view.FilledRoundedCornerButton
import daily.dayo.presentation.view.NoRippleIconButton
import daily.dayo.presentation.view.RoundImageView
import daily.dayo.presentation.view.TopNavigation
import daily.dayo.presentation.view.TopNavigationAlign
import daily.dayo.presentation.viewmodel.ProfileSettingViewModel
import daily.dayo.presentation.viewmodel.ProfileViewModel
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -96,19 +98,25 @@ fun BlockedUsersScreen(
topBar = { BlockedUsersActionbarLayout(onBackClick = onBackClick) },
snackbarHost = { SnackbarHost(snackBarHostState) },
content = { innerPadding ->
Column(
Box(
modifier = Modifier
.background(DayoTheme.colorScheme.background)
.padding(innerPadding)
.fillMaxSize()
.padding(top = 12.dp, start = 20.dp, end = 20.dp)
.padding(top = 12.dp)
) {
LazyColumn(
modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.spacedBy(16.dp),
contentPadding = PaddingValues(vertical = 16.dp)
) {
if (blockedUsers.status != Status.ERROR) {
if (blockedUsers.status == Status.ERROR) {
BlockedUsersErrorLayout(
onRetry = { profileSettingViewModel.requestBlockList() },
)
} else {
LazyColumn(
Comment on lines +108 to +113
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

로딩 상태가 빈 상태로 오인 노출됩니다.

Line 108-113 로직에서는 Status.ERROR만 분기하고 나머지를 동일 처리해서, Status.LOADING일 때도 빈 상태 UI가 보일 수 있습니다. when으로 LOADING/ERROR/SUCCESS를 명시 분기해 주세요.

안전한 상태 분기 예시 diff
-                if (blockedUsers.status == Status.ERROR) {
-                    BlockedUsersErrorLayout(
-                        onRetry = { profileSettingViewModel.requestBlockList() },
-                    )
-                } else {
+                when (blockedUsers.status) {
+                    Status.ERROR -> {
+                        BlockedUsersErrorLayout(
+                            onRetry = { profileSettingViewModel.requestBlockList() },
+                        )
+                    }
+                    Status.LOADING -> {
+                        // TODO: 로딩 상태 UI (progress/skeleton)
+                    }
+                    Status.SUCCESS -> {
                     LazyColumn(
                         modifier = Modifier
                             .fillMaxSize()
                             .padding(start = 20.dp, end = 20.dp),
                         verticalArrangement = Arrangement.spacedBy(16.dp),
                         contentPadding = PaddingValues(vertical = 16.dp)
                     ) {
                         blockedUsers.data.orEmpty().let { blockedUsers ->
                             if (blockedUsers.isEmpty()) {
                                 item {
                                     Column(
...
                                     )
                                 }
                             } else {
                                 itemsIndexed(
                                     blockedUsers,
                                     key = { _, user -> user.memberId }
                                 ) { _, user ->
...
                                 }
                             }
                         }
                     }
-                }
+                    }
+                }

As per coding guidelines "one when expression handles all NetworkResponse branches".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@presentation/src/main/java/daily/dayo/presentation/screen/settings/BlockedUsersScreen.kt`
around lines 108 - 113, The current UI branches only check Status.ERROR and
treats all other states the same, causing Status.LOADING to render the
empty-state LazyColumn; update the branching in BlockedUsersScreen (use a when
on blockedUsers.status) to explicitly handle Status.LOADING (render a loading
indicator), Status.ERROR (render BlockedUsersErrorLayout with onRetry calling
profileSettingViewModel.requestBlockList()), and Status.SUCCESS (render the
LazyColumn with the actual content), ensuring all NetworkResponse branches are
covered in one when expression.

modifier = Modifier
.fillMaxSize()
.padding(start = 20.dp, end = 20.dp),
verticalArrangement = Arrangement.spacedBy(16.dp),
contentPadding = PaddingValues(vertical = 16.dp)
) {
blockedUsers.data.orEmpty().let { blockedUsers ->
if (blockedUsers.isEmpty()) {
item {
Expand Down Expand Up @@ -159,48 +167,57 @@ fun BlockedUsersScreen(
}
}
}
} else {
item {
Column(
modifier = Modifier
.fillMaxSize()
.padding(top = 164.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Image(
painter = painterResource(id = R.drawable.ic_blocked_users_empty),
contentDescription = null,
modifier = Modifier
.width(136.dp)
.wrapContentHeight()
.padding(6.5.dp)
)
Spacer(modifier = Modifier.height(20.dp))
Text(
text = stringResource(R.string.blocked_users_error_description),
color = Gray3_9FA5AE,
style = DayoTheme.typography.b3,
modifier = Modifier
.wrapContentSize()
)
Spacer(modifier = Modifier.height(20.dp))
FilledRoundedCornerButton(
modifier = Modifier
.padding(horizontal = 20.dp)
.wrapContentSize(),
onClick = { profileSettingViewModel.requestBlockList() },
label = stringResource(R.string.re_try)
)
}
}
}
}
}
}
)
}

@Composable
private fun BlockedUsersErrorLayout(
onRetry: () -> Unit,
) {
Column(
modifier = Modifier
.fillMaxSize()
.padding(horizontal = 20.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Spacer(modifier = Modifier.weight(176f))

Column(
modifier = Modifier.wrapContentHeight(),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Image(
painter = painterResource(id = R.drawable.ic_blocked_users_empty),
contentDescription = null,
modifier = Modifier
.width(136.dp)
.height(100.dp)
)
Spacer(modifier = Modifier.height(20.dp))
Text(
text = stringResource(R.string.blocked_users_error_description),
style = DayoTheme.typography.h3.copy(color = Gray3_9FA5AE),
modifier = Modifier.wrapContentSize()
)
}

Spacer(modifier = Modifier.weight(336f))

FilledRoundedCornerButton(
modifier = Modifier
.fillMaxWidth()
.height(52.dp)
.padding(bottom = 20.dp),
onClick = onRetry,
label = stringResource(R.string.re_try),
)
}
}

@Preview
@Composable
fun BlockedUser(
Expand Down Expand Up @@ -261,5 +278,6 @@ fun BlockedUsersActionbarLayout(
)
},
title = stringResource(R.string.blocked_users_title),
titleAlignment = TopNavigationAlign.CENTER,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fun TopNavigation(
navigationIcon = leftIcon,
actions = { rightIcon() },
title = {
Text(text = title, maxLines = 1, style = DayoTheme.typography.h3)
Text(text = title, maxLines = 1, style = DayoTheme.typography.b3)
}
)
}
Expand All @@ -55,7 +55,7 @@ fun TopNavigation(
navigationIcon = leftIcon,
actions = { rightIcon() },
title = {
Text(text = title, maxLines = 1, style = DayoTheme.typography.h3)
Text(text = title, maxLines = 1, style = DayoTheme.typography.b3)
}
)
}
Expand Down
49 changes: 8 additions & 41 deletions presentation/src/main/res/drawable/ic_blocked_users_empty.xml
Original file line number Diff line number Diff line change
@@ -1,42 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="137dp"
android:height="100dp"
android:autoMirrored="true"
android:viewportWidth="137"
android:viewportHeight="100">

<group>

<clip-path android:pathData="M20.5,6h96.91v88.3h-96.91z" />

<path
android:fillColor="#F6F6F7"
android:pathData="M68.95,94.31C95.71,94.31 117.4,91.57 117.4,88.18C117.4,84.8 95.71,82.05 68.95,82.05C42.19,82.05 20.5,84.8 20.5,88.18C20.5,91.57 42.19,94.31 68.95,94.31Z" />

<path
android:fillColor="#ffffff"
android:pathData="M57.12,63.96C70.36,63.96 81.1,53.22 81.1,39.98C81.1,26.74 70.36,16 57.12,16C43.88,16 33.14,26.74 33.14,39.98C33.14,53.22 43.88,63.96 57.12,63.96Z" />

<path
android:fillColor="#E8EAEE"
android:pathData="M106.02,80.38L94.58,68.94C90.4,64.76 85.73,61.05 80.7,57.93L80.03,57.51L74.67,62.88L75.09,63.55C78.21,68.57 81.92,73.24 86.1,77.43L97.54,88.87C98.23,89.56 99.15,89.94 100.13,89.94C101.11,89.94 102.03,89.56 102.72,88.87L106.03,85.56C107.46,84.13 107.46,81.81 106.03,80.38H106.02Z" />

<path
android:fillColor="#F6F6F7"
android:pathData="M94.58,68.94C90.4,64.76 85.73,61.05 80.7,57.93L80.03,57.51L74.67,62.88L75.09,63.55C78.21,68.57 81.92,73.24 86.1,77.43L94.58,68.95V68.94Z" />

<path
android:fillColor="#F6F6F7"
android:pathData="M57.12,73.97C38.38,73.97 23.13,58.72 23.13,39.99C23.13,21.26 38.38,6 57.12,6C75.86,6 91.1,21.25 91.1,39.99C91.1,49.07 87.56,57.6 81.15,64.02C74.74,70.44 66.2,73.97 57.12,73.97ZM57.12,16C43.89,16 33.13,26.76 33.13,39.99C33.13,53.22 43.89,63.97 57.12,63.97C63.53,63.97 69.55,61.48 74.08,56.95C78.61,52.42 81.1,46.4 81.1,39.99C81.1,26.76 70.34,16 57.12,16Z" />

<path
android:fillColor="#E8EAEE"
android:pathData="M50.23,28.59L45.99,32.83L64.54,51.39L68.79,47.15L50.23,28.59Z" />

<path
android:fillColor="#E8EAEE"
android:pathData="M64.54,28.59L45.99,47.15L50.23,51.39L68.79,32.83L64.54,28.59Z" />

</group>

<vector xmlns:android="http://schemas.android.com/apk/res/android" android:autoMirrored="true" android:height="100dp" android:viewportHeight="100" android:viewportWidth="136" android:width="136dp">

<path android:fillColor="#F6F6F7" android:pathData="M100.33,50.42C100.33,32.58 85.88,18.13 68.04,18.13C50.21,18.13 35.75,32.58 35.75,50.42C35.75,68.25 50.21,82.71 68.04,82.71C85.88,82.71 100.33,68.25 100.33,50.42ZM106.58,50.42C106.58,71.7 89.33,88.96 68.04,88.96C46.76,88.96 29.5,71.7 29.5,50.42C29.5,29.13 46.76,11.88 68.04,11.88C89.33,11.88 106.58,29.13 106.58,50.42Z" android:strokeColor="#F6F6F7" android:strokeWidth="3"/>

<path android:fillColor="#E8EAEE" android:pathData="M68.12,72.25C70.61,72.25 72.62,70.23 72.62,67.75C72.62,65.26 70.61,63.25 68.12,63.25C65.64,63.25 63.63,65.26 63.63,67.75C63.63,70.23 65.64,72.25 68.12,72.25Z" android:strokeColor="#E8EAEE" android:strokeWidth="1"/>

<path android:fillColor="#E8EAEE" android:pathData="M65,54V33C65,31.27 66.39,29.88 68.12,29.88C69.85,29.88 71.25,31.27 71.25,33V54L71.24,54.16C71.16,55.81 69.79,57.13 68.12,57.13C66.45,57.13 65.08,55.81 65,54.16L65,54Z" android:strokeColor="#E8EAEE" android:strokeLineCap="round" android:strokeWidth="2"/>

</vector>
2 changes: 1 addition & 1 deletion presentation/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<string name="loading_default_message">잠시만 기다려 주세요</string>
<string name="network_error_dialog_default_message">인터넷 연결 상태를 확인해주세요</string>
<string name="close_sign">닫기</string>
<string name="re_try">재시도</string>
<string name="re_try">다시 시도</string>

<!-- Time -->
<string name="time_now">방금 전</string>
Expand Down
Loading