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

[Feat/#50] "회원가입 > 1. 프로필 선택, 2. 닉네임 입력" UI를 구현합니다. #57

Merged
merged 28 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6962e01
[chore] 기본 배경 선언 위치 변경
wjdrjs00 Jan 18, 2025
c9dad78
Merge branch 'develop' of https://github.com/SOPT-all/35-APPJAM-ANDRO…
wjdrjs00 Jan 18, 2025
ae7d7fc
[add] 프로필 이미지 사진 추가
wjdrjs00 Jan 18, 2025
916f1bf
[add] 라이브러리 추가 (lifesycle-runtime-compose)
wjdrjs00 Jan 18, 2025
a318dfa
[feat] Userinfo 도메인 모델 정의
wjdrjs00 Jan 18, 2025
c0c3233
[feat] timetable 도메인 모델 정의
wjdrjs00 Jan 18, 2025
8f2592d
[chore] 이미지 alpha 값 호이스팅
wjdrjs00 Jan 18, 2025
ee209e6
[feat] OnboardingNavGraphRoute 경로 추가
wjdrjs00 Jan 18, 2025
572763a
[chore] 네이밍 수정 (onboarding -> auth)
wjdrjs00 Jan 18, 2025
10bb294
[feat] AuthNavGraph 그래프 경로 추가
wjdrjs00 Jan 18, 2025
ddb85ae
[feat] AuthContract 추가
wjdrjs00 Jan 18, 2025
6c89848
[feat] AuthViewModel 추가
wjdrjs00 Jan 18, 2025
26b550a
[feat] 프로필 선택 화면 구현
wjdrjs00 Jan 18, 2025
68210f8
[feat] 닉네임 선택 화면 구현
wjdrjs00 Jan 18, 2025
2a7aee0
[chore] 대문자 수정
wjdrjs00 Jan 18, 2025
5fabcea
[chore] ktlint 적용
wjdrjs00 Jan 18, 2025
e8a51b1
Merge branch 'develop' into feat-#50-auth-ui
wjdrjs00 Jan 18, 2025
e726d19
[chore] progressBar 진행룰 수정
wjdrjs00 Jan 18, 2025
23081c8
[chore] ktlint 적용
wjdrjs00 Jan 18, 2025
68f2f5c
[chore] ktlint 적용
wjdrjs00 Jan 18, 2025
ac600d3
Rename authNavGraph.kt to AuthNavGraph.kt
wjdrjs00 Jan 18, 2025
1d0adb9
[chore] 라인 수정
wjdrjs00 Jan 18, 2025
f6675fa
[chore] remember 사용하여 컴포지션 안정성 고려
wjdrjs00 Jan 18, 2025
6d005a3
Merge branch 'feat-#50-auth-ui' of https://github.com/SOPT-all/35-APP…
wjdrjs00 Jan 18, 2025
3eefdda
[chore] ktlint 적용
wjdrjs00 Jan 18, 2025
0f09a72
[chore] 리뷰 네이밍 수정사항 반영
wjdrjs00 Jan 18, 2025
47ccacb
[chore] ktlint 수정
wjdrjs00 Jan 18, 2025
09a4f48
[refactor] viewmodel 인스턴스 위치 변경
wjdrjs00 Jan 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ dependencies {
// Core Libraries
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.lifecycle.runtime.compose.android)
implementation(libs.androidx.activity.compose)

// Jetpack Compose
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/com/sopt/gongbaek/domain/model/TimeTable.kt
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
)
14 changes: 14 additions & 0 deletions app/src/main/java/com/sopt/gongbaek/domain/model/UserInfo.kt
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
)
Copy link
Collaborator

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

로 변경은 어떤지 건의드리고 싶습니다!

Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
package com.sopt.gongbaek.presentation.model

object NavigationRoute {
object OnboardingNavGraphRoute {
const val ONBOARDING_NAV_GRAPH = "onboarding_route"
const val ONBOARDING = "onboarding"
object AuthNavGraphRoute {
const val AUTH_NAV_GRAPH = "auth_route"
const val AUTH = "auth"
const val SELECT_PROFILE = "select_profile"
const val NICKNAME = "nickname"
const val UNIV_MAJOR = "univ_major"
const val GRADE = "grade"
const val MBTI = "mbti"
const val GENDER = "gender"
const val SELF_INTRODUCTION = "self_introduction"
const val ENTER_TIMETABLE = "enter_timetable"
const val GAP_TIMETABLE = "gap_timetable"
const val COMPLETE_AUTH = "complete_auth"
}

object MainBottomNavBarTabRoute {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ enum class ImageSelectorType(
) {
Profile(
imageButtonResIdList = listOf(
R.drawable.img_image_button_sample,
R.drawable.img_image_button_sample,
R.drawable.img_image_button_sample,
R.drawable.img_image_button_sample,
R.drawable.img_image_button_sample,
R.drawable.img_image_button_sample
R.drawable.img_profile_0_104,
R.drawable.img_profile_1_104,
R.drawable.img_profile_2_104,
R.drawable.img_profile_3_104,
R.drawable.img_profile_4_104,
R.drawable.img_profile_5_104
),
chunkedCount = 3
),
Expand Down
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)
Copy link
Collaborator

Choose a reason for hiding this comment

The 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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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()
Copy link
Collaborator

Choose a reason for hiding this comment

The 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
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The 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
@@ -1,4 +1,4 @@
package com.sopt.gongbaek.presentation.ui.onboarding.screen
package com.sopt.gongbaek.presentation.ui.auth.screen

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
Expand All @@ -17,16 +17,16 @@ import com.sopt.gongbaek.ui.theme.GONGBAEKTheme
import com.sopt.gongbaek.ui.theme.GongBaekTheme

@Composable
fun OnboardingRoute(
fun AuthRoute(
navigateHome: () -> Unit
) {
OnboardingScreen(
AuthScreen(
navigateHome = navigateHome
)
}

@Composable
fun OnboardingScreen(
fun AuthScreen(
navigateHome: () -> Unit
) {
Box(
Expand All @@ -49,9 +49,9 @@ fun OnboardingScreen(

@Preview(showBackground = true)
@Composable
private fun OnboardingScreenPreview() {
private fun PreviewAuthScreen() {
GONGBAEKTheme {
OnboardingScreen(
AuthScreen(
navigateHome = {}
)
}
Expand Down
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()) }
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.sopt.gongbaek.presentation.ui.onboarding.screen
package com.sopt.gongbaek.presentation.ui.auth.screen

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.sopt.gongbaek.presentation.ui.onboarding.screen
package com.sopt.gongbaek.presentation.ui.auth.screen

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.sopt.gongbaek.presentation.ui.onboarding.screen
package com.sopt.gongbaek.presentation.ui.auth.screen

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.sopt.gongbaek.presentation.ui.onboarding.screen
package com.sopt.gongbaek.presentation.ui.auth.screen

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.sopt.gongbaek.presentation.ui.onboarding.screen
package com.sopt.gongbaek.presentation.ui.auth.screen

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.sopt.gongbaek.presentation.ui.onboarding.screen
package com.sopt.gongbaek.presentation.ui.auth.screen

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
Expand Down
Loading
Loading