Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
@@ -0,0 +1,105 @@
package com.sopt.clody.presentation.ui.component.dialog

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import com.sopt.clody.R
import com.sopt.clody.presentation.utils.base.BasePreview
import com.sopt.clody.presentation.utils.base.ClodyPreview
import com.sopt.clody.ui.theme.ClodyTheme

@Composable
fun InspectionDialog(
onDismiss: () -> Unit,
) {
Dialog(
onDismissRequest = onDismiss,
properties = DialogProperties(
dismissOnClickOutside = false,
usePlatformDefaultWidth = false,
),
) {
Box(
modifier = Modifier
.fillMaxSize()
.background(Color.Black.copy(alpha = 0.5f))
.wrapContentSize(Alignment.Center)
.padding(horizontal = 24.dp),
) {
Card(
shape = RoundedCornerShape(12.dp),
colors = CardDefaults.cardColors(containerColor = ClodyTheme.colors.white),
) {
Column(
modifier = Modifier.padding(20.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Image(
painter = painterResource(id = R.drawable.img_inspection_dialog),
contentDescription = null,
)
Spacer(modifier = Modifier.height(20.dp))
Comment on lines +60 to +64
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Image lacks an accessibility description

Provide a meaningful contentDescription or explicitly set it to an empty string "" with a comment explaining that it’s decorative.

-                    Image(
-                        painter = painterResource(id = R.drawable.img_inspection_dialog),
-                        contentDescription = null,
-                    )
+                    Image(
+                        painter = painterResource(id = R.drawable.img_inspection_dialog),
+                        contentDescription = stringResource(R.string.desc_inspection_image), // or "" if purely decorative
+                    )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Image(
painter = painterResource(id = R.drawable.img_inspection_dialog),
contentDescription = null,
)
Spacer(modifier = Modifier.height(20.dp))
Image(
painter = painterResource(id = R.drawable.img_inspection_dialog),
contentDescription = stringResource(R.string.desc_inspection_image), // or "" if purely decorative
)
Spacer(modifier = Modifier.height(20.dp))
🤖 Prompt for AI Agents
In
app/src/main/java/com/sopt/clody/presentation/ui/component/dialog/InspectionDialog.kt
around lines 59 to 63, the Image composable is missing a contentDescription,
which is important for accessibility. Fix this by providing a meaningful
contentDescription if the image conveys important information, or set
contentDescription to an empty string "" with a comment explaining that the
image is purely decorative.

Text(
text = "보다 안정적인 클로디 서비스를 위해\n시스템 점검 중이에요. 곧 다시 만나요!",
color = ClodyTheme.colors.gray03,
textAlign = TextAlign.Center,
style = ClodyTheme.typography.body3Medium,
)
Spacer(modifier = Modifier.height(8.dp))
Text(
text = "점검시간 : ",
color = ClodyTheme.colors.gray04,
textAlign = TextAlign.Center,
style = ClodyTheme.typography.body3Medium,
)
Comment on lines +65 to +77
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Hard-coded Korean strings hinder localisation & reuse

Move the message and time label to strings.xml and fetch with stringResource().
Also consider passing the time string as a parameter so the dialog can display dynamic maintenance windows.

-                        text = "보다 안정적인 클로디 서비스를 위해\n시스템 점검 중이에요. 곧 다시 만나요!",
+                        text = stringResource(R.string.inspection_dialog_message),
...
-                        text = "점검시간 : ",
+                        text = stringResource(R.string.inspection_dialog_time_prefix, inspectionTime),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
text = "보다 안정적인 클로디 서비스를 위해\n시스템 점검 중이에요. 곧 다시 만나요!",
color = ClodyTheme.colors.gray03,
textAlign = TextAlign.Center,
style = ClodyTheme.typography.body3Medium,
)
Spacer(modifier = Modifier.height(8.dp))
Text(
text = "점검시간 : ",
color = ClodyTheme.colors.gray04,
textAlign = TextAlign.Center,
style = ClodyTheme.typography.body3Medium,
)
// 기존 하드코딩 문자열을 리소스로 대체
text = stringResource(R.string.inspection_dialog_message),
color = ClodyTheme.colors.gray03,
textAlign = TextAlign.Center,
style = ClodyTheme.typography.body3Medium,
)
Spacer(modifier = Modifier.height(8.dp))
Text(
// 시간 프리픽스도 리소스로, dynamic 매개변수(inspectionTime) 전달
text = stringResource(R.string.inspection_dialog_time_prefix, inspectionTime),
color = ClodyTheme.colors.gray04,
textAlign = TextAlign.Center,
style = ClodyTheme.typography.body3Medium,
)
🤖 Prompt for AI Agents
In
app/src/main/java/com/sopt/clody/presentation/ui/component/dialog/InspectionDialog.kt
around lines 65 to 76, the Korean text strings are hard-coded, which prevents
localization and reuse. Move these strings to strings.xml resource file and
replace the hard-coded text with calls to stringResource() to fetch them.
Additionally, modify the dialog to accept the maintenance time as a parameter so
it can display dynamic maintenance windows instead of a fixed label.

Spacer(modifier = Modifier.height(24.dp))
Button(
onClick = onDismiss,
modifier = Modifier
.fillMaxWidth(),
shape = RoundedCornerShape(8.dp),
colors = ButtonDefaults.buttonColors(ClodyTheme.colors.mainYellow),
) {
Text(
text = "확인 후 앱 종료",
color = ClodyTheme.colors.gray02,
style = ClodyTheme.typography.body3SemiBold,
)
}
}
}
}
}
}

@ClodyPreview
@Composable
private fun PreviewInspectionDialog() {
BasePreview {
InspectionDialog(
onDismiss = {},
)
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.