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

[TNT-176] 트레이너, 트레이니 메인 네비게이션 기초 세팅 #64

Merged
merged 23 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
fd10026
[TNT-176] remove: 불필요한 코드 제거
hoyahozz Feb 2, 2025
7dd11b1
[TNT-176] refactor: 회원가입 네비게이션 로직 개선
hoyahozz Feb 2, 2025
ffb5898
[TNT-176] chore: feature:trainer:home 모듈 최초 생성
hoyahozz Feb 2, 2025
d133796
[TNT-176] chore: feature:trainee:home 모듈 최초 생성
hoyahozz Feb 2, 2025
ce19dc9
[TNT-176] chore: feature:trainer:main 모듈 최초 생성
hoyahozz Feb 2, 2025
d065755
[TNT-176] feat: 트레이너 메인 Navigation 기초 구현
hoyahozz Feb 3, 2025
18e2b5e
[TNT-176] chore: feature:trainer:feedback 모듈 최초 생성
hoyahozz Feb 3, 2025
a015414
[TNT-176] chore: feature:trainer:members 모듈 최초 생성
hoyahozz Feb 3, 2025
75c5a86
[TNT-176] chore: feature:trainer:mypage 모듈 최초 생성
hoyahozz Feb 3, 2025
8804a14
[TNT-176] feat: 트레이너 임시 MainTab 구현
hoyahozz Feb 3, 2025
85cf8a2
[TNT-176] chore: feature:trainee:main 모듈 최초 생성
hoyahozz Feb 3, 2025
b4168e0
[TNT-176] feat: 트레이니 메인 Navigation 기초 구현
hoyahozz Feb 4, 2025
f9fb1ef
[TNT-176] refactor: Signup NavGraph 제거
hoyahozz Feb 4, 2025
e00f461
[TNT-176] remove: feature:home 모듈 제거
hoyahozz Feb 4, 2025
96a6d92
[TNT-176] fix: MainScreen 내 scaffold inner padding 제거
hoyahozz Feb 4, 2025
55b2e66
[TNT-176] fix: apply detekt
hoyahozz Feb 4, 2025
153b238
[TNT-176] fix: MainScreen 내부에서 NavController 를 생성하도록 수정
hoyahozz Feb 4, 2025
6abbc60
[TNT-176] fix: clearBackStack 로직 수정
hoyahozz Feb 4, 2025
2714349
[TNT-176] Merge branch 'develop' into feature/TNT-176
hoyahozz Feb 4, 2025
fc1e747
[TNT-176] refactor: 알람 화면 Navigation 로직 이관 처리
hoyahozz Feb 4, 2025
6d47a33
[TNT-176] refactor: UserType enum 생성 및 User 클래스 분리
hoyahozz Feb 5, 2025
c0fc779
[TNT-176] feat: 자동 로그인 후 직군에 따라 이동 화면 지정 처리
hoyahozz Feb 5, 2025
5389e6f
[TNT-176] feat: 로그인 후 직군에 따라 이동 화면 지정 처리
hoyahozz Feb 5, 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
43 changes: 43 additions & 0 deletions core/navigation/src/main/java/co/kr/tnt/navigation/RouteModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,49 @@ sealed interface Route {
@Serializable
data class TraineeConnect(val isFromMyPage: Boolean) : Route

@Serializable
data object TrainerMain : Route

sealed interface TrainerMainTab : Route {
@Serializable
data object Home : TrainerMainTab

@Serializable
data object Members : TrainerMainTab

@Serializable
data object Feedback : TrainerMainTab

@Serializable
data object MyPage : TrainerMainTab
}

@Serializable
data object TrainerHome : Route

@Serializable
data object TrainerMembers : Route

@Serializable
data object TrainerFeedback : Route

@Serializable
data object TrainerMyPage : Route

@Serializable
data object TraineeMain : Route

sealed interface TraineeMainTab : Route {
@Serializable
data object Home : TraineeMainTab

@Serializable
data object MyPage : TraineeMainTab
}

@Serializable
data object TraineeHome : Route

@Serializable
data object TraineeMyPage : Route

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal class SessionInterceptor @Inject constructor(
val requestBuilder = originRequest.newBuilder()

requestBuilder.addHeader(
"AUTHORIZATION",
"Authorization",
"SESSION-ID ${runBlocking { sessionProvider.getSessionId() }}",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class SignUpRepositoryImpl @Inject constructor(
email = email,
fcmToken = "EMPTY",
)
val requestBody = signUpRequest.toRequestBody(Json)
val requestBody = signUpRequest.toRequestBody()

val response = signupRemoteDataSource.postSignUp(
profileImage = profileImagePart,
Expand All @@ -54,7 +54,7 @@ class SignUpRepositoryImpl @Inject constructor(
return response.toDomain()
}

private fun SignUpRequest.toRequestBody(json: Json): RequestBody {
private fun SignUpRequest.toRequestBody(): RequestBody {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앗,, 감사합니다

val jsonString = json.encodeToString(this)
return jsonString.toRequestBody("application/json".toMediaTypeOrNull())
}
Expand Down
3 changes: 0 additions & 3 deletions feature/login/src/main/java/co/kr/tnt/login/LoginViewModel.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package co.kr.tnt.login

import android.util.Log
import androidx.lifecycle.viewModelScope
import co.kr.tnt.domain.model.AuthType
import co.kr.tnt.domain.model.LoginResult
Expand Down Expand Up @@ -28,8 +27,6 @@ internal class LoginViewModel @Inject constructor(

is LoginUiEvent.OnAuthFail -> {
if (event.throwable !is LoginException.CancelException) {
// TODO resource
Log.w("test", "exception : ${event.throwable}")
sendEffect(LoginSideEffect.ShowToast("로그인에 실패하였습니다. 다시 시도해주세요."))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fun NavController.navigateToLogin(
route = Route.Login,
navOptions = navOptions {
if (clearBackStack) {
popUpTo(graph.startDestinationId) { inclusive = true }
popUpTo(graph.id) { inclusive = true }
}
navOptions()
},
Expand Down
4 changes: 2 additions & 2 deletions feature/main/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ android {
}

dependencies {
implementation(projects.feature.home)
implementation(projects.feature.webview)
implementation(projects.feature.login)
implementation(projects.feature.roleselect)
implementation(projects.feature.trainer.main)
implementation(projects.feature.trainee.main)
implementation(projects.feature.trainee.signup)
implementation(projects.feature.trainer.signup)
implementation(projects.feature.trainer.connect)
implementation(projects.feature.trainee.connect)
implementation(projects.feature.trainee.mypage)

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
Expand Down
2 changes: 1 addition & 1 deletion feature/main/src/main/java/co/kr/tnt/main/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ internal class MainViewModel @Inject constructor(
val startDestination: Route = if (isNeedLogin) {
Route.Login
} else {
Route.HomeBase
Route.TraineeMain
}

updateState {
Expand Down
65 changes: 22 additions & 43 deletions feature/main/src/main/java/co/kr/tnt/main/ui/TnTNavHost.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ import androidx.compose.ui.Modifier
import androidx.navigation.compose.NavHost
import co.kr.tnt.feature.webview.navigateToWebView
import co.kr.tnt.feature.webview.webViewScreen
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.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.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

Expand All @@ -40,13 +40,7 @@ fun TnTNavHost(
) {
loginScreen(
navigateToHome = {
navController.navigateToHome {
popUpTo(Route.Login) {
inclusive = true
}
launchSingleTop = true
restoreState = true
}
navController.navigateToTraineeMain(clearBackStack = true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기 navigateToTrainerMain은 아직 추가 안 된건가용?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어라 이거 API 반영 됐었군요!.. 이따 집가서 수정해두겠습니다 '-'

},
navigateToSignup = { loginResult ->
navController.navigateToRoleSelection(
Expand All @@ -57,53 +51,38 @@ 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(isFromMyPage = false) },
)
traineeSignUpScreen(
navigateToPrevious = { navController.popBackStack() },
navigateToPrevious = navController::popBackStack,
navigateToConnect = { navController.navigateToTraineeConnect(isFromMyPage = 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(isFromMyPage = true) },
trainerMainScreen(
navigateToConnect = { navController.navigateToTraineeConnect(true) },
navigateToWebView = navController::navigateToWebView,
navigateToLogin = { navController.navigateToLogin(clearBackStack = true) },
)
traineeMainScreen(
navigateToConnect = { navController.navigateToTraineeConnect(true) },
navigateToWebView = navController::navigateToWebView,
navigateToLogin = { navController.navigateToLogin(clearBackStack = true) },
navigateToWebView = { url ->
navController.navigateToWebView(url = url)
},
)
webViewScreen(
navigateToPrevious = { navController.popBackStack() },
navigateToPrevious = navController::popBackStack,
)
homeNavGraph()
}
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

android {
setNamespace("feature.home")
setNamespace("feature.trainee.home")
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.kr.tnt.home
package co.kr.tnt.trainee.home

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
Expand All @@ -10,17 +10,17 @@ import androidx.hilt.navigation.compose.hiltViewModel

@Composable
@Suppress("UnusedParameter")
internal fun HomeRoute(
viewModel: HomeViewModel = hiltViewModel(),
internal fun TraineeHomeRoute(
viewModel: TraineeHomeViewModel = hiltViewModel(),
) {
HomeScreen()
TraineeHomeScreen()
}

@Composable
fun HomeScreen() {
fun TraineeHomeScreen() {
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
Text(
text = "home",
text = "trainee home",
modifier = Modifier.padding(innerPadding),
)
}
Expand Down
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,27 @@
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(
homeDestination: NavGraphBuilder.() -> Unit = { },
) {
navigation<Route.TraineeMainTab.Home>(startDestination = Route.TraineeHome) {
composable<Route.TraineeHome> {
TraineeHomeRoute()
}
homeDestination()
}
}
1 change: 1 addition & 0 deletions feature/trainee/main/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
16 changes: 16 additions & 0 deletions feature/trainee/main/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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(libs.kotlinx.immutable)
}
2 changes: 2 additions & 0 deletions feature/trainee/main/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />
Loading