From eb897f1b1095c7b6e1382f97d7b70f65b75798bb Mon Sep 17 00:00:00 2001 From: youjin09222 Date: Mon, 19 May 2025 12:09:02 +0900 Subject: [PATCH 1/2] =?UTF-8?q?#9=20[UI]=20=EC=98=A8=EB=B3=B4=EB=94=A9=20?= =?UTF-8?q?=EC=8A=A4=ED=81=AC=EB=A1=A4=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/login/OnboardingRoute.kt | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/presentation/src/main/java/com/sopt/presentation/auth/login/OnboardingRoute.kt b/presentation/src/main/java/com/sopt/presentation/auth/login/OnboardingRoute.kt index 1c1e9ab6..2538be9b 100644 --- a/presentation/src/main/java/com/sopt/presentation/auth/login/OnboardingRoute.kt +++ b/presentation/src/main/java/com/sopt/presentation/auth/login/OnboardingRoute.kt @@ -6,13 +6,17 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.wrapContentWidth import androidx.compose.foundation.pager.HorizontalPager import androidx.compose.foundation.pager.rememberPagerState +import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.CircleShape +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.Immutable @@ -74,7 +78,8 @@ fun OnboardingScreen( Column( modifier = Modifier .fillMaxSize() - .background(NoostakTheme.colors.white), + .background(NoostakTheme.colors.white) + .verticalScroll(rememberScrollState()), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Top ) { @@ -87,10 +92,13 @@ fun OnboardingScreen( verticalArrangement = Arrangement.Top ) { Image( - modifier = Modifier.fillMaxWidth(), imageVector = ImageVector.vectorResource(id = pages[page].imageRes), contentDescription = null, - contentScale = ContentScale.FillWidth + contentScale = ContentScale.FillWidth, + modifier = Modifier + .fillMaxWidth() + .background(NoostakTheme.colors.gray100) + .wrapContentWidth(Alignment.CenterHorizontally) ) Text( modifier = Modifier.padding(top = 30.dp), @@ -113,7 +121,9 @@ fun OnboardingScreen( } } Row( - Modifier.weight(1f) + modifier = Modifier.fillMaxWidth() + .padding(bottom = 26.dp), + horizontalArrangement = Arrangement.Center ) { repeat(pagerState.pageCount) { iteration -> val color = @@ -127,6 +137,7 @@ fun OnboardingScreen( ) } } + Spacer(modifier = Modifier.weight(1f)) val isLastPage = pagerState.currentPage == pages.size - 1 val buttonText = From f8a6fded0cccb96c882ca13f9d419d02beb35017 Mon Sep 17 00:00:00 2001 From: youjin09222 Date: Mon, 19 May 2025 12:11:19 +0900 Subject: [PATCH 2/2] =?UTF-8?q?#9=20[Fix]=20=ED=94=84=EB=A1=9C=ED=95=84=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EC=B4=88=EA=B8=B0=ED=99=94=20=EB=B0=A9?= =?UTF-8?q?=EC=8B=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mypage/editProfile/EditProfileRoute.kt | 2 +- .../editProfile/EditProfileViewModel.kt | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/presentation/src/main/java/com/sopt/presentation/mypage/editProfile/EditProfileRoute.kt b/presentation/src/main/java/com/sopt/presentation/mypage/editProfile/EditProfileRoute.kt index d1dae646..c545319f 100644 --- a/presentation/src/main/java/com/sopt/presentation/mypage/editProfile/EditProfileRoute.kt +++ b/presentation/src/main/java/com/sopt/presentation/mypage/editProfile/EditProfileRoute.kt @@ -107,7 +107,7 @@ fun EditProfileRoute( var isInitialized by remember { mutableStateOf(false) } LaunchedEffect(Unit) { - editProfileViewModel.initProfile() + editProfileViewModel.setInitialProfile(nickname, profileImage) isInitialized = true } diff --git a/presentation/src/main/java/com/sopt/presentation/mypage/editProfile/EditProfileViewModel.kt b/presentation/src/main/java/com/sopt/presentation/mypage/editProfile/EditProfileViewModel.kt index d3dbedab..67be0091 100644 --- a/presentation/src/main/java/com/sopt/presentation/mypage/editProfile/EditProfileViewModel.kt +++ b/presentation/src/main/java/com/sopt/presentation/mypage/editProfile/EditProfileViewModel.kt @@ -9,7 +9,6 @@ import com.sopt.domain.repository.UserInfoRepository import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow -import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch import javax.inject.Inject @@ -34,16 +33,16 @@ class EditProfileViewModel @Inject constructor( private val _showErrorDialog = MutableStateFlow(false) val showErrorDialog: StateFlow get() = _showErrorDialog - suspend fun initProfile() { - userInfoRepository.getNickname().first().also { - _nickname.value = it - onMemberNameChanged(it) - } - - userInfoRepository.getProfileImage().first().also { - _profileImage.value = it - onImageSelected(it) + fun setInitialProfile(memberName: String, memberProfileImage: String?) { + _nickname.value = memberName + _profileImage.value = memberProfileImage ?: "" + _userProfileState.update { + it.copy( + memberName = memberName, + memberProfileImage = memberProfileImage + ) } + validateMemberName(memberName) } private suspend fun saveProfile(memberName: String, memberProfileImage: String?) {