Skip to content

Commit

Permalink
[Feature] 홈 모듈 생성 및 홈-프로필 네비게이션 연결 (#29)
Browse files Browse the repository at this point in the history
* [build] : AndroidHiltPlugin에 hilt-navigation-compose 라이브러리 추가

* [feat] : Home, Profile 네비게이션 연결

* [build] : profile 모듈 :designsystem 추가

* [chore] : reformat

* [refactor] : 네비게이션 homeGraph 제거 및 homeScreen으로 변경

* [refactor] : Profile sealed class 이름 ProfileScreens로 변경
  • Loading branch information
ham2174 authored Feb 3, 2024
1 parent 7a1ff40 commit 7eee4ac
Show file tree
Hide file tree
Showing 21 changed files with 599 additions and 357 deletions.
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dependencies {
implementation(projects.core.network) // @murjune TODO : 삭제
// feature
implementation(projects.feature.profile)
implementation(projects.feature.home)
// implementation(projects.feature.match)

// implementation(libs.coil.core)
Expand Down
45 changes: 1 addition & 44 deletions app/src/main/java/com/moya/funch/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,17 @@ package com.moya.funch
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier
import androidx.lifecycle.lifecycleScope
import com.moya.funch.network.dto.request.MatchingRequest
import com.moya.funch.network.service.MatchingService
import com.moya.funch.theme.FunchTheme
import com.moya.funch.theme.LocalBackgroundTheme
import com.moya.funch.ui.FunchApp
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import timber.log.Timber
import javax.inject.Inject

@AndroidEntryPoint
class MainActivity : ComponentActivity() {
@Inject
lateinit var matchingService: MatchingService

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

// @murjune TODO : 삭제
lifecycleScope.launch {
runCatching { // 내꺼 코드 : 7O2K, 상대 코드 : 4V1B
matchingService.matchProfile(
MatchingRequest(
userId = "65b6c543ebe5db753688b9dd",
targetCode = "7O2K",
),
)
}.onSuccess {
Timber.e("성공 : $it")
}.onFailure {
Timber.e(it.stackTraceToString())
}
}

setContent {
FunchTheme {
val backgroundColor = LocalBackgroundTheme.current.color
Surface(
modifier = Modifier.fillMaxSize(),
color = backgroundColor,
) {
FunchApp(
matchingCode = "",
onMatchingCodeChange = {},
onSearchClick = {},
myCode = "",
onMyProfileClick = {},
viewCount = 12,
)
}
FunchApp()
}
}
}
Expand Down
30 changes: 30 additions & 0 deletions app/src/main/java/com/moya/funch/navigation/FunchNavHost.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.moya.funch.navigation

import androidx.compose.runtime.Composable
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.rememberNavController

@Composable
fun FunchNavHost(
hasProfile: Boolean,
navController: NavHostController = rememberNavController(),
) {
NavHost(
navController = navController,
startDestination = determineStartDestination(hasProfile),
) {
profileGraph(
onNavigateToHome = navController::navigateToHome,
onCloseMyProfile = navController::closeMyProfile,
)
homeScreen(
onNavigateToMatching = { /* @Gun Hyung TODO : 매칭 라우터 연결 */ },
onNavigateToMyProfile = navController::navigateToMyProfile,
)
}
}

private fun determineStartDestination(hasProfile: Boolean): String {
return if (hasProfile) HOME_ROUTE else PROFILE_GRAPH_ROUTE
}
Loading

0 comments on commit 7eee4ac

Please sign in to comment.