Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ dependencies {
implementation(project(":feature:notice"))
implementation(project(":feature:signup"))
implementation(project(":feature:login"))
implementation(project(":core:designsystem"))

implementation(libs.androidx.activity.compose)
implementation(libs.androidx.navigation.runtime.ktx)
}
9 changes: 7 additions & 2 deletions app/src/main/java/com/yapp/app/official/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import com.yapp.feature.home.HomeScreen
import com.yapp.app.official.ui.YappApp
import com.yapp.app.official.ui.rememberNavigator
import com.yapp.core.designsystem.theme.YappTheme
import dagger.hilt.android.AndroidEntryPoint


Expand All @@ -14,7 +16,10 @@ class MainActivity : ComponentActivity() {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
HomeScreen()
val navigator = rememberNavigator()
YappTheme{
YappApp(navigator)
}
}
}
}
Expand Down
30 changes: 30 additions & 0 deletions app/src/main/java/com/yapp/app/official/navigation/YappNavHost.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.yapp.app.official.navigation

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.compose.NavHost
import com.yapp.app.official.ui.NavigatorState
import com.yapp.feature.home.navigation.homeNavGraph
import com.yapp.feature.login.navigation.loginNavGraph
import com.yapp.feature.notice.navigation.noticeNavGraph
import com.yapp.feature.signup.navigation.signupNavGraph


@Composable
fun YappNavHost(
navigator: NavigatorState,
modifier: Modifier = Modifier
) {
NavHost(
navController = navigator.navController,
startDestination = navigator.startDestination,
modifier = modifier,
) {
loginNavGraph(
onSignUpClick = { navigator.navigateSignUpScreen() }
Copy link
Member

Choose a reason for hiding this comment

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

๏ฟฝC: NIA์—์„œ๋„ loginNavGraph์— onXXXClick ๋„ค์ด๋ฐ์ด ๋“ค์–ด๊ฐ€๋‚˜์š”?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nia์—์„œ๋Š” toSignUpDestination ์ด๋Ÿฐ ๋„ค์ด๋ฐ์ด ๋“ค์–ด๊ฐ€๋Š”๋ฐ
์ €ํฌ๋Š” ๋ฒ„ํŠผ์„ ํ†ตํ•ด์„œ ์ „ํ™˜์ด ๋˜์–ด์„œ click ๋„ค์ด๋ฐ์ด ๋” ์ง๊ด€์ ์ผ ๊ฒƒ ๊ฐ™๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ์–ด์š” !

Copy link
Member

Choose a reason for hiding this comment

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

์•„ํ•˜ ์Œ .. onSignUpClick์ด SignUpButton์„ ํด๋ฆญํ•œ ๊ฒฝ์šฐ์ธ๊ฐ€์š”?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

๋„ต ๋งž์Šต๋‹ˆ๋‹ค~~

Copy link
Member

Choose a reason for hiding this comment

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

์—‡ ๊ทธ๋ ‡๋‹ค๋ฉด Graph์—์„œ๋Š” Screen์˜ ๋™์ž‘์„ ๋ชจ๋ฅด๊ฒŒ๋” ํ•˜๋Š”๊ฒŒ ๋‚˜์ค‘์— ์œ ์ง€๋ณด์ˆ˜ ํ•˜๊ธฐ ๋” ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

์˜คํ˜ธ .. ์ข‹์Šต๋‹ˆ๋‹ค ! ๋กœ๊ทธ์ธ ๋ทฐ ์ž‘์—…ํ•˜๋ฉด ๋งค๊ฐœ๋ณ€์ˆ˜๊ฐ€ ์ถ”๊ฐ€ ๋  ๊ฒƒ ๊ฐ™์•„์„œ ๊ทธ ๋•Œ ๊ฐ™์ด ๋„ค์ด๋ฐ ๋ฐ˜์˜ํ•˜๋„๋ก ํ• ๊ฒŒ์š” !

)
signupNavGraph()
homeNavGraph()
noticeNavGraph()
}
}
54 changes: 54 additions & 0 deletions app/src/main/java/com/yapp/app/official/ui/Navigator.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.yapp.app.official.ui

import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.navigation.NavDestination
import androidx.navigation.NavHostController
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import com.yapp.feature.home.navigation.navigateToHome
import com.yapp.feature.login.navigation.LoginRoute
import com.yapp.feature.login.navigation.navigateToLogin
import com.yapp.feature.notice.navigation.navigateToNotice
import com.yapp.feature.signup.navigation.navigateToSignUp


@Composable
fun rememberNavigator(
navController: NavHostController = rememberNavController(),
): NavigatorState = remember(navController) {
NavigatorState(
navController = navController,
)
}


class NavigatorState(
val navController: NavHostController,
) {
private val currentDestination: NavDestination?
@Composable get() = navController
.currentBackStackEntryAsState().value?.destination

val startDestination = LoginRoute

fun navigateLoginScreen() {
navController.navigateToLogin()
}

fun navigateSignUpScreen() {
navController.navigateToSignUp()
}

fun navigateHomeScreen() {
navController.navigateToHome()
}

fun navigateNoticeScreen() {
navController.navigateToNotice()
}

private fun popBackStack() {
navController.popBackStack()
}
}
16 changes: 16 additions & 0 deletions app/src/main/java/com/yapp/app/official/ui/YappApp.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.yapp.app.official.ui

import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.yapp.app.official.navigation.YappNavHost


@Composable
fun YappApp(navigator: NavigatorState) {
Scaffold{ padding ->
YappNavHost(navigator, modifier = Modifier.padding(padding))
}
}

1 change: 1 addition & 0 deletions build-logic/src/main/java/com/yapp/ComposeAndroid.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ internal fun Project.configureCompose() {
add("implementation", libs.findLibrary("androidx.material3").get())
add("implementation", libs.findLibrary("androidx.ui").get())
add("implementation", libs.findLibrary("androidx.ui.tooling.preview").get())
add("implementation", libs.findLibrary("androidx.navigation.compose").get())
add("androidTestImplementation", libs.findLibrary("androidx.junit").get())
add("androidTestImplementation", libs.findLibrary("androidx.espresso.core").get())
add("androidTestImplementation", libs.findLibrary("androidx.ui.test.junit4").get())
Expand Down
10 changes: 9 additions & 1 deletion build-logic/src/main/java/com/yapp/KotlinAndroid.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.yapp
import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
Expand All @@ -16,7 +17,10 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
*/
internal fun Project.configureKotlinAndroid() {
// Plugins
pluginManager.apply("org.jetbrains.kotlin.android")
with(pluginManager) {
apply("org.jetbrains.kotlin.android")
apply("org.jetbrains.kotlin.plugin.serialization")
Copy link
Member

@jinukeu jinukeu Jan 21, 2025

Choose a reason for hiding this comment

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

A: ์˜ค Nia์—์„œ๋„ serialization์„ ์—ฌ๊ธฐ์„œ ํ•˜๋‚˜์š”?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

์•— ์•„๋…€ ใ…Žใ…‹ ์ปจ๋ฐด์…˜ ์ด๋ฒˆ์— ์ถ”๊ฐ€ํ•˜๋ฉด์„œ ๋А๋‚€๊ฑด๋ฐ ์ˆ˜์ •์ด ํ•„์š”๋กœ ํ•ด๋ณด์ž…๋‹ˆ๋‹ค.. !
( register ๋ฐฉ์‹ vs / .gradle.kts ํ”Œ๋Ÿฌ๊ทธ์ธ ํŒŒ์ผ.)

์šฐ์„  ์ˆœ์œ„ ๋†’์€ ์ž‘์—… ๋๋‚˜๋ฉด ๋…ผ์˜ ํ†ตํ•ด์„œ ๊ฐœ์„ ํ•˜๋Š”๊ฒŒ ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ท

Copy link
Member

Choose a reason for hiding this comment

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

์ข‹์Šต๋‹ˆ๋‹ค!! ์ผ๋‹จ ์š”๋ ‡๊ฒŒ ๊ณ ๊ณ  ํ•˜์‹œ์ฃ 

}

// Android settings
androidExtension.apply {
Expand Down Expand Up @@ -44,6 +48,10 @@ internal fun Project.configureKotlinAndroid() {

}
configureKotlinCommon(jvmTarget = JvmTarget.JVM_17)
val libs = extensions.libs
dependencies {
"implementation"(libs.findLibrary("kotlinx.serialization.json").get())
}
}


Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
alias(libs.plugins.kotlin.compose) apply false
alias(libs.plugins.jetbrains.kotlin.jvm) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.hilt) apply false
alias(libs.plugins.ksp) apply false
}
22 changes: 7 additions & 15 deletions feature/home/src/main/java/com/yapp/feature/home/HomeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,21 @@ package com.yapp.feature.home

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.safeContent
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.yapp.core.designsystem.component.button.text.YappTextAssistiveButtonSmall
import com.yapp.core.designsystem.theme.YappTheme


@Composable
fun HomeScreen (
){
YappTheme {
Column(
modifier = Modifier.windowInsetsPadding(WindowInsets.safeContent),
verticalArrangement = Arrangement.spacedBy(12.dp)) {
YappTextAssistiveButtonSmall(
text = "Home",
enable = true,
onClick = {}
)
}
Column(
verticalArrangement = Arrangement.spacedBy(12.dp)) {
YappTextAssistiveButtonSmall(
text = "Home",
enable = true,
onClick = {}
)
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.yapp.feature.home.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
import androidx.navigation.compose.composable
import com.yapp.feature.home.HomeScreen
import kotlinx.serialization.Serializable

@Serializable data object HomeRoute

fun NavController.navigateToHome(navOptions: NavOptions? = null) { navigate(HomeRoute, navOptions) }

fun NavGraphBuilder.homeNavGraph(){
composable<HomeRoute> {
HomeScreen()
}
}
21 changes: 21 additions & 0 deletions feature/login/src/main/java/com/yapp/feature/login/LoginScreen.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.yapp.feature.login

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.runtime.Composable
import androidx.compose.ui.unit.dp
import com.yapp.core.designsystem.component.button.text.YappTextAssistiveButtonSmall

@Composable
fun LoginScreen (
){
Column(
verticalArrangement = Arrangement.spacedBy(12.dp)) {
YappTextAssistiveButtonSmall(
text = "Login",
enable = true,
onClick = {}
)
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.yapp.feature.login.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
import androidx.navigation.compose.composable
import com.yapp.feature.login.LoginScreen
import kotlinx.serialization.Serializable

@Serializable data object LoginRoute

fun NavController.navigateToLogin(navOptions: NavOptions? = null) { navigate(LoginRoute, navOptions) }

fun NavGraphBuilder.loginNavGraph(
onSignUpClick: NavGraphBuilder.() -> Unit,
){
composable<LoginRoute> {
LoginScreen()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.yapp.feature.notice

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.safeContent
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.yapp.core.designsystem.component.button.text.YappTextAssistiveButtonSmall

@Composable
fun NoticeScreen (
){
Column(
modifier = Modifier.windowInsetsPadding(WindowInsets.safeContent),
verticalArrangement = Arrangement.spacedBy(12.dp)) {
YappTextAssistiveButtonSmall(
text = "Notice",
enable = true,
onClick = {}
)
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.yapp.feature.notice.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
import androidx.navigation.compose.composable
import com.yapp.feature.notice.NoticeScreen
import kotlinx.serialization.Serializable

@Serializable data object NoticeRoute

fun NavController.navigateToNotice(navOptions: NavOptions? = null) { navigate(NoticeRoute, navOptions) }

fun NavGraphBuilder.noticeNavGraph(
){
composable<NoticeRoute> {
NoticeScreen()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.yapp.feature.signup

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.safeContent
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.yapp.core.designsystem.component.button.text.YappTextAssistiveButtonSmall

@Composable
fun SignUpScreen (
){
Column(
modifier = Modifier.windowInsetsPadding(WindowInsets.safeContent),
verticalArrangement = Arrangement.spacedBy(12.dp)) {
YappTextAssistiveButtonSmall(
text = "ํšŒ์›๊ฐ€์ž…",
enable = true,
onClick = {}
)
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.yapp.feature.signup.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
import androidx.navigation.compose.composable
import com.yapp.feature.signup.SignUpScreen
import kotlinx.serialization.Serializable

@Serializable data object SignUpRoute

fun NavController.navigateToSignUp(navOptions: NavOptions? = null) { navigate(SignUpRoute, navOptions) }

fun NavGraphBuilder.signupNavGraph(){
Comment on lines +12 to +14
Copy link
Member

Choose a reason for hiding this comment

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

์ข‹๋„ค์š” ๐Ÿ‘

composable<SignUpRoute> {
SignUpScreen()
}
}
Loading