-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Feat/#50] "회원가입 > 1. 프로필 선택, 2. 닉네임 입력" UI를 구현합니다. #57
Changes from 19 commits
6962e01
c9dad78
ae7d7fc
916f1bf
a318dfa
c0c3233
8f2592d
ee209e6
572763a
10bb294
ddb85ae
6c89848
26b550a
68210f8
2a7aee0
5fabcea
e8a51b1
e726d19
23081c8
68f2f5c
ac600d3
1d0adb9
f6675fa
6d005a3
3eefdda
0f09a72
47ccacb
09a4f48
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,7 @@ | ||
package com.sopt.gongbaek.domain.model | ||
|
||
data class TimeTable( | ||
val weekDay: String, | ||
val startTime: Float, | ||
val endTime: Float | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.sopt.gongbaek.domain.model | ||
|
||
data class UserInfo( | ||
val profileImage: Int?, | ||
val nickname: String, | ||
val mbti: String, | ||
val schoolName: String, | ||
val schoolMajor: String, | ||
val schoolGrade: Int?, | ||
val enterYear: Int?, | ||
val introduction: String, | ||
val sex: String, | ||
val timeTable: TimeTable | ||
) | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.sopt.gongbaek.presentation.ui.auth.navigation | ||
|
||
import androidx.navigation.NavController | ||
import com.sopt.gongbaek.presentation.model.NavigationRoute | ||
|
||
fun NavController.navigateAuthRoute() { | ||
navigate(route = NavigationRoute.AuthNavGraphRoute.AUTH_NAV_GRAPH) | ||
} | ||
|
||
fun NavController.navigateCompleteAuth() { | ||
navigate(route = NavigationRoute.AuthNavGraphRoute.AUTH) | ||
} | ||
|
||
fun NavController.navigateNickname() = navigate(route = NavigationRoute.AuthNavGraphRoute.NICKNAME) | ||
|
||
fun NavController.navigateUnivMajor() = navigate(route = NavigationRoute.AuthNavGraphRoute.UNIV_MAJOR) | ||
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. [3] 위아래 둘 중 하나의 방식으로 컨벤션을 맞추는게 통일성이 있을것 같습니다! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.sopt.gongbaek.presentation.ui.auth.navigation | ||
|
||
import androidx.hilt.navigation.compose.hiltViewModel | ||
import androidx.navigation.NavGraphBuilder | ||
import androidx.navigation.NavHostController | ||
import androidx.navigation.compose.composable | ||
import androidx.navigation.navigation | ||
import com.sopt.gongbaek.presentation.model.NavigationRoute | ||
import com.sopt.gongbaek.presentation.ui.auth.screen.NicknameRoute | ||
import com.sopt.gongbaek.presentation.ui.auth.screen.AuthViewModel | ||
import com.sopt.gongbaek.presentation.ui.auth.screen.SelectProfileRoute | ||
|
||
fun NavGraphBuilder.authNavGraph( | ||
navController: NavHostController | ||
) { | ||
navigation( | ||
startDestination = NavigationRoute.AuthNavGraphRoute.SELECT_PROFILE, | ||
route = NavigationRoute.AuthNavGraphRoute.AUTH_NAV_GRAPH | ||
) { | ||
composable( | ||
route = NavigationRoute.AuthNavGraphRoute.SELECT_PROFILE | ||
) { | ||
val viewModel: AuthViewModel = hiltViewModel( | ||
navController.getBackStackEntry(NavigationRoute.AuthNavGraphRoute.AUTH_NAV_GRAPH) | ||
) | ||
SelectProfileRoute( | ||
viewModel = viewModel, | ||
navigateNickname = navController::navigateNickname | ||
) | ||
} | ||
|
||
|
||
composable( | ||
route = NavigationRoute.AuthNavGraphRoute.NICKNAME | ||
) { | ||
val viewModel: AuthViewModel = hiltViewModel( | ||
navController.getBackStackEntry(NavigationRoute.AuthNavGraphRoute.AUTH_NAV_GRAPH) | ||
) | ||
NicknameRoute( | ||
viewModel = viewModel, | ||
navigateUnivMajor = navController::navigateUnivMajor, | ||
naviToBack = navController::popBackStack | ||
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. [3] 다른 navigate 함수와 비슷하게 navigateBack 네이밍은 어떨까요! |
||
) | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.sopt.gongbaek.presentation.ui.auth.screen | ||
|
||
import com.sopt.gongbaek.domain.model.TimeTable | ||
import com.sopt.gongbaek.domain.model.UserInfo | ||
import com.sopt.gongbaek.presentation.util.base.UiEvent | ||
import com.sopt.gongbaek.presentation.util.base.UiSideEffect | ||
import com.sopt.gongbaek.presentation.util.base.UiState | ||
|
||
class AuthContract { | ||
|
||
data class State( | ||
val userInfo: UserInfo = UserInfo( | ||
profileImage = null, | ||
nickname = "", | ||
mbti = "", | ||
schoolName = "", | ||
schoolMajor = "", | ||
schoolGrade = null, | ||
enterYear = null, | ||
introduction = "", | ||
sex = "", | ||
timeTable = TimeTable( | ||
weekDay = "", | ||
startTime = 0f, | ||
endTime = 0f | ||
) | ||
) | ||
) : UiState | ||
|
||
sealed class Event : UiEvent { | ||
data class OnProfileImageChanged(val profileImage: Int?) : Event() | ||
data class OnNicknameChanged(val nickname: String) : Event() | ||
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. [3] Changed는 기존의 정보가 변경되는 느낌이 강한데, 아직 정해진 정보가 없는 상황에서 사용자가 고르는 화면이니 onProfileImageSelected 라는 네이밍은 어떨까요? |
||
} | ||
|
||
sealed interface SideEffect : UiSideEffect { | ||
data object NavigateToBack : SideEffect | ||
data object NavigateToNickname : SideEffect | ||
} | ||
} | ||
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. [2] navigate 함수와 네이밍 컨벤션 맞춰서 To는 삭제해도 좋을 것 같습니다 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.sopt.gongbaek.presentation.ui.auth.screen | ||
|
||
import com.sopt.gongbaek.domain.model.UserInfo | ||
import com.sopt.gongbaek.presentation.util.base.BaseViewModel | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class AuthViewModel @Inject constructor() : BaseViewModel<AuthContract.State, AuthContract.Event, AuthContract.SideEffect>() { | ||
|
||
override fun createInitialState(): AuthContract.State = AuthContract.State() | ||
|
||
override suspend fun handleEvent(event: AuthContract.Event) { | ||
when (event) { | ||
is AuthContract.Event.OnProfileImageChanged -> updateUserInfo { copy(profileImage = event.profileImage) } | ||
is AuthContract.Event.OnNicknameChanged -> updateUserInfo { copy(nickname = event.nickname) } | ||
} | ||
} | ||
|
||
fun sendSideEffect(sideEffect: AuthContract.SideEffect) = | ||
setSideEffect(sideEffect) | ||
|
||
private fun updateUserInfo(update: UserInfo.() -> UserInfo) = | ||
setState { copy(userInfo = userInfo.update()) } | ||
} |
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.
[3] 네이밍에 대한 이야기인데요, 모집자 프로필 모델과 컨벤션을 맞춰서
schoolName -> school
schoolMajor -> major
schoolGrade -> grade
sex -> gender
로 변경은 어떤지 건의드리고 싶습니다!