From 3bea2f7b3f3a2e6b81e3b815b4caa1000971317d Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Wed, 6 Aug 2025 18:40:55 +0900 Subject: [PATCH 1/3] =?UTF-8?q?Refactor:=20=EC=A4=91=EB=B3=B5=EB=90=9C=20n?= =?UTF-8?q?avigateToHome=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - navigateToHomeAndClearStack 메소드를 사용하도록 수정 - 이동 시 모든 백스택을 제거하도록 설정 --- .../java/com/threegap/bitnagil/MainNavHost.kt | 24 +++---------------- .../com/threegap/bitnagil/MainNavigator.kt | 7 ++++++ 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/com/threegap/bitnagil/MainNavHost.kt b/app/src/main/java/com/threegap/bitnagil/MainNavHost.kt index facc24cb..d378f812 100644 --- a/app/src/main/java/com/threegap/bitnagil/MainNavHost.kt +++ b/app/src/main/java/com/threegap/bitnagil/MainNavHost.kt @@ -38,13 +38,7 @@ fun MainNavHost( popUpTo { inclusive = true } } }, - navigateToHome = { - navigator.navController.navigate(Route.Home) { - popUpTo(navigator.navController.graph.startDestinationId) { - inclusive = true - } - } - }, + navigateToHome = navigator::navigateToHomeAndClearStack, ) } @@ -56,13 +50,7 @@ fun MainNavHost( composable { LoginScreenContainer( - navigateToHome = { - navigator.navController.navigate(Route.Home) { - popUpTo(navigator.navController.graph.startDestinationId) { - inclusive = true - } - } - }, + navigateToHome = navigator::navigateToHomeAndClearStack, navigateToTermsAgreement = { navigator.navController.navigate(Route.TermsAgreement) }, ) } @@ -192,13 +180,7 @@ fun MainNavHost( OnBoardingScreenContainer( onBoardingViewModel = viewModel, - navigateToHome = { - navigator.navController.navigate(Route.Home) { - popUpTo(navigator.navController.graph.startDestinationId) { - inclusive = true - } - } - }, + navigateToHome = navigator::navigateToHomeAndClearStack, navigateToBack = { if (navigator.navController.previousBackStackEntry != null) { navigator.navController.popBackStack() diff --git a/app/src/main/java/com/threegap/bitnagil/MainNavigator.kt b/app/src/main/java/com/threegap/bitnagil/MainNavigator.kt index ed4106d4..275fd455 100644 --- a/app/src/main/java/com/threegap/bitnagil/MainNavigator.kt +++ b/app/src/main/java/com/threegap/bitnagil/MainNavigator.kt @@ -9,6 +9,13 @@ class MainNavigator( val navController: NavHostController, ) { val startDestination = Route.Splash + + internal fun navigateToHomeAndClearStack() = + navController.navigate(Route.Home) { + popUpTo(0) { + inclusive = true + } + } } @Composable From 4b9d40d389a9f9c188f9571db54f66aee92befa1 Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Thu, 7 Aug 2025 02:42:11 +0900 Subject: [PATCH 2/3] =?UTF-8?q?Fix:=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EB=AC=B4=ED=95=9C=20=ED=98=B8?= =?UTF-8?q?=EC=B6=9C=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 로그인 취소 시 의도적인 취소라 판단하여 취소 분기 제거 - 카카오 계정 로그인 sideEffect 제거 --- .../bitnagil/presentation/login/LoginScreen.kt | 6 ------ .../bitnagil/presentation/login/LoginViewModel.kt | 14 +------------- .../presentation/login/model/LoginSideEffect.kt | 1 - 3 files changed, 1 insertion(+), 20 deletions(-) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt index 349912b9..8e7259b1 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt @@ -44,12 +44,6 @@ fun LoginScreenContainer( viewModel.collectSideEffect { sideEffect -> when (sideEffect) { - is LoginSideEffect.RequestKakaoAccountLogin -> { - KakaoLoginHandlerImpl.accountLogin(context) { token, error -> - viewModel.kakaoLogin(token, error) - } - } - is LoginSideEffect.NavigateToHome -> { navigateToHome() } diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginViewModel.kt index 7cc60cc7..2dfc4304 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginViewModel.kt @@ -4,10 +4,7 @@ import android.util.Log import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.viewModelScope import com.kakao.sdk.auth.model.OAuthToken -import com.kakao.sdk.common.model.ClientError -import com.kakao.sdk.common.model.ClientErrorCause import com.threegap.bitnagil.domain.auth.usecase.LoginUseCase -import com.threegap.bitnagil.domain.error.model.BitnagilError import com.threegap.bitnagil.presentation.common.mviviewmodel.MviViewModel import com.threegap.bitnagil.presentation.login.model.LoginIntent import com.threegap.bitnagil.presentation.login.model.LoginSideEffect @@ -19,7 +16,7 @@ import javax.inject.Inject @HiltViewModel class LoginViewModel @Inject constructor( - private val savedStateHandle: SavedStateHandle, + savedStateHandle: SavedStateHandle, private val loginUseCase: LoginUseCase, ) : MviViewModel( initState = LoginState(), @@ -49,7 +46,6 @@ class LoginViewModel @Inject constructor( } is LoginIntent.KakaoTalkLoginCancel -> { - sendSideEffect(LoginSideEffect.RequestKakaoAccountLogin) state.copy(isLoading = false) } @@ -66,11 +62,6 @@ class LoginViewModel @Inject constructor( processKakaoLoginSuccess(token) } - error is ClientError && error.reason == ClientErrorCause.Cancelled -> { - Log.e("KakaoLogin", "카카오 로그인 취소", error) - sendIntent(LoginIntent.KakaoTalkLoginCancel) - } - error != null -> { Log.e("KakaoLogin", "카카오 로그인 실패", error) sendIntent(LoginIntent.LoginFailure) @@ -90,9 +81,6 @@ class LoginViewModel @Inject constructor( }, onFailure = { e -> sendIntent(LoginIntent.LoginFailure) - if (e is BitnagilError) { - Log.e("Login", "${e.code} ${e.message}") - } Log.e("Login", "${e.message}") }, ) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/login/model/LoginSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/login/model/LoginSideEffect.kt index 7d00f6c4..e1caf82a 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/login/model/LoginSideEffect.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/login/model/LoginSideEffect.kt @@ -3,7 +3,6 @@ package com.threegap.bitnagil.presentation.login.model import com.threegap.bitnagil.presentation.common.mviviewmodel.MviSideEffect sealed interface LoginSideEffect : MviSideEffect { - data object RequestKakaoAccountLogin : LoginSideEffect data object NavigateToHome : LoginSideEffect data object NavigateToTermsAgreement : LoginSideEffect } From ce0eb17d1727a9f1a4759269ff08925af0d74674 Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Thu, 7 Aug 2025 02:43:49 +0900 Subject: [PATCH 3/3] =?UTF-8?q?Chore:=20=ED=99=94=EB=A9=B4=20=EB=B9=84?= =?UTF-8?q?=EC=9C=A8=20=EB=B0=8F=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bitnagil/data/auth/mapper/AuthMapper.kt | 2 +- .../bitnagil/domain/auth/model/UserRole.kt | 2 +- .../bitnagil/presentation/intro/IntroScreen.kt | 15 +++++++++++---- .../bitnagil/presentation/login/LoginScreen.kt | 15 +++++++++++---- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/data/src/main/java/com/threegap/bitnagil/data/auth/mapper/AuthMapper.kt b/data/src/main/java/com/threegap/bitnagil/data/auth/mapper/AuthMapper.kt index 96bc3665..fc8eadd9 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/auth/mapper/AuthMapper.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/auth/mapper/AuthMapper.kt @@ -11,7 +11,7 @@ internal fun LoginResponseDto.toDomain() = AuthSession( accessToken = this.accessToken, refreshToken = this.refreshToken, - role = UserRole.from(this.role), + role = UserRole.fromString(this.role), ) // toDto diff --git a/domain/src/main/java/com/threegap/bitnagil/domain/auth/model/UserRole.kt b/domain/src/main/java/com/threegap/bitnagil/domain/auth/model/UserRole.kt index 141ae17b..42f224ec 100644 --- a/domain/src/main/java/com/threegap/bitnagil/domain/auth/model/UserRole.kt +++ b/domain/src/main/java/com/threegap/bitnagil/domain/auth/model/UserRole.kt @@ -8,7 +8,7 @@ enum class UserRole { fun isGuest() = this == GUEST companion object { - fun from(value: String): UserRole = + fun fromString(value: String): UserRole = when (value) { "USER" -> USER "GUEST" -> GUEST diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/intro/IntroScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/intro/IntroScreen.kt index cd79526e..217b6b8d 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/intro/IntroScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/intro/IntroScreen.kt @@ -10,6 +10,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.statusBarsPadding +import androidx.compose.foundation.layout.width import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -56,6 +57,10 @@ private fun IntroScreen( val screenHeight = with(LocalDensity.current) { windowInfo.containerSize.height.toDp() } + val screenWidth = with(LocalDensity.current) { + windowInfo.containerSize.width.toDp() + } + val widthRatio = 260f / 360f Column( horizontalAlignment = Alignment.CenterHorizontally, @@ -64,24 +69,26 @@ private fun IntroScreen( .statusBarsPadding() .background(BitnagilTheme.colors.white), ) { - Spacer(modifier = Modifier.height(screenHeight * 0.0748f)) + Spacer(modifier = Modifier.height(screenHeight * 0.105f)) Text( text = "당신의 하루 리듬을 이해하고,\n작은 변화를 함께 시작해볼게요.", color = BitnagilTheme.colors.navy500, style = BitnagilTheme.typography.title2Bold, textAlign = TextAlign.Center, - modifier = Modifier.fillMaxWidth(), + modifier = Modifier + .fillMaxWidth() + .height(60.dp), ) - Spacer(modifier = Modifier.height(screenHeight * 0.151f)) + Spacer(modifier = Modifier.height(screenHeight * 0.136f)) Image( painter = painterResource(R.drawable.intro_character), contentDescription = null, contentScale = ContentScale.Fit, modifier = Modifier - .padding(50.dp) + .width(screenWidth * widthRatio) .aspectRatio(260f / 295f), ) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt index 8e7259b1..3d29f1fe 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt @@ -12,6 +12,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.statusBarsPadding +import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -72,6 +73,10 @@ private fun LoginScreen( val screenHeight = with(LocalDensity.current) { windowInfo.containerSize.height.toDp() } + val screenWidth = with(LocalDensity.current) { + windowInfo.containerSize.width.toDp() + } + val widthRatio = 260f / 360f Column( horizontalAlignment = Alignment.CenterHorizontally, @@ -80,24 +85,26 @@ private fun LoginScreen( .statusBarsPadding() .background(BitnagilTheme.colors.white), ) { - Spacer(modifier = Modifier.height(screenHeight * 0.0748f)) + Spacer(modifier = Modifier.height(screenHeight * 0.105f)) Text( text = "빛나길에 오신걸 환영해요!", color = BitnagilTheme.colors.navy500, style = BitnagilTheme.typography.title2Bold, textAlign = TextAlign.Center, - modifier = Modifier.fillMaxWidth(), + modifier = Modifier + .fillMaxWidth() + .height(60.dp), ) - Spacer(modifier = Modifier.height(screenHeight * 0.185f)) + Spacer(modifier = Modifier.height(screenHeight * 0.136f)) Image( painter = painterResource(R.drawable.intro_character), contentDescription = null, contentScale = ContentScale.Fit, modifier = Modifier - .padding(50.dp) + .width(screenWidth * widthRatio) .aspectRatio(260f / 295f), )