-
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
[TNT-176] 트레이너, 트레이니 메인 네비게이션 기초 세팅 #64
Changes from 20 commits
fd10026
7dd11b1
ffb5898
d133796
ce19dc9
d065755
18e2b5e
a015414
75c5a86
8804a14
85cf8a2
b4168e0
f9fb1ef
e00f461
96a6d92
55b2e66
153b238
6abbc60
2714349
fc1e747
6d47a33
c0fc779
5389e6f
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 |
---|---|---|
|
@@ -5,22 +5,20 @@ import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.navigation.compose.NavHost | ||
import co.kr.tnt.home.navigation.homeNavGraph | ||
import co.kr.tnt.home.navigation.navigateToHome | ||
import co.kr.tnt.login.navigation.loginScreen | ||
import co.kr.tnt.login.navigation.navigateToLogin | ||
import co.kr.tnt.navigation.Route | ||
import co.kr.tnt.roleselect.navigateToRoleSelection | ||
import co.kr.tnt.roleselect.roleSelectionScreen | ||
import co.kr.tnt.trainee.connect.navigation.navigateToTraineeConnect | ||
import co.kr.tnt.trainee.connect.navigation.traineeConnectScreen | ||
import co.kr.tnt.trainee.mypage.navigation.traineeMyPageScreen | ||
import co.kr.tnt.trainee.notification.navigation.traineeNotification | ||
import co.kr.tnt.trainee.main.navigation.navigateToTraineeMain | ||
import co.kr.tnt.trainee.main.navigation.traineeMainScreen | ||
import co.kr.tnt.trainee.signup.navigation.navigateToTraineeSignUp | ||
import co.kr.tnt.trainee.signup.navigation.traineeSignUpScreen | ||
import co.kr.tnt.trainer.connect.navigation.navigateToTrainerConnect | ||
import co.kr.tnt.trainer.connect.navigation.trainerConnectScreen | ||
import co.kr.tnt.trainer.notification.navigation.trainerNotification | ||
import co.kr.tnt.trainer.main.navigation.navigateToTrainerMain | ||
import co.kr.tnt.trainer.main.navigation.trainerMainScreen | ||
import co.kr.tnt.trainer.signup.navigation.navigateToTrainerSignUp | ||
import co.kr.tnt.trainer.signup.navigation.trainerSignUpScreen | ||
import co.kr.tnt.webview.navigateToWebView | ||
|
@@ -42,13 +40,7 @@ fun TnTNavHost( | |
) { | ||
loginScreen( | ||
navigateToHome = { | ||
navController.navigateToHome { | ||
popUpTo(Route.Login) { | ||
inclusive = true | ||
} | ||
launchSingleTop = true | ||
restoreState = true | ||
} | ||
navController.navigateToTraineeMain(clearBackStack = true) | ||
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. 여기 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. 어라 이거 API 반영 됐었군요!.. 이따 집가서 수정해두겠습니다 '-' |
||
}, | ||
navigateToSignup = { loginResult -> | ||
navController.navigateToRoleSelection( | ||
|
@@ -59,23 +51,11 @@ fun TnTNavHost( | |
}, | ||
) | ||
roleSelectionScreen( | ||
navigateToTraineeSignUp = { authId, authType, email -> | ||
navController.navigateToTraineeSignUp( | ||
authId = authId, | ||
authType = authType, | ||
email = email, | ||
) | ||
}, | ||
navigateToTrainerSignUp = { authId, authType, email -> | ||
navController.navigateToTrainerSignUp( | ||
authId = authId, | ||
authType = authType, | ||
email = email, | ||
) | ||
}, | ||
navigateToTraineeSignUp = navController::navigateToTraineeSignUp, | ||
navigateToTrainerSignUp = navController::navigateToTrainerSignUp, | ||
) | ||
trainerSignUpScreen( | ||
navigateToPrevious = { navController.popBackStack() }, | ||
navigateToPrevious = navController::popBackStack, | ||
navigateToConnect = { | ||
navController.navigateToTrainerConnect( | ||
isSkippable = true, | ||
|
@@ -84,45 +64,35 @@ fun TnTNavHost( | |
}, | ||
) | ||
traineeSignUpScreen( | ||
navigateToPrevious = { navController.popBackStack() }, | ||
navigateToConnect = { navController.navigateToTraineeConnect(isSkippable = true) }, | ||
navigateToPrevious = navController::popBackStack, | ||
navigateToConnect = { | ||
navController.navigateToTrainerConnect( | ||
isSkippable = true, | ||
isCompleted = false, | ||
) | ||
}, | ||
) | ||
trainerConnectScreen( | ||
navigateToPrevious = { navController.popBackStack() }, | ||
navigateToHome = { | ||
navController.navigateToHome(clearBackStack = true) | ||
}, | ||
navigateToPrevious = navController::popBackStack, | ||
navigateToHome = { navController.navigateToTrainerMain(clearBackStack = true) }, | ||
) | ||
traineeConnectScreen( | ||
navigateToPrevious = { navController.popBackStack() }, | ||
navigateToHome = { | ||
navController.navigateToHome(clearBackStack = true) | ||
}, | ||
navigateToPrevious = navController::popBackStack, | ||
navigateToHome = { navController.navigateToTraineeMain(clearBackStack = true) }, | ||
) | ||
traineeMyPageScreen( | ||
navigateToPrevious = { navController.popBackStack() }, | ||
navigateToTraineeConnect = { navController.navigateToTraineeConnect(isSkippable = false) }, | ||
trainerMainScreen( | ||
navigateToConnect = navController::navigateToTrainerConnect, | ||
navigateToWebView = navController::navigateToWebView, | ||
Comment on lines
+84
to
+86
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. 연결 화면으로 이동하기 위해 둘이 다른 방식을 선택한 이유와, 두 방식으로 나눠 사용하는 기준이 있는지 궁금합니다!! 통일성을 위해 함수 참조를 우선적으로 사용하도록 수정하는게 좋을까요? 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. 우선 일전에 말씀드렸듯이 람다 타입을 넘길 경우 함수 객체의 인스턴스를 넘겨주는 개념이므로 리컴포지션 카운트가 증가합니다! 참조를 사용할 경우 동일한 인스턴스를 지속적으로 재사용하는 개념이므로, 리컴포지션이 최적화됩니다 !_! 그리고 동일한 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. 아하 이해했습니다! 머지되면 기존 코드들 함수 타입을 넘겨주도록 수정해보겠습니다 👍👍 |
||
navigateToLogin = { navController.navigateToLogin(clearBackStack = true) }, | ||
navigateToWebView = { url -> | ||
navController.navigateToWebView(url = url) | ||
}, | ||
) | ||
traineeNotification( | ||
navigateToPrevious = { navController.popBackStack() }, | ||
) | ||
trainerNotification( | ||
navigateToPrevious = { navController.popBackStack() }, | ||
navigateToConnect = { | ||
navController.navigateToTrainerConnect( | ||
isSkippable = false, | ||
isCompleted = true, | ||
) | ||
}, | ||
traineeMainScreen( | ||
navigateToConnect = { navController.navigateToTraineeConnect(true) }, | ||
navigateToWebView = navController::navigateToWebView, | ||
navigateToLogin = { navController.navigateToLogin(clearBackStack = true) }, | ||
) | ||
webViewScreen( | ||
navigateToPrevious = { navController.popBackStack() }, | ||
navigateToPrevious = navController::popBackStack, | ||
) | ||
homeNavGraph() | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package co.kr.tnt.trainee.home | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Button | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.hilt.navigation.compose.hiltViewModel | ||
|
||
@Composable | ||
@Suppress("UnusedParameter") | ||
internal fun TraineeHomeRoute( | ||
viewModel: TraineeHomeViewModel = hiltViewModel(), | ||
navigateToNotification: () -> Unit, | ||
) { | ||
TraineeHomeScreen(navigateToNotification) | ||
} | ||
|
||
@Composable | ||
fun TraineeHomeScreen( | ||
navigateToNotification: () -> Unit, | ||
) { | ||
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> | ||
Column { | ||
Text( | ||
text = "trainee home", | ||
modifier = Modifier.padding(innerPadding), | ||
) | ||
Button(onClick = navigateToNotification) { | ||
Text("navigate to notification") | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
package co.kr.tnt.home | ||
package co.kr.tnt.trainee.home | ||
|
||
import androidx.lifecycle.ViewModel | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class HomeViewModel @Inject constructor() : ViewModel() | ||
class TraineeHomeViewModel @Inject constructor() : ViewModel() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package co.kr.tnt.trainee.home.navigation | ||
|
||
import androidx.navigation.NavController | ||
import androidx.navigation.NavGraphBuilder | ||
import androidx.navigation.NavOptionsBuilder | ||
import androidx.navigation.compose.composable | ||
import androidx.navigation.compose.navigation | ||
import co.kr.tnt.navigation.Route | ||
import co.kr.tnt.trainee.home.TraineeHomeRoute | ||
|
||
fun NavController.navigateToTraineeHome( | ||
navOptions: NavOptionsBuilder.() -> Unit = {}, | ||
) = navigate( | ||
route = Route.TraineeHome, | ||
builder = navOptions, | ||
) | ||
|
||
fun NavGraphBuilder.traineeHomeNavGraph( | ||
navigateToNotification: () -> Unit, | ||
homeDestination: NavGraphBuilder.() -> Unit = { }, | ||
) { | ||
navigation<Route.TraineeMainTab.Home>(startDestination = Route.TraineeHome) { | ||
composable<Route.TraineeHome> { | ||
TraineeHomeRoute( | ||
navigateToNotification = navigateToNotification, | ||
) | ||
} | ||
homeDestination() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import co.kr.tnt.setNamespace | ||
|
||
plugins { | ||
id("tnt.android.feature") | ||
} | ||
|
||
android { | ||
setNamespace("feature.trainee.main") | ||
} | ||
|
||
dependencies { | ||
implementation(projects.feature.trainee.home) | ||
implementation(projects.feature.trainee.mypage) | ||
implementation(projects.feature.trainee.notification) | ||
|
||
implementation(libs.kotlinx.immutable) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest /> |
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.
앗,, 감사합니다