Skip to content
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

[Feature/#928] 로그인 중앙화 UI 구현 #1008

Merged
merged 55 commits into from
Dec 30, 2024
Merged

Conversation

leeeyubin
Copy link
Member

@leeeyubin leeeyubin commented Dec 25, 2024

What is this issue?

  • 로그인 중앙화 UI 작업
  • 로그인 화면 Compose로 마이그레이션

Screenshot

로그인 화면
AuthActivity
회원 인증 화면
CertificateMemberScreen
Screen_Recording_20241225_070137_SOPT.DEBUG.mp4
Screen_Recording_20241225_073953_SOPT.DEBUG.mp4
로그인 오류 화면
AuthErrorScreen
전화번호 인증 화면
CertificateAccountScreen
소셜계정 설정 화면
ChangeAccountScreen

To Reviewers

  • 작업을 하다보니 코드량이 너무 길어져서ㅠㅠ 중간에 끊었다가 갈게요..!
  • 아직 UI가 전부 나온 게 아니라서 나온 부분만 구현했어요
  • 각 화면마다 여러 UI 케이스들이 있는데 이건 서버통신 연동하면서 더 구현할게요!

modifier = Modifier.padding(horizontal = 8.dp)
)
HorizontalDivider(
thickness = 0.6.dp,
Copy link
Member

Choose a reason for hiding this comment

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

여기도 마찬가지

Comment on lines 53 to 54
private val _action = MutableStateFlow<Boolean?>(null)
val action: StateFlow<Boolean?> = _action.asStateFlow()
Copy link
Member

Choose a reason for hiding this comment

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

혹시 이건 StateFlow로 구현한 이유가 있을까요? 이건 이벤트쪽인 것 같아서 State보단 Shared로 구현하는게 더 자연스러울 것 같아서요...!!

Copy link
Member Author

Choose a reason for hiding this comment

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

SharedFlow로 구현하면 이를 LaunchedEffectf로 수집해야하는데 LaunchedEffect 안에서는 컴포저블 함수를 사용할 수가 없더라구요..!
다이얼로그는 컴포저블 함수이기 때문에 일단 StateFlow를 사용했습니다ㅜㅜ 다른 방법이 있을까요..?

Copy link
Member

Choose a reason for hiding this comment

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

아 그런 요구사항이 있었구만유, 그런 경우에는 action이란 표현 대신에 isLoginErrorPopupVisible 정도로 축약해도 좋을 것 같아요. 아니면, 이건 UI단에서만 알고 있어도 되는 정보이니, setContent안에

  var isErrorDialogVisible by remember { mutableStateOf(false) }

로 사용해도 괜찮을듯합니다! 상태값 업데이트 코드는 AuthUiEvent가 Failure일 때 LaunchedEffect에서 작성하면 될 것 같구요

Comment on lines 65 to 70
if (text.isEmpty())
Text(
text = hintText,
color = Gray100,
style = SoptTheme.typography.body14M
)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (text.isEmpty())
Text(
text = hintText,
color = Gray100,
style = SoptTheme.typography.body14M
)
if (text.isEmpty()) {
Text(
text = hintText,
color = Gray100,
style = SoptTheme.typography.body14M
)
}

@Composable
internal fun AuthTextField(
text: String,
hintText: String,
Copy link
Member

Choose a reason for hiding this comment

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

https://m3.material.io/components/text-fields/guidelines

labelText(or placeHolder)라는 네이밍은 어떨까요? Material3 보니까 기본 placeHolder가 labelText로 되어있네요

Comment on lines 73 to 77
val onShowSnackBar: () -> Unit = {
coroutineScope.launch {
snackBarHostState.showSnackbar("인증번호가 전송되었어요.")
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
val onShowSnackBar: () -> Unit = {
coroutineScope.launch {
snackBarHostState.showSnackbar("인증번호가 전송되었어요.")
}
}
val onShowSnackBar: () -> Unit = remember { {
coroutineScope.launch {
snackBarHostState.showSnackbar("인증번호가 전송되었어요.")
}
} }

(혹시 모르는데) 이 함수가 리컴포지션될때마다 매번 리컴포지션 범위에 포함되어서 다시 함수객체가 만들어질 수 있으니 remember로 감싸주면 좋을 것 같아요

Copy link
Member

@l2hyunwoo l2hyunwoo left a comment

Choose a reason for hiding this comment

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

고생하셨어요 🙇🏻 리뷰 남겼습니다

@leeeyubin
Copy link
Member Author

코드리뷰 반영했습니다! 확인부탁드려요! @l2hyunwoo

Comment on lines +116 to +122
LaunchedEffect(true) {
if (dataStore.accessToken.isNotEmpty()) {
startActivity(
HomeActivity.getIntent(context, HomeActivity.StartArgs(UserStatus.of(dataStore.userStatus)))
)
}
}
Copy link
Member

Choose a reason for hiding this comment

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

토큰 있는 경우에는 어떻게 동작하나요...?

initAnimation()
collectUiEvent()
}
val action by viewModel.loginDialogAction.collectAsStateWithLifecycle()
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
val action by viewModel.loginDialogAction.collectAsStateWithLifecycle()
val loginDialogAction by viewModel.loginDialogAction.collectAsStateWithLifecycle()
  1. 저게 액션일까요?
  2. collectAsStateWithLifecycle이 필요할까?
  3. ViewModel에 변수로 선언해야하는가?

enableLights(false)
enableVibration(false)
lockscreenVisibility = NotificationCompat.VISIBILITY_PUBLIC
(getSystemService(NOTIFICATION_SERVICE) as NotificationManager).createNotificationChannel(this)
Copy link
Member

@l2hyunwoo l2hyunwoo Dec 30, 2024

Choose a reason for hiding this comment

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

Suggested change
(getSystemService(NOTIFICATION_SERVICE) as NotificationManager).createNotificationChannel(this)
getSystemService<NotificationManager>?.createNotificationChannel(this)

Comment on lines +165 to +173
authDataSource = object : PlaygroundAuthDatasource {
override suspend fun oauth(code: String): Result<OAuthToken> {
return kotlin.runCatching {
authService
.authenticate(AuthRequest(code, dataStore.pushToken))
.toOAuthToken()
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

오래된 잔재....이건 제가 건드려야될 것 같군요 ㅠ

Comment on lines +47 to +51
containerColor: Color = White,
contentColor: Color = Black,
isEnabled: Boolean = true,
disabledContainerColor: Color = Black80,
disabledContentColor: Color = Gray60,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
containerColor: Color = White,
contentColor: Color = Black,
isEnabled: Boolean = true,
disabledContainerColor: Color = Black80,
disabledContentColor: Color = Gray60,
isEnabled: Boolean = true,
containerColor: Color = White,
contentColor: Color = Black,
disabledContainerColor: Color = Black80,
disabledContentColor: Color = Gray60,

~Defaults object를 활용해서 컬러 시스템을 하나의 객체 안에서 관리할 수 있게하는 패턴이 있습니당!

Copy link
Member

Choose a reason for hiding this comment

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

@leeeyubin leeeyubin merged commit d719334 into develop Dec 30, 2024
1 check passed
@leeeyubin leeeyubin deleted the feature/#928-login branch December 30, 2024 19:35
l2hyunwoo added a commit that referenced this pull request Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat] LoginActivity 제작
2 participants