Skip to content

Commit

Permalink
Merge pull request #71 from Team-Ampersand/feature/70_write_navigate_…
Browse files Browse the repository at this point in the history
…logic

🔀 :: (#70) write navigate logic
  • Loading branch information
Cjsghkd authored Sep 18, 2023
2 parents 31fb84c + 7014164 commit 4caa1a4
Show file tree
Hide file tree
Showing 20 changed files with 189 additions and 8 deletions.
3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ android {
dependencies {
implementation(project(":data"))
implementation(project(":domain"))
implementation(project(":presentation"))

implementation(Dependency.Androidx.CORE_KTX)
implementation(Dependency.Androidx.APP_COMPAT)
Expand All @@ -65,6 +66,8 @@ dependencies {
implementation(Dependency.Libraries.OKHTTP)
implementation(Dependency.Libraries.OKHTTP_LOGGING_INTERCEPTOR)

implementation(Dependency.Compose.NAVIGATION_COMPOSE)

testImplementation(Dependency.UnitTest.JUNIT)
androidTestImplementation(Dependency.AndroidTest.ANDROID_JUNIT)
androidTestImplementation(Dependency.AndroidTest.ESPRESSO_CORE)
Expand Down
12 changes: 10 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.DotoriAndroid"
tools:targetApi="31" />

tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
31 changes: 31 additions & 0 deletions app/src/main/java/com/msg/dotori/DotoriNavHost.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.msg.dotori

import androidx.compose.runtime.Composable
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import com.msg.presentation.view.find_password.navigation.findPasswordScreen
import com.msg.presentation.view.login.navigation.loginScreen
import com.msg.presentation.view.massage_chair.navigation.massageChairScreen
import com.msg.presentation.view.music.navigation.musicScreen
import com.msg.presentation.view.self_study.navigation.selfStudyScreen
import com.msg.presentation.view.signup.navigation.signUpScreen
import com.msg.presentation.view.student_info.navigation.studentInfoScreen

@Composable
fun DotoriNavHost(
navController: NavHostController,
startDestination: String
) {
NavHost(
navController = navController,
startDestination = startDestination
) {
loginScreen()
findPasswordScreen()
signUpScreen()
massageChairScreen()
selfStudyScreen()
musicScreen()
studentInfoScreen()
}
}
7 changes: 6 additions & 1 deletion app/src/main/java/com/msg/dotori/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ package com.msg.dotori

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.navigation.compose.rememberNavController
import com.msg.presentation.view.login.navigation.loginRoute
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

setContent {
DotoriNavHost(navController = rememberNavController(), startDestination = loginRoute)
}
}
}
1 change: 1 addition & 0 deletions buildSrc/src/main/java/Dependency.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ object Dependency {
const val COMPOSE_PREVIEW = "androidx.compose.ui:ui-tooling-preview:${Versions.COMPOSE}"
const val COMPOSE_MATERIAL = "androidx.compose.material:material:${Versions.COMPOSE_MATERIAL}"
const val COMPOSE_TOOL = "androidx.compose.ui:ui-tooling:${Versions.COMPOSE}"
const val NAVIGATION_COMPOSE = "androidx.navigation:navigation-compose:${Versions.NAVIGATION_COMPOSE}"
}

object UnitTest {
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/java/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ object Versions {
const val ACTIVITY_COMPOSE = "1.3.1"
const val COMPOSE_MATERIAL = "1.2.0"
const val COMPOSE_COMPILER = "1.3.2"
const val NAVIGATION_COMPOSE = "2.6.0"
}
1 change: 1 addition & 0 deletions presentation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ dependencies {
implementation(Dependency.Compose.COMPOSE_TOOL)
implementation(Dependency.Compose.COMPOSE_MATERIAL)
implementation(Dependency.Compose.COMPOSE_PREVIEW)
implementation(Dependency.Compose.NAVIGATION_COMPOSE)

testImplementation(Dependency.UnitTest.JUNIT)
androidTestImplementation(Dependency.AndroidTest.ANDROID_JUNIT)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.msg.presentation.view.find_password.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.msg.presentation.view.find_password.FindPasswordScreen

const val findPasswordRoute = "find_password_route"

fun NavController.navigateToFindPassword() {
this.navigate(findPasswordRoute)
}

fun NavGraphBuilder.findPasswordScreen() {
composable(findPasswordRoute) {
FindPasswordScreen()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.msg.presentation.view.login.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.msg.presentation.view.login.LoginScreen

const val loginRoute = "login_route"

fun NavController.navigateToLogin() {
this.navigate(loginRoute)
}

fun NavGraphBuilder.loginScreen() {
composable(loginRoute) {
LoginScreen {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.msg.presentation.view.massage_chair.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.msg.presentation.view.massage_chair.MassageChairScreen

const val massageChairRoute = "massage_chair_route"

fun NavController.navigateToMassageChair() {
this.navigate(massageChairRoute)
}

fun NavGraphBuilder.massageChairScreen() {
composable(massageChairRoute) {
MassageChairScreen()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ import com.dotori.dotori_components.components.dialog.DotoriDialog
import com.dotori.dotori_components.components.music.DotoriMusicListItem
import com.dotori.dotori_components.theme.DotoriTheme
import com.msg.presentation.R
import com.msg.presentation.view.music.component.BottomSheetContent
import com.msg.presentation.view.music.component.BottomSheetType
import com.msg.presentation.view.music.component.DotoriTopBar
import com.msg.presentation.view.music.component.MusicDialogContent
import com.msg.presentation.view.music.component.MusicHeader
import kotlinx.coroutines.launch

@OptIn(ExperimentalMaterialApi::class)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.msg.presentation.view.music
package com.msg.presentation.view.music.component

import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.msg.presentation.view.music
package com.msg.presentation.view.music.component

enum class BottomSheetType {
Option, Calendar
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.msg.presentation.view.music
package com.msg.presentation.view.music.component

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.msg.presentation.view.music
package com.msg.presentation.view.music.component

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.msg.presentation.view.music
package com.msg.presentation.view.music.component

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.msg.presentation.view.music.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.msg.presentation.view.music.MusicScreen

const val musicRoute = "music_route"

fun NavController.navigateToMusic() {
this.navigate(musicRoute)
}

fun NavGraphBuilder.musicScreen() {
composable(musicRoute) {
MusicScreen()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.msg.presentation.view.self_study.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.msg.presentation.view.self_study.SelfStudyScreen

const val selfStudyRoute = "self_study_route"

fun NavController.navigateToSelfStudy() {
this.navigate(selfStudyRoute)
}

fun NavGraphBuilder.selfStudyScreen() {
composable(selfStudyRoute) {
SelfStudyScreen()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.msg.presentation.view.signup.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.msg.presentation.view.signup.SignUpScreen

const val signUpRoute = "sign_up_route"

fun NavController.navigateToSignUp() {
this.navigate(signUpRoute)
}

fun NavGraphBuilder.signUpScreen() {
composable(signUpRoute) {
SignUpScreen()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.msg.presentation.view.student_info.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.msg.presentation.view.student_info.StudentInfoScreen

const val studentInfoRoute = "student_info_route"

fun NavController.navigateToStudentInfo() {
this.navigate(studentInfoRoute)
}

fun NavGraphBuilder.studentInfoScreen() {
composable(studentInfoRoute) {
StudentInfoScreen()
}
}

0 comments on commit 4caa1a4

Please sign in to comment.