Skip to content

Commit

Permalink
[Feat] 온보딩 화면 연결 및 UX 개선 (#83)
Browse files Browse the repository at this point in the history
* [fix] : 지하철 텍스트필드 입력시 자동으로 최하단으로 스크롤되게 수정

* [refactor] : 지하철 텍스트필드 포커스시 스크롤 최하단으로 가게 수정

* [fix] : 모든 아이콘 선택시 포커스 clear로 변경

* [feat] : 온보딩-프로필생성 네비게이션 연결

* [feat] : 시스템 네비게이션바 컬러 변경

* [feat] : 프로필 존재시 홈 화면으로 진입

* [refactor] : 불필요한 주석 제거
  • Loading branch information
ham2174 authored Feb 20, 2024
1 parent afa21ba commit 2511d21
Show file tree
Hide file tree
Showing 11 changed files with 120 additions and 57 deletions.
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies {
implementation(projects.core.designsystem)
implementation(projects.core.domain)
implementation(projects.core.data)
implementation(projects.core.datastore)
// feature
implementation(projects.feature.profile)
implementation(projects.feature.home)
Expand Down
8 changes: 7 additions & 1 deletion app/src/main/java/com/moya/funch/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import com.moya.funch.datastore.UserDataStore
import com.moya.funch.splash.LoadingScreen
import com.moya.funch.theme.FunchTheme
import com.moya.funch.ui.FunchApp
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
import kotlinx.coroutines.delay

@AndroidEntryPoint
class MainActivity : ComponentActivity() {

@Inject
lateinit var dataStore: UserDataStore

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
installSplashScreen()
Expand All @@ -32,7 +38,7 @@ class MainActivity : ComponentActivity() {
if (showLoading) {
LoadingScreen()
} else {
FunchApp()
FunchApp(dataStore = dataStore)
}
}
}
Expand Down
9 changes: 6 additions & 3 deletions app/src/main/java/com/moya/funch/navigation/FunchNavHost.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import androidx.navigation.compose.rememberNavController
import androidx.navigation.navOptions
import com.moya.funch.match.navigation.matchingScreen
import com.moya.funch.match.navigation.navigateToMatching
import com.moya.funch.onboarding.navigation.ON_BOARDING_ROUTE
import com.moya.funch.onboarding.navigation.onBoardingScreen

@Composable
fun FunchNavHost(hasProfile: Boolean, navController: NavHostController = rememberNavController()) {
Expand All @@ -17,14 +19,15 @@ fun FunchNavHost(hasProfile: Boolean, navController: NavHostController = remembe
) {
with(navController) {
profileGraph(
onNavigateToHome = ::navigateToHome,
onCloseMyProfile = ::closeMyProfile
onNavigateToHome = ::onNavigateToHome,
onCloseMyProfile = ::onCloseMyProfile
)
homeScreen(
onNavigateToMatching = ::onNavigateToMatching,
onNavigateToMyProfile = ::onNavigateToMyProfile
)
matchingScreen(onClose = { popBackStack(HOME_ROUTE, false) })
onBoardingScreen(onNavigateToCreateProfile = ::navigateToCreateProfile)
}
}
}
Expand All @@ -39,5 +42,5 @@ private val singleTopNavOptions = navOptions {
}

private fun determineStartDestination(hasProfile: Boolean): String {
return if (hasProfile) HOME_ROUTE else PROFILE_GRAPH_ROUTE
return if (hasProfile) HOME_ROUTE else ON_BOARDING_ROUTE
}
5 changes: 3 additions & 2 deletions app/src/main/java/com/moya/funch/ui/FunchApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.moya.funch.datastore.UserDataStore
import com.moya.funch.navigation.FunchNavHost
import com.moya.funch.theme.LocalBackgroundTheme

@Composable
fun FunchApp() {
fun FunchApp(dataStore: UserDataStore) {
val backgroundColor = LocalBackgroundTheme.current.color

Surface(
modifier = Modifier.fillMaxSize(),
color = backgroundColor
) {
FunchNavHost(
hasProfile = false
hasProfile = dataStore.hasUserId()
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ data class PunchChipColors(
private val selectedLabelColor: Color = White,
private val disabledLabelColor: Color = Gray400,
private val disabledSelectedLabelColor: Color = White
// private val
) {
@Stable
fun provideContainerColor(enabled: Boolean, selected: Boolean): Color {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ private fun statusBar() {
SideEffect {
val window = (view.context as Activity).window
window.statusBarColor = Gray900.toArgb()
window.navigationBarColor = Gray900.toArgb()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.moya.funch.HomeRoute

const val HOME_ROUTE = "home"

fun NavController.navigateToHome() = navigate(HOME_ROUTE) {
fun NavController.onNavigateToHome() = navigate(HOME_ROUTE) {
popUpTo(graph.id)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.moya.funch.onboarding.OnBoardingScreen

const val ON_BOARDING_ROUTE = "home"
const val ON_BOARDING_ROUTE = "on_boarding"

fun NavGraphBuilder.onBoardingScreen(onNavigateToCreateProfile: () -> Unit) {
composable(route = ON_BOARDING_ROUTE) {
OnBoardingScreen(onNavigateToCreateProfile)
OnBoardingScreen(onNavigateToCreateProfile = onNavigateToCreateProfile)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ internal class CreateProfileViewModel @Inject constructor(
onSuccess = { response ->
val newState = when {
response.isEmpty() -> SubwayTextFieldState.Error
response.size == 1 && subway == response.first().name -> SubwayTextFieldState.Success
subway == response.first().name -> SubwayTextFieldState.Success
else -> SubwayTextFieldState.Typing
}
setSubwayStations(response)
Expand Down
Loading

0 comments on commit 2511d21

Please sign in to comment.