diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d0a2ec3e..b50d90ca 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -71,6 +71,7 @@ dependencies { implementation(project(":core:navigation")) implementation(project(":feature:home")) implementation(project(":feature:storage")) + implementation(project(":feature:save")) implementation(libs.core.ktx) implementation(libs.kotlin.android) diff --git a/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt b/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt index bf2d62c9..26d5cc76 100644 --- a/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt +++ b/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt @@ -3,6 +3,8 @@ package com.mashup.dorabangs.navigation import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.navigation.compose.NavHost +import com.dorabangs.feature.navigation.navigateToSaveLink +import com.dorabangs.feature.navigation.saveLinkNavigation import com.mashup.core.navigation.NavigationRoute import com.mashup.dorabangs.feature.navigation.homeNavigation import com.mashup.dorabangs.feature.storage.navigation.storageDetailNavigation @@ -19,8 +21,11 @@ fun MainNavHost( navController = appState.navController, startDestination = startDestination, ) { - homeNavigation() + homeNavigation { + appState.navController.navigateToSaveLink() + } storageNavigation(appState.navController) storageDetailNavigation(appState.navController) + saveLinkNavigation(appState.navController) } } diff --git a/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/snackbar/DorabangsSnackBar.kt b/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/snackbar/DorabangsSnackBar.kt index c6ec3b5c..4848dd5a 100644 --- a/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/snackbar/DorabangsSnackBar.kt +++ b/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/snackbar/DorabangsSnackBar.kt @@ -1,6 +1,7 @@ package com.mashup.dorabangs.core.designsystem.component.snackbar import android.annotation.SuppressLint +import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement @@ -105,10 +106,9 @@ fun SnackBarContent( modifier = Modifier.size(24.dp), onClick = dismissAction, ) { - Icon( + Image( imageVector = DoraIconClose.CloseCircle, contentDescription = stringResource(id = R.string.snack_bar_cancel_description), - tint = ClipBoardColorTokens.UrlLinkSubColor1, ) } } diff --git a/core/navigation/src/main/java/com/mashup/core/navigation/NavigationRoute.kt b/core/navigation/src/main/java/com/mashup/core/navigation/NavigationRoute.kt index 5c3d417f..0b5f6de4 100644 --- a/core/navigation/src/main/java/com/mashup/core/navigation/NavigationRoute.kt +++ b/core/navigation/src/main/java/com/mashup/core/navigation/NavigationRoute.kt @@ -5,4 +5,5 @@ sealed class NavigationRoute(val route: String) { object StorageScreen : NavigationRoute("storage") { object StorageDetailScreen : NavigationRoute("storage/detail") } + object SaveLink : NavigationRoute("save") } diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeNavigation.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeNavigation.kt index 61fbdae5..15a26293 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeNavigation.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeNavigation.kt @@ -7,12 +7,15 @@ import androidx.navigation.compose.composable import com.mashup.core.navigation.NavigationRoute import com.mashup.dorabangs.feature.home.HomeRoute -fun NavController.navigateToHome(navOptions: NavOptions) = navigate(NavigationRoute.HomeScreen.route, navOptions) +fun NavController.navigateToHome(navOptions: NavOptions) = + navigate(NavigationRoute.HomeScreen.route, navOptions) -fun NavGraphBuilder.homeNavigation() { +fun NavGraphBuilder.homeNavigation(action: () -> Unit) { composable( route = NavigationRoute.HomeScreen.route, ) { - HomeRoute() + HomeRoute( + actionSnackBar = action, + ) } } diff --git a/feature/save/src/main/java/com/dorabangs/feature/navigation/SaveLinkNavigation.kt b/feature/save/src/main/java/com/dorabangs/feature/navigation/SaveLinkNavigation.kt new file mode 100644 index 00000000..cc0b9dfa --- /dev/null +++ b/feature/save/src/main/java/com/dorabangs/feature/navigation/SaveLinkNavigation.kt @@ -0,0 +1,22 @@ +package com.dorabangs.feature.navigation + +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavHostController +import androidx.navigation.NavOptions +import androidx.navigation.compose.composable +import com.dorabangs.feature.save.DoraLinkSaveRoute +import com.mashup.core.navigation.NavigationRoute + +fun NavController.navigateToSaveLink(navOptions: NavOptions? = null) = + navigate(NavigationRoute.SaveLink.route, navOptions) + +fun NavGraphBuilder.saveLinkNavigation(navController: NavHostController) { + composable( + route = NavigationRoute.SaveLink.route, + ) { + DoraLinkSaveRoute(onClickBackIcon = { + navController.navigate(NavigationRoute.SaveLink.route) + }) + } +}