-
Notifications
You must be signed in to change notification settings - Fork 0
[Feat] Splash 화면 컴포즈 마이그레이션 #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
144d4a1
183fd2f
e7b5f9e
4f36432
4ff90b8
6e4f11e
616708f
fdfd8cc
b360f56
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package com.daedan.festabook.presentation.splash | ||
|
|
||
| sealed interface SplashUiState { | ||
| data object Loading : SplashUiState | ||
|
|
||
| data object ShowUpdateDialog : SplashUiState | ||
|
|
||
| data object ShowNetworkErrorDialog : SplashUiState | ||
|
|
||
| data class NavigateToMain( | ||
| val festivalId: Long, | ||
| ) : SplashUiState | ||
|
|
||
| data object NavigateToExplore : SplashUiState | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| package com.daedan.festabook.presentation.splash.component | ||
|
|
||
| import androidx.annotation.DrawableRes | ||
| import androidx.compose.foundation.Image | ||
| import androidx.compose.foundation.background | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.Spacer | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.foundation.layout.height | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.foundation.layout.size | ||
| import androidx.compose.material3.Button | ||
| import androidx.compose.material3.ButtonDefaults | ||
| 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.res.stringResource | ||
| import androidx.compose.ui.text.style.TextAlign | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
| import androidx.compose.ui.window.Dialog | ||
| import com.daedan.festabook.R | ||
| import com.daedan.festabook.presentation.theme.FestabookColor | ||
| import com.daedan.festabook.presentation.theme.FestabookTheme | ||
| import com.daedan.festabook.presentation.theme.FestabookTypography | ||
| import com.daedan.festabook.presentation.theme.festabookShapes | ||
|
|
||
| @Composable | ||
| fun UpdateDialog(onConfirm: () -> Unit) { | ||
| SplashInfoDialog( | ||
| title = stringResource(id = R.string.update_notice_title), | ||
| message = stringResource(id = R.string.update_notice_message), | ||
| buttonText = stringResource(id = R.string.update_notice_confirm), | ||
| iconResId = R.drawable.ic_alarm, | ||
| confirmButtonColor = FestabookColor.accentBlue, | ||
| onConfirm = onConfirm, | ||
| ) | ||
| } | ||
|
|
||
| @Composable | ||
| fun NetworkErrorDialog(onConfirm: () -> Unit) { | ||
| SplashInfoDialog( | ||
| title = stringResource(id = R.string.update_failed_title), | ||
| message = stringResource(id = R.string.update_failed_message), | ||
| buttonText = stringResource(id = R.string.update_failed_confirm), | ||
| confirmButtonColor = FestabookColor.gray400, | ||
| onConfirm = onConfirm, | ||
| ) | ||
| } | ||
|
|
||
| @Composable | ||
| private fun SplashInfoDialog( | ||
| title: String, | ||
| message: String, | ||
| buttonText: String, | ||
| confirmButtonColor: Color, | ||
| @DrawableRes iconResId: Int? = null, | ||
| onConfirm: () -> Unit, | ||
| ) { | ||
| Dialog(onDismissRequest = {}) { | ||
|
||
| Column( | ||
| modifier = | ||
| Modifier | ||
| .background( | ||
| color = FestabookColor.white, | ||
| shape = festabookShapes.radius4, | ||
| ).padding(24.dp), | ||
| horizontalAlignment = Alignment.CenterHorizontally, | ||
| ) { | ||
| iconResId?.let { | ||
| Image( | ||
| painter = painterResource(id = it), | ||
| contentDescription = null, | ||
| modifier = Modifier.size(24.dp), | ||
| ) | ||
| Spacer(modifier = Modifier.height(16.dp)) | ||
| } | ||
|
|
||
| Text( | ||
| text = title, | ||
| style = FestabookTypography.displaySmall, | ||
| textAlign = TextAlign.Center, | ||
| color = FestabookColor.gray800, | ||
| ) | ||
|
|
||
| Spacer(modifier = Modifier.height(16.dp)) | ||
|
|
||
| Text( | ||
| text = message, | ||
| style = FestabookTypography.bodyMedium, | ||
| textAlign = TextAlign.Center, | ||
| color = FestabookColor.gray800, | ||
| ) | ||
|
|
||
| Spacer(modifier = Modifier.height(24.dp)) | ||
|
|
||
| Button( | ||
| onClick = onConfirm, | ||
| modifier = | ||
| Modifier | ||
| .fillMaxWidth(), | ||
| colors = | ||
| ButtonDefaults.buttonColors( | ||
| containerColor = confirmButtonColor, | ||
| contentColor = FestabookColor.white, | ||
| ), | ||
| shape = festabookShapes.radiusFull, | ||
| ) { | ||
| Text(text = buttonText) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Preview | ||
| @Composable | ||
| private fun UpdateDialogPreview() { | ||
| FestabookTheme { | ||
| UpdateDialog(onConfirm = {}) | ||
| } | ||
| } | ||
|
|
||
| @Preview | ||
| @Composable | ||
| private fun NetworkErrorDialogPreview() { | ||
| FestabookTheme { | ||
| NetworkErrorDialog(onConfirm = {}) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -148,10 +148,10 @@ | |||||||||||||||||||
|
|
||||||||||||||||||||
| <!--앱 업데이트--> | ||||||||||||||||||||
| <string name="update_notice_title">신규 버전 출시 안내</string> | ||||||||||||||||||||
| <string name="update_notice_message">새로운 버전이 출시되었습니다.\n 더 나은 사용을 위해 앱을 업데이트해 주세요</string> | ||||||||||||||||||||
| <string name="update_notice_message">새로운 버전이 출시되었어요.\n 더 나은 사용을 위해 앱을 업데이트해 주세요.</string> | ||||||||||||||||||||
| <string name="update_notice_confirm">업데이트</string> | ||||||||||||||||||||
| <string name="update_failed_title">서버 통신 실패</string> | ||||||||||||||||||||
| <string name="update_failed_message">앱 서버에 접속할 수 없습니다. 다시 시도해주세요</string> | ||||||||||||||||||||
| <string name="update_failed_message">앱 서버에 접속할 수 없습니다. 다시 시도해주세요.</string> | ||||||||||||||||||||
|
Comment on lines
+151
to
+154
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 줄바꿈 뒤 선행 공백으로 들여쓰기 발생 가능 ✂️ 제안 수정안- <string name="update_notice_message">새로운 버전이 출시되었어요.\n 더 나은 사용을 위해 앱을 업데이트해 주세요.</string>
+ <string name="update_notice_message">새로운 버전이 출시되었어요.\n더 나은 사용을 위해 앱을 업데이트해 주세요.</string>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| <string name="update_failed_confirm">종료</string> | ||||||||||||||||||||
| <string name="explore_btn_backToMain_content_desc">홈화면으로 돌아가기</string> | ||||||||||||||||||||
| <string name="explore_toolbar_title">축제 검색</string> | ||||||||||||||||||||
|
|
||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: festabook/android
Length of output: 87
🏁 Script executed:
Repository: festabook/android
Length of output: 87
🏁 Script executed:
Repository: festabook/android
Length of output: 240
🏁 Script executed:
Repository: festabook/android
Length of output: 322
🏁 Script executed:
Repository: festabook/android
Length of output: 1647
🏁 Script executed:
Repository: festabook/android
Length of output: 1994
SharedPreferences I/O로 인한 메인 스레드 블로킹 위험을 반드시 해결하세요.
getFestivalId()는 SharedPreferences의 동기 연산(getLong())을 사용하므로 메인 스레드를 블로킹합니다. 특히 첫 실행 시 디스크에서 읽기가 발생할 수 있어 스플래시 화면에서 UI 지연이 발생할 수 있습니다. 아래와 같이 IO 디스패처로 이동해 주세요.🔧 수정 예시
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
토끼야 날카로웠다?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@parkjiminnnn감사합니다! 😊 스플래시 화면에서 UI 블로킹이 발생하지 않도록 SharedPreferences 읽기를 IO 디스패처로 옮기시면 더 부드러운 사용자 경험을 제공하실 수 있을 거예요.