From 98d27bdef5111736db061080c6e09f85031e047f Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sun, 7 Jul 2024 16:45:29 +0900 Subject: [PATCH 01/22] =?UTF-8?q?[feat]=20=ED=99=88=ED=99=94=EB=A9=B4=20?= =?UTF-8?q?=ED=8F=B4=EB=8D=94=20=EC=83=9D=EC=84=B1=20=ED=99=94=EB=A9=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../createfolder/HomeCreateFolderScreen.kt | 73 +++++++++++++++++++ feature/home/src/main/res/values/string.xml | 8 ++ 2 files changed, 81 insertions(+) create mode 100644 feature/home/src/main/java/com/mashup/dorabangs/feature/createfolder/HomeCreateFolderScreen.kt create mode 100644 feature/home/src/main/res/values/string.xml diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/createfolder/HomeCreateFolderScreen.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/createfolder/HomeCreateFolderScreen.kt new file mode 100644 index 00000000..53506736 --- /dev/null +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/createfolder/HomeCreateFolderScreen.kt @@ -0,0 +1,73 @@ +package com.mashup.dorabangs.feature.createfolder + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import com.mashup.dorabangs.core.designsystem.component.buttons.DoraButtons +import com.mashup.dorabangs.core.designsystem.component.textfield.DoraTextField +import com.mashup.dorabangs.core.designsystem.component.topbar.DoraTopBar +import com.mashup.dorabangs.core.designsystem.theme.LinkSaveColorTokens +import com.mashup.dorabangs.home.R + +@Composable +fun HomeCreateFolderRoute( + onClickBackIcon: () -> Unit, +) { + HomeCreateFolderScreen( + onClickBackIcon = onClickBackIcon, + onClickSaveButton = {}, + ) +} + +@Composable +fun HomeCreateFolderScreen( + onClickBackIcon: () -> Unit, + onClickSaveButton: () -> Unit, + modifier: Modifier = Modifier, +) { + Column( + modifier = modifier + .fillMaxSize() + .background(color = LinkSaveColorTokens.ContainerColor), + ) { + DoraTopBar.BackNavigationTopBar( + modifier = Modifier, + title = stringResource(id = R.string.home_create_folder_title), + isTitleCenter = true, + onClickBackIcon = onClickBackIcon, + ) + Spacer(modifier = Modifier.height(height = 24.dp)) + Column( + modifier = modifier + .fillMaxSize() + .padding(horizontal = 20.dp), + ) { + DoraTextField( + text = "", + hintText = stringResource(id = R.string.home_create_folder_hint), + labelText = stringResource(id = R.string.home_create_folder_label), + helperText = stringResource(id = R.string.home_create_folder_helper), + helperEnabled = true, + counterEnabled = true, + ) + Spacer(modifier = Modifier.height(20.dp)) + DoraButtons.DoraBtnMaxFull( + modifier = Modifier + .fillMaxWidth() + .padding(vertical = 20.dp), + buttonText = stringResource(id = R.string.home_create_folder_save), + enabled = true, + onClickButton = onClickSaveButton, + ) + Spacer(modifier = Modifier.height(20.dp)) + } + } +} diff --git a/feature/home/src/main/res/values/string.xml b/feature/home/src/main/res/values/string.xml new file mode 100644 index 00000000..7c55f182 --- /dev/null +++ b/feature/home/src/main/res/values/string.xml @@ -0,0 +1,8 @@ + + + 폴더명을 입력해주세요. + 폴더명 + 같은 이름의 폴더 있어요 + 저장 + 새 폴더 추가 + \ No newline at end of file From 0f2dcb146a8976bfbc38de27ef05d84f1d7c9b55 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sun, 7 Jul 2024 16:46:04 +0900 Subject: [PATCH 02/22] =?UTF-8?q?[feat]=20=ED=8F=B4=EB=8D=94=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20navigation=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../navigation/HomeCreateFolderNavigation.kt | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeCreateFolderNavigation.kt diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeCreateFolderNavigation.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeCreateFolderNavigation.kt new file mode 100644 index 00000000..a4f91251 --- /dev/null +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeCreateFolderNavigation.kt @@ -0,0 +1,23 @@ +package com.mashup.dorabangs.feature.navigation + +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavOptions +import androidx.navigation.compose.composable +import com.mashup.core.navigation.NavigationRoute +import com.mashup.dorabangs.feature.createfolder.HomeCreateFolderRoute + +fun NavController.navigateToHomeCrateFolder(navOptions: NavOptions? = null) = + navigate(NavigationRoute.HomeScreen.HomeCreateFolder.route, navOptions) + +fun NavGraphBuilder.homeCreateFolderNavigation( + onClickBackIcon: () -> Unit, +) { + composable( + route = NavigationRoute.HomeScreen.HomeCreateFolder.route, + ) { + HomeCreateFolderRoute( + onClickBackIcon = {}, + ) + } +} From fab70fa95e3cda8f49ae756a48e551824b2192b9 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sun, 7 Jul 2024 16:46:40 +0900 Subject: [PATCH 03/22] =?UTF-8?q?[feat]=20=ED=99=88=ED=99=94=EB=A9=B4-=20?= =?UTF-8?q?=ED=8F=B4=EB=8D=94=EC=83=9D=EC=84=B1=20navigation=20=EC=97=B0?= =?UTF-8?q?=EA=B2=B0=20=EB=B0=8F=20bottomSheet=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Conflicts: # app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt # feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt # feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeNavigation.kt --- .../mashup/dorabangs/navigation/MainNavHost.kt | 16 ++++++++++++++-- .../component/bottomsheet/BottomSheetType.kt | 6 ++++++ .../component/bottomsheet/DoraBottomSheetItem.kt | 4 +++- .../mashup/core/navigation/NavigationRoute.kt | 4 +++- .../createfolder/HomeCreateFolderScreen.kt | 1 + .../mashup/dorabangs/feature/home/HomeScreen.kt | 6 ++++++ .../feature/navigation/HomeNavigation.kt | 2 ++ .../storage/navigation/StorageNavigation.kt | 10 ++++++---- 8 files changed, 41 insertions(+), 8 deletions(-) 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 42b1b660..921fca51 100644 --- a/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt +++ b/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt @@ -4,13 +4,17 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.navigation.compose.NavHost import androidx.navigation.navOptions +import com.dorabangs.feature.navigation.navigateToSaveLink import com.dorabangs.feature.navigation.navigateToSaveLinkSelectFolder import com.dorabangs.feature.navigation.saveLinkNavigation import com.dorabangs.feature.navigation.saveLinkSelectFolder import com.mashup.core.navigation.NavigationRoute +import com.mashup.dorabangs.feature.navigation.homeCreateFolderNavigation import com.mashup.dorabangs.feature.navigation.homeNavigation import com.mashup.dorabangs.feature.navigation.navigateToHome +import com.mashup.dorabangs.feature.navigation.navigateToHomeCrateFolder import com.mashup.dorabangs.feature.navigation.onBoardingNavigation +import com.mashup.dorabangs.feature.storage.navigation.navigateToStorageDetail import com.mashup.dorabangs.feature.storage.navigation.storageDetailNavigation import com.mashup.dorabangs.feature.storage.navigation.storageNavigation import com.mashup.feature.classification.navigation.classificationNavigation @@ -27,6 +31,7 @@ fun MainNavHost( navController = appState.navController, startDestination = startDestination, ) { + onBoardingNavigation { appState.navController.navigateToHome() } homeNavigation( navigateToClassification = { appState.navController.navigateToClassification() }, navigateToSaveScreenWithLink = { copiedUrl -> @@ -35,9 +40,16 @@ fun MainNavHost( navigateToSaveScreenWithoutLink = { appState.navController.navigateToSaveLink() }, + navigateToCreateFolder = { appState.navController.navigateToHomeCrateFolder() }, ) - onBoardingNavigation { appState.navController.navigateToHome() } - storageNavigation(appState.navController) + homeCreateFolderNavigation( + onClickBackIcon = { appState.navController.popBackStack() }, + ) + storageNavigation( + navigateToStorageDetail = { appState.navController.navigateToStorageDetail() }, + onClickAddFolderIcon = {}, + ) + storageDetailNavigation(appState.navController) classificationNavigation(appState.navController) saveLinkNavigation( diff --git a/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/bottomsheet/BottomSheetType.kt b/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/bottomsheet/BottomSheetType.kt index 1bf9d0af..07e36e85 100644 --- a/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/bottomsheet/BottomSheetType.kt +++ b/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/bottomsheet/BottomSheetType.kt @@ -66,6 +66,8 @@ object DoraBottomSheet : BottomSheetType { isShowSheet: Boolean, folderList: List, onDismissRequest: () -> Unit, + onClickCreateFolder: () -> Unit, + onClickMoveFolder: () -> Unit, ) { if (isShowSheet) { DoraBaseBottomSheet( @@ -93,6 +95,7 @@ object DoraBottomSheet : BottomSheetType { itemName = stringResource(id = R.string.moving_folder_dialog_add_folder), isSelected = false, ), + onClickItem = onClickCreateFolder, ) } @@ -100,6 +103,7 @@ object DoraBottomSheet : BottomSheetType { DoraBottomSheetFolderItem( modifier = Modifier.fillMaxWidth(), data = folderList[index], + onClickItem = onClickMoveFolder, ) } @@ -136,5 +140,7 @@ sealed interface BottomSheetType { isShowSheet: Boolean, folderList: List, onDismissRequest: () -> Unit, + onClickCreateFolder: () -> Unit, + onClickMoveFolder: () -> Unit, ) } diff --git a/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/bottomsheet/DoraBottomSheetItem.kt b/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/bottomsheet/DoraBottomSheetItem.kt index 5d71e4b0..b87c9fb4 100644 --- a/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/bottomsheet/DoraBottomSheetItem.kt +++ b/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/bottomsheet/DoraBottomSheetItem.kt @@ -93,6 +93,7 @@ fun DoraBottomSheetFolderItem( data: SelectableBottomSheetItemUIModel, modifier: Modifier = Modifier, background: Color = BottomSheetColorTokens.MovingFolderColor, + onClickItem: () -> Unit = {}, ) { Row( modifier = modifier @@ -102,10 +103,11 @@ fun DoraBottomSheetFolderItem( verticalAlignment = Alignment.CenterVertically, ) { DoraFolderListItem( - BottomSheetItemUIModel( + data = BottomSheetItemUIModel( icon = data.icon, itemName = data.itemName, ), + modifier = Modifier.clickable { onClickItem() }, ) if (data.isSelected) { Icon( 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 cf6fe74f..8e8c7a31 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 @@ -2,7 +2,9 @@ package com.mashup.core.navigation sealed class NavigationRoute(val route: String) { object OnBoardingScreen : NavigationRoute("onboarding") - object HomeScreen : NavigationRoute("home") + object HomeScreen : NavigationRoute("home") { + object HomeCreateFolder : NavigationRoute("home/createfolder") + } object StorageScreen : NavigationRoute("storage") { object StorageDetailScreen : NavigationRoute("storage/detail") } diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/createfolder/HomeCreateFolderScreen.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/createfolder/HomeCreateFolderScreen.kt index 53506736..6a19a03e 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/createfolder/HomeCreateFolderScreen.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/createfolder/HomeCreateFolderScreen.kt @@ -57,6 +57,7 @@ fun HomeCreateFolderScreen( helperText = stringResource(id = R.string.home_create_folder_helper), helperEnabled = true, counterEnabled = true, + onValueChanged = {} ) Spacer(modifier = Modifier.height(20.dp)) DoraButtons.DoraBtnMaxFull( diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt index 7ac47374..4aa97f80 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt @@ -57,6 +57,7 @@ fun HomeRoute( navigateToClassification: () -> Unit = {}, navigateToSaveScreenWithLink: (String) -> Unit = {}, navigateToSaveScreenWithoutLink: () -> Unit = {}, + navigateToCreateFolder: () -> Unit, ) { val snackBarHostState by remember { mutableStateOf(SnackbarHostState()) } val state by viewModel.collectAsState() @@ -131,6 +132,11 @@ fun HomeRoute( isShowSheet = state.isShowMovingFolderSheet, folderList = testFolderListData, onDismissRequest = { viewModel.setVisibleMovingFolderBottomSheet(false) }, + onClickCreateFolder = { + viewModel.setVisibleMovingFolderBottomSheet(false) + navigateToCreateFolder() + }, + onClickMoveFolder = {}, ) DoraDialog( 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 92b7e779..7c9ad3b0 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 @@ -14,6 +14,7 @@ fun NavGraphBuilder.homeNavigation( navigateToClassification: () -> Unit = {}, navigateToSaveScreenWithLink: (String) -> Unit, navigateToSaveScreenWithoutLink: () -> Unit, + navigateToCreateFolder: () -> Unit, ) { composable( route = NavigationRoute.HomeScreen.route, @@ -22,6 +23,7 @@ fun NavGraphBuilder.homeNavigation( navigateToClassification = navigateToClassification, navigateToSaveScreenWithLink = navigateToSaveScreenWithLink, navigateToSaveScreenWithoutLink = navigateToSaveScreenWithoutLink, + navigateToCreateFolder = navigateToCreateFolder, ) } } diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/navigation/StorageNavigation.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/navigation/StorageNavigation.kt index 47b6b54e..5491ea4c 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/navigation/StorageNavigation.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/navigation/StorageNavigation.kt @@ -6,17 +6,19 @@ import androidx.navigation.NavOptions import androidx.navigation.compose.composable import com.mashup.core.navigation.NavigationRoute import com.mashup.dorabangs.feature.storage.storage.StorageRoute +import com.mashup.dorabangs.feature.storage.storage.model.StorageFolderItem fun NavController.navigateToStorage(navOptions: NavOptions) = navigate(NavigationRoute.StorageScreen.route, navOptions) -fun NavGraphBuilder.storageNavigation(navController: NavController) { +fun NavGraphBuilder.storageNavigation( + navigateToStorageDetail: (StorageFolderItem) -> Unit = {}, + onClickAddFolderIcon: () -> Unit, +) { composable( route = NavigationRoute.StorageScreen.route, ) { StorageRoute( - navigateToStorageDetail = { selectItem -> - navController.navigateToStorageDetail() - }, + navigateToStorageDetail = navigateToStorageDetail ) } } From 59a9d3bedd50a09bcb6e83615a6eaa9e051d8e2f Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sun, 7 Jul 2024 17:14:14 +0900 Subject: [PATCH 04/22] =?UTF-8?q?[feat]=20=EB=B3=B4=EA=B4=80=ED=95=A8?= =?UTF-8?q?=EC=AA=BD=20=ED=8F=B4=EB=8D=94=20=EC=83=9D=EC=84=B1=20UI=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../folders/StorageFolderManageScreen.kt | 74 +++++++++++++++++++ .../navigation/FolderManageNavigation.kt | 22 ++++++ .../navigation/StorageDetailNavigation.kt | 2 +- .../feature/navigation/StorageNavigation.kt | 26 +++++++ .../feature/storage/storage/StorageScreen.kt | 25 +++++-- .../storage/src/main/res/values/string.xml | 5 ++ 6 files changed, 147 insertions(+), 7 deletions(-) create mode 100644 feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/StorageFolderManageScreen.kt create mode 100644 feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/FolderManageNavigation.kt rename feature/storage/src/main/java/com/mashup/dorabangs/feature/{storage => }/navigation/StorageDetailNavigation.kt (92%) create mode 100644 feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/StorageNavigation.kt diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/StorageFolderManageScreen.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/StorageFolderManageScreen.kt new file mode 100644 index 00000000..692238a9 --- /dev/null +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/StorageFolderManageScreen.kt @@ -0,0 +1,74 @@ +package com.mashup.dorabangs.feature.folders + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import com.mashup.dorabangs.core.designsystem.component.buttons.DoraButtons +import com.mashup.dorabangs.core.designsystem.component.textfield.DoraTextField +import com.mashup.dorabangs.core.designsystem.component.topbar.DoraTopBar +import com.mashup.dorabangs.core.designsystem.theme.LinkSaveColorTokens +import com.mashup.dorabangs.feature.storage.R + +@Composable +fun StorageFolderManageRoute( + onClickBackIcon: () -> Unit, +) { + FolderManageScreen( + onClickBackIcon = onClickBackIcon, + onClickSaveButton = { }, + ) +} + +@Composable +fun FolderManageScreen( + onClickBackIcon: () -> Unit, + onClickSaveButton: () -> Unit, + modifier: Modifier = Modifier, +) { + Column( + modifier = modifier + .fillMaxSize() + .background(color = LinkSaveColorTokens.ContainerColor), + ) { + DoraTopBar.BackNavigationTopBar( + modifier = Modifier, + title = "새 폴더 추가", + isTitleCenter = true, + onClickBackIcon = onClickBackIcon, + ) + Spacer(modifier = Modifier.height(height = 24.dp)) + Column( + modifier = modifier + .fillMaxSize() + .padding(horizontal = 20.dp), + ) { + DoraTextField( + text = "", + hintText = stringResource(id = R.string.storage_create_folder_hint), + labelText = stringResource(id = R.string.storage_create_folder_label), + helperText = stringResource(id = R.string.storage_create_folder_helper), + helperEnabled = true, + counterEnabled = true, + onValueChanged = {}, + ) + Spacer(modifier = Modifier.height(20.dp)) + DoraButtons.DoraBtnMaxFull( + modifier = Modifier + .fillMaxWidth() + .padding(vertical = 20.dp), + buttonText = stringResource(id = R.string.storage_create_folder_save), + enabled = true, + onClickButton = onClickSaveButton, + ) + Spacer(modifier = Modifier.height(20.dp)) + } + } +} diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/FolderManageNavigation.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/FolderManageNavigation.kt new file mode 100644 index 00000000..7c48be5e --- /dev/null +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/FolderManageNavigation.kt @@ -0,0 +1,22 @@ +package com.mashup.dorabangs.feature.navigation + +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavOptions +import androidx.navigation.compose.composable +import com.mashup.core.navigation.NavigationRoute +import com.mashup.dorabangs.feature.folders.StorageFolderManageRoute + +fun NavController.navigateToStorageFolderManage(navOptions: NavOptions? = null) = navigate(NavigationRoute.StorageScreen.StorageFolderManageScreen.route, navOptions) + +fun NavGraphBuilder.storageFolderManageNavigation( + onClickBackIcon: () -> Unit = {}, +) { + composable( + route = NavigationRoute.StorageScreen.StorageFolderManageScreen.route, + ) { + StorageFolderManageRoute( + onClickBackIcon = onClickBackIcon, + ) + } +} diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/navigation/StorageDetailNavigation.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/StorageDetailNavigation.kt similarity index 92% rename from feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/navigation/StorageDetailNavigation.kt rename to feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/StorageDetailNavigation.kt index bccf8757..782c3e79 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/navigation/StorageDetailNavigation.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/StorageDetailNavigation.kt @@ -1,4 +1,4 @@ -package com.mashup.dorabangs.feature.storage.navigation +package com.mashup.dorabangs.feature.navigation import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/StorageNavigation.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/StorageNavigation.kt new file mode 100644 index 00000000..439b561c --- /dev/null +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/StorageNavigation.kt @@ -0,0 +1,26 @@ +package com.mashup.dorabangs.feature.navigation + +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavOptions +import androidx.navigation.compose.composable +import com.mashup.core.navigation.NavigationRoute +import com.mashup.dorabangs.feature.storage.storage.StorageRoute +import com.mashup.dorabangs.feature.storage.storage.model.StorageFolderItem + +fun NavController.navigateToStorage(navOptions: NavOptions) = navigate(NavigationRoute.StorageScreen.route, navOptions) + +fun NavGraphBuilder.storageNavigation( + navigateToStorageDetail: (StorageFolderItem) -> Unit = {}, + navigateToCreateFolder: () -> Unit, + +) { + composable( + route = NavigationRoute.StorageScreen.route, + ) { + StorageRoute( + navigateToStorageDetail = navigateToStorageDetail, + navigateToCreateFolder = navigateToCreateFolder, + ) + } +} diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt index 41841e62..b4a6d54c 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt @@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -27,10 +28,12 @@ import com.mashup.dorabangs.feature.storage.storage.model.StorageFolderItem fun StorageRoute( storageViewModel: StorageViewModel = hiltViewModel(), navigateToStorageDetail: (StorageFolderItem) -> Unit = {}, + navigateToCreateFolder: () -> Unit = {}, ) { StorageScreen( navigateToStorageDetail = navigateToStorageDetail, onClickAddMoreButton = storageViewModel::showEditFolderBottomSheet, + onClickAddFolderIcon = navigateToCreateFolder, ) } @@ -38,13 +41,16 @@ fun StorageRoute( fun StorageScreen( navigateToStorageDetail: (StorageFolderItem) -> Unit = {}, onClickAddMoreButton: (StorageFolderItem) -> Unit = {}, + onClickAddFolderIcon: () -> Unit = {}, ) { Column( modifier = Modifier .fillMaxSize() .background(color = DoraColorTokens.G1), ) { - StorageTopAppBar() + StorageTopAppBar( + onClickAddFolderIcon = onClickAddFolderIcon, + ) StorageFolderList( navigateToStorageDetail = navigateToStorageDetail, onClickAddMoreButton = onClickAddMoreButton, @@ -53,7 +59,10 @@ fun StorageScreen( } @Composable -fun StorageTopAppBar(modifier: Modifier = Modifier) { +fun StorageTopAppBar( + onClickAddFolderIcon: () -> Unit = {}, + modifier: Modifier = Modifier, +) { Row( modifier = modifier @@ -67,10 +76,14 @@ fun StorageTopAppBar(modifier: Modifier = Modifier) { text = stringResource(id = R.string.storage), style = DoraTypoTokens.base1Bold, ) - Icon( - painter = painterResource(id = com.google.android.material.R.drawable.ic_call_answer), - contentDescription = "folderIcon", - ) + IconButton( + onClick = { onClickAddFolderIcon() }, + ) { + Icon( + painter = painterResource(id = com.google.android.material.R.drawable.ic_call_answer), + contentDescription = "folderIcon", + ) + } } } diff --git a/feature/storage/src/main/res/values/string.xml b/feature/storage/src/main/res/values/string.xml index ee9f18ea..9130bdfd 100644 --- a/feature/storage/src/main/res/values/string.xml +++ b/feature/storage/src/main/res/values/string.xml @@ -8,4 +8,9 @@ 전체 읽지 않은 보관함 + + 폴더명을 입력해주세요. + 폴더명 + 같은 이름의 폴더 있어요 + 저장 \ No newline at end of file From f7d407a0acae6dda4e2dd62b5405f615dfe5da03 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sun, 7 Jul 2024 17:14:30 +0900 Subject: [PATCH 05/22] =?UTF-8?q?[feat]=20=EB=B3=B4=EA=B4=80=ED=95=A8=20?= =?UTF-8?q?=ED=8F=B4=EB=8D=94=20=EC=83=9D=EC=84=B1=20=EB=84=A4=EB=B9=84?= =?UTF-8?q?=EA=B2=8C=EC=9D=B4=EC=85=98=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dorabangs/navigation/DoraAppState.kt | 2 +- .../dorabangs/navigation/MainNavHost.kt | 14 +++++++---- .../mashup/core/navigation/NavigationRoute.kt | 1 + .../createfolder/HomeCreateFolderScreen.kt | 2 +- .../storage/navigation/StorageNavigation.kt | 24 ------------------- 5 files changed, 12 insertions(+), 31 deletions(-) delete mode 100644 feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/navigation/StorageNavigation.kt diff --git a/app/src/main/java/com/mashup/dorabangs/navigation/DoraAppState.kt b/app/src/main/java/com/mashup/dorabangs/navigation/DoraAppState.kt index abda4272..5079972a 100644 --- a/app/src/main/java/com/mashup/dorabangs/navigation/DoraAppState.kt +++ b/app/src/main/java/com/mashup/dorabangs/navigation/DoraAppState.kt @@ -12,7 +12,7 @@ import androidx.navigation.navOptions import com.mashup.core.navigation.NavigationRoute import com.mashup.dorabangs.core.designsystem.component.bottomnavigation.BottomNavigationDestination import com.mashup.dorabangs.feature.navigation.navigateToHome -import com.mashup.dorabangs.feature.storage.navigation.navigateToStorage +import com.mashup.dorabangs.feature.navigation.navigateToStorage @Composable fun rememberDoraAppState(navController: NavHostController = rememberNavController()): DoraAppState { 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 921fca51..20c67e5e 100644 --- a/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt +++ b/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt @@ -13,10 +13,12 @@ import com.mashup.dorabangs.feature.navigation.homeCreateFolderNavigation import com.mashup.dorabangs.feature.navigation.homeNavigation import com.mashup.dorabangs.feature.navigation.navigateToHome import com.mashup.dorabangs.feature.navigation.navigateToHomeCrateFolder +import com.mashup.dorabangs.feature.navigation.navigateToStorageDetail +import com.mashup.dorabangs.feature.navigation.navigateToStorageFolderManage import com.mashup.dorabangs.feature.navigation.onBoardingNavigation -import com.mashup.dorabangs.feature.storage.navigation.navigateToStorageDetail -import com.mashup.dorabangs.feature.storage.navigation.storageDetailNavigation -import com.mashup.dorabangs.feature.storage.navigation.storageNavigation +import com.mashup.dorabangs.feature.navigation.storageDetailNavigation +import com.mashup.dorabangs.feature.navigation.storageFolderManageNavigation +import com.mashup.dorabangs.feature.navigation.storageNavigation import com.mashup.feature.classification.navigation.classificationNavigation import com.mashup.feature.classification.navigation.navigateToClassification @@ -47,9 +49,11 @@ fun MainNavHost( ) storageNavigation( navigateToStorageDetail = { appState.navController.navigateToStorageDetail() }, - onClickAddFolderIcon = {}, + navigateToCreateFolder = { appState.navController.navigateToStorageFolderManage() }, + ) + storageFolderManageNavigation( + onClickBackIcon = { appState.navController.popBackStack() }, ) - storageDetailNavigation(appState.navController) classificationNavigation(appState.navController) saveLinkNavigation( 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 8e8c7a31..8c6a0d49 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 @@ -7,6 +7,7 @@ sealed class NavigationRoute(val route: String) { } object StorageScreen : NavigationRoute("storage") { object StorageDetailScreen : NavigationRoute("storage/detail") + object StorageFolderManageScreen : NavigationRoute("storage/foldermanage") } object ClassificationScreen : NavigationRoute("classification") object SaveLink : NavigationRoute("save/copiedUrl") { diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/createfolder/HomeCreateFolderScreen.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/createfolder/HomeCreateFolderScreen.kt index 6a19a03e..0ba8f2c4 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/createfolder/HomeCreateFolderScreen.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/createfolder/HomeCreateFolderScreen.kt @@ -57,7 +57,7 @@ fun HomeCreateFolderScreen( helperText = stringResource(id = R.string.home_create_folder_helper), helperEnabled = true, counterEnabled = true, - onValueChanged = {} + onValueChanged = {}, ) Spacer(modifier = Modifier.height(20.dp)) DoraButtons.DoraBtnMaxFull( diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/navigation/StorageNavigation.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/navigation/StorageNavigation.kt deleted file mode 100644 index 5491ea4c..00000000 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/navigation/StorageNavigation.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.mashup.dorabangs.feature.storage.navigation - -import androidx.navigation.NavController -import androidx.navigation.NavGraphBuilder -import androidx.navigation.NavOptions -import androidx.navigation.compose.composable -import com.mashup.core.navigation.NavigationRoute -import com.mashup.dorabangs.feature.storage.storage.StorageRoute -import com.mashup.dorabangs.feature.storage.storage.model.StorageFolderItem - -fun NavController.navigateToStorage(navOptions: NavOptions) = navigate(NavigationRoute.StorageScreen.route, navOptions) - -fun NavGraphBuilder.storageNavigation( - navigateToStorageDetail: (StorageFolderItem) -> Unit = {}, - onClickAddFolderIcon: () -> Unit, -) { - composable( - route = NavigationRoute.StorageScreen.route, - ) { - StorageRoute( - navigateToStorageDetail = navigateToStorageDetail - ) - } -} From 4f4141e5f69ed4daa61dddb7dcaf2009a0cf733d Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sun, 7 Jul 2024 18:12:42 +0900 Subject: [PATCH 06/22] =?UTF-8?q?[feat]=20=ED=95=84=EC=9A=94=ED=95=9C=20st?= =?UTF-8?q?ring=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- feature/storage/src/main/res/values/string.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/feature/storage/src/main/res/values/string.xml b/feature/storage/src/main/res/values/string.xml index 9130bdfd..3be98df2 100644 --- a/feature/storage/src/main/res/values/string.xml +++ b/feature/storage/src/main/res/values/string.xml @@ -13,4 +13,15 @@ 폴더명 같은 이름의 폴더 있어요 저장 + 새 폴더 추가 + 폴더 이름 변경 + + 폴더 삭제 + 폴더 이름 변경 + + 폴더 삭제 + 폴더를 삭제하면 모든 데이터가 영구적으로\n삭제되어 복구할 수 없어요.\n그래도 삭제하시겠어요? + 취소 + 삭제 + \ No newline at end of file From 5a5d6421ba1dd9484b9100f2f9e431d29189a5b0 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sun, 7 Jul 2024 18:13:06 +0900 Subject: [PATCH 07/22] =?UTF-8?q?[feat]=20=ED=8F=B4=EB=8D=94=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20=EB=AA=A8=EB=8D=B8=20=EB=B0=8F=20=ED=83=80=EC=9E=85?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/folders/FolderManageSideEffect.kt | 3 +++ .../feature/folders/model/FolderManageState.kt | 5 +++++ .../feature/folders/model/FolderManageType.kt | 10 ++++++++++ 3 files changed, 18 insertions(+) create mode 100644 feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/FolderManageSideEffect.kt create mode 100644 feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/model/FolderManageState.kt create mode 100644 feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/model/FolderManageType.kt diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/FolderManageSideEffect.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/FolderManageSideEffect.kt new file mode 100644 index 00000000..2db0b118 --- /dev/null +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/FolderManageSideEffect.kt @@ -0,0 +1,3 @@ +package com.mashup.dorabangs.feature.folders + +sealed class FolderManageSideEffect {} \ No newline at end of file diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/model/FolderManageState.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/model/FolderManageState.kt new file mode 100644 index 00000000..2f6858df --- /dev/null +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/model/FolderManageState.kt @@ -0,0 +1,5 @@ +package com.mashup.dorabangs.feature.folders.model + +data class FolderManageState( + val type: FolderManageType = FolderManageType.CREATE +) diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/model/FolderManageType.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/model/FolderManageType.kt new file mode 100644 index 00000000..67303061 --- /dev/null +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/model/FolderManageType.kt @@ -0,0 +1,10 @@ +package com.mashup.dorabangs.feature.folders.model + +import androidx.annotation.DrawableRes +import androidx.annotation.StringRes +import com.mashup.dorabangs.feature.storage.R + +enum class FolderManageType(@StringRes val title: Int) { + CREATE(R.string.storage_create_folder_title), + CHANGE(R.string.storage_edit_folder_title) +} \ No newline at end of file From 47f73206771acb46598265be42731c2a2bfe3437 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sun, 7 Jul 2024 18:13:47 +0900 Subject: [PATCH 08/22] =?UTF-8?q?[feat]=20=EB=B3=B4=EA=B4=80=ED=95=A8=20di?= =?UTF-8?q?laog,=20bottomsheet=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dorabangs/feature/home/HomeScreen.kt | 2 + .../folders/StorageFolderManageScreen.kt | 17 +++++- .../storage/storage/StorageFolderListItem.kt | 8 +-- .../feature/storage/storage/StorageScreen.kt | 53 +++++++++++++++---- .../storage/storage/StorageViewModel.kt | 13 ++++- .../storage/model/StorageListSideEffect.kt | 4 +- .../storage/storage/model/StorageListState.kt | 2 + 7 files changed, 80 insertions(+), 19 deletions(-) diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt index 4aa97f80..c8704708 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt @@ -116,6 +116,8 @@ fun HomeRoute( DoraBottomSheet.MoreButtonBottomSheet( modifier = Modifier.height(320.dp), isShowSheet = state.isShowMoreButtonSheet, + firstItemName = R.string.more_button_bottom_sheet_remove_link, + secondItemName = R.string.more_button_bottom_sheet_moving_folder, onClickDeleteLinkButton = { viewModel.setVisibleMoreButtonBottomSheet(false) viewModel.setVisibleDialog(true) diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/StorageFolderManageScreen.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/StorageFolderManageScreen.kt index 692238a9..1eb8b5f7 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/StorageFolderManageScreen.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/StorageFolderManageScreen.kt @@ -8,20 +8,34 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel import com.mashup.dorabangs.core.designsystem.component.buttons.DoraButtons import com.mashup.dorabangs.core.designsystem.component.textfield.DoraTextField import com.mashup.dorabangs.core.designsystem.component.topbar.DoraTopBar import com.mashup.dorabangs.core.designsystem.theme.LinkSaveColorTokens +import com.mashup.dorabangs.feature.folders.model.FolderManageState import com.mashup.dorabangs.feature.storage.R +import org.orbitmvi.orbit.compose.collectAsState @Composable fun StorageFolderManageRoute( + folderManageType: String, onClickBackIcon: () -> Unit, + folderManageViewModel: FolderManageViewModel = hiltViewModel() ) { + val folderManageState by folderManageViewModel.collectAsState() + + LaunchedEffect(key1 = Unit) { + folderManageViewModel.setFolderManageType(folderManageType) + } + FolderManageScreen( + folderManageState = folderManageState, onClickBackIcon = onClickBackIcon, onClickSaveButton = { }, ) @@ -29,6 +43,7 @@ fun StorageFolderManageRoute( @Composable fun FolderManageScreen( + folderManageState: FolderManageState, onClickBackIcon: () -> Unit, onClickSaveButton: () -> Unit, modifier: Modifier = Modifier, @@ -40,7 +55,7 @@ fun FolderManageScreen( ) { DoraTopBar.BackNavigationTopBar( modifier = Modifier, - title = "새 폴더 추가", + title = stringResource(id = folderManageState.type.title), isTitleCenter = true, onClickBackIcon = onClickBackIcon, ) diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt index edc7c268..2a431821 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt @@ -32,7 +32,7 @@ import com.mashup.dorabangs.feature.storage.storage.model.StorageListState fun StorageFolderList( customList: List = StorageListState.customFolderList(), navigateToStorageDetail: (StorageFolderItem) -> Unit = {}, - onClickAddMoreButton: (StorageFolderItem) -> Unit = {}, + onClickSettingButton: (StorageFolderItem) -> Unit = {}, ) { LazyColumn( modifier = Modifier.padding(horizontal = 20.dp), @@ -48,7 +48,7 @@ fun StorageFolderList( isFirstItem = idx == 0, isLastItem = idx == customList.lastIndex, navigateToStorageDetail = { navigateToStorageDetail(item) }, - onClickAddMoreButton = { onClickAddMoreButton(item) }, + onClickSettingButton = { onClickSettingButton(item) }, ) if (idx != customList.lastIndex) { HorizontalDivider( @@ -99,7 +99,7 @@ fun StorageListItem( isFirstItem: Boolean = false, isLastItem: Boolean = false, navigateToStorageDetail: () -> Unit = {}, - onClickAddMoreButton: () -> Unit = {}, + onClickSettingButton: () -> Unit = {}, ) { val shape = if (isFirstItem) { @@ -152,7 +152,7 @@ fun StorageListItem( androidx.core.R.drawable.ic_call_answer } Icon( - modifier = Modifier.clickable { if (isDefault) navigateToStorageDetail() else onClickAddMoreButton() }, + modifier = Modifier.clickable { if (isDefault) navigateToStorageDetail() else onClickSettingButton() }, painter = painterResource(id = icon), contentDescription = "folderIcon", ) diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt index b4a6d54c..3ccbb0b6 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt @@ -2,6 +2,7 @@ package com.mashup.dorabangs.feature.storage.storage import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize @@ -12,6 +13,7 @@ import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource @@ -19,28 +21,61 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel +import com.mashup.dorabangs.core.designsystem.component.bottomsheet.DoraBottomSheet +import com.mashup.dorabangs.core.designsystem.component.dialog.DoraDialog import com.mashup.dorabangs.core.designsystem.theme.DoraColorTokens import com.mashup.dorabangs.core.designsystem.theme.DoraTypoTokens +import com.mashup.dorabangs.feature.folders.model.FolderManageType import com.mashup.dorabangs.feature.storage.R import com.mashup.dorabangs.feature.storage.storage.model.StorageFolderItem +import org.orbitmvi.orbit.compose.collectAsState @Composable fun StorageRoute( storageViewModel: StorageViewModel = hiltViewModel(), navigateToStorageDetail: (StorageFolderItem) -> Unit = {}, - navigateToCreateFolder: () -> Unit = {}, + navigateToFolderManage: (FolderManageType) -> Unit = {} ) { - StorageScreen( - navigateToStorageDetail = navigateToStorageDetail, - onClickAddMoreButton = storageViewModel::showEditFolderBottomSheet, - onClickAddFolderIcon = navigateToCreateFolder, - ) + val storageState by storageViewModel.collectAsState() + Box { + StorageScreen( + navigateToStorageDetail = navigateToStorageDetail, + onClickSettingButton = { storageViewModel.setVisibleMoreButtonBottomSheet(visible = true) }, + onClickAddFolderIcon = { navigateToFolderManage(FolderManageType.CREATE) }, + ) + DoraBottomSheet.MoreButtonBottomSheet( + modifier = Modifier.height(320.dp), + isShowSheet = storageState.isShowMoreButtonSheet, + firstItemName = R.string.storage_more_bottom_sheet_folder_remove , + secondItemName = R.string.storage_more_bottom_sheet_folder_name_change, + onClickDeleteLinkButton = { + storageViewModel.setVisibleMoreButtonBottomSheet(false) + storageViewModel.setVisibleDialog(true) + }, + onClickMoveFolderButton = { + storageViewModel.setVisibleMoreButtonBottomSheet(false) + navigateToFolderManage(FolderManageType.CHANGE) + + }, + onDismissRequest = { storageViewModel.setVisibleMoreButtonBottomSheet(false) }, + ) + + DoraDialog( + isShowDialog = storageState.isShowDialog, + title = stringResource(R.string.dialog_folder_remove_title), + content = stringResource(R.string.dialog_folder_remove_content), + confirmBtnText = stringResource(R.string.dialog_folder_remove_button_remove), + disMissBtnText = stringResource(R.string.dialog_folder_remove_button_cancel), + onDisMissRequest = { storageViewModel.setVisibleDialog(false) }, + onClickConfirmBtn = { storageViewModel.setVisibleDialog(false) }, + ) + } } @Composable fun StorageScreen( navigateToStorageDetail: (StorageFolderItem) -> Unit = {}, - onClickAddMoreButton: (StorageFolderItem) -> Unit = {}, + onClickSettingButton: (StorageFolderItem) -> Unit = {}, onClickAddFolderIcon: () -> Unit = {}, ) { Column( @@ -53,15 +88,15 @@ fun StorageScreen( ) StorageFolderList( navigateToStorageDetail = navigateToStorageDetail, - onClickAddMoreButton = onClickAddMoreButton, + onClickSettingButton = onClickSettingButton, ) } } @Composable fun StorageTopAppBar( - onClickAddFolderIcon: () -> Unit = {}, modifier: Modifier = Modifier, + onClickAddFolderIcon: () -> Unit = {}, ) { Row( modifier = diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageViewModel.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageViewModel.kt index f1721005..8bc2677d 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageViewModel.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageViewModel.kt @@ -8,6 +8,7 @@ import dagger.hilt.android.lifecycle.HiltViewModel import org.orbitmvi.orbit.ContainerHost import org.orbitmvi.orbit.syntax.simple.intent import org.orbitmvi.orbit.syntax.simple.postSideEffect +import org.orbitmvi.orbit.syntax.simple.reduce import org.orbitmvi.orbit.viewmodel.container import javax.inject.Inject @@ -15,7 +16,15 @@ import javax.inject.Inject class StorageViewModel @Inject constructor() : ViewModel(), ContainerHost { override val container = container(StorageListState()) - fun showEditFolderBottomSheet(item: StorageFolderItem) = intent { - postSideEffect(sideEffect = StorageListSideEffect.ShowEditFolderBottomSheet) + fun setVisibleMoreButtonBottomSheet(visible: Boolean) = intent { + reduce { + state.copy(isShowMoreButtonSheet = visible) + } + } + + fun setVisibleDialog(visible: Boolean) = intent { + reduce { + state.copy(isShowDialog = visible) + } } } diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListSideEffect.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListSideEffect.kt index 07ee8a6c..602e51f5 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListSideEffect.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListSideEffect.kt @@ -1,5 +1,3 @@ package com.mashup.dorabangs.feature.storage.storage.model -sealed class StorageListSideEffect { - object ShowEditFolderBottomSheet : StorageListSideEffect() -} +sealed class StorageListSideEffect {} diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListState.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListState.kt index 5b1da38b..b8396e5f 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListState.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListState.kt @@ -3,6 +3,8 @@ package com.mashup.dorabangs.feature.storage.storage.model data class StorageListState( val defaultStorageFolderList: List = listOf(), val customStorageFolderList: List = listOf(), + val isShowMoreButtonSheet: Boolean = false, + val isShowDialog: Boolean = false, ) { companion object { fun defaultFolderList() = From b0e0a0e07b944aa97d053cd245eeaa58403f6b56 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sun, 7 Jul 2024 18:14:03 +0900 Subject: [PATCH 09/22] =?UTF-8?q?[feat]=20=EB=B3=B4=EA=B4=80=ED=95=A8=20di?= =?UTF-8?q?laog,=20bottomsheet=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designsystem/component/bottomsheet/BottomSheetType.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/bottomsheet/BottomSheetType.kt b/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/bottomsheet/BottomSheetType.kt index 07e36e85..d930b8bd 100644 --- a/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/bottomsheet/BottomSheetType.kt +++ b/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/bottomsheet/BottomSheetType.kt @@ -21,6 +21,8 @@ object DoraBottomSheet : BottomSheetType { override fun MoreButtonBottomSheet( modifier: Modifier, isShowSheet: Boolean, + firstItemName: Int, + secondItemName: Int, onClickDeleteLinkButton: () -> Unit, onClickMoveFolderButton: () -> Unit, onDismissRequest: () -> Unit, @@ -39,12 +41,12 @@ object DoraBottomSheet : BottomSheetType { items = listOf( BottomSheetItemUIModel( icon = R.drawable.ic_plus, - itemName = stringResource(id = R.string.more_button_bottom_sheet_remove_link), + itemName = stringResource(id = firstItemName), color = DoraColorTokens.Alert, ), BottomSheetItemUIModel( icon = R.drawable.ic_plus, - itemName = stringResource(id = R.string.more_button_bottom_sheet_moving_folder), + itemName = stringResource(id = secondItemName), ), ), onClickItem = { index -> @@ -129,6 +131,8 @@ sealed interface BottomSheetType { fun MoreButtonBottomSheet( modifier: Modifier, isShowSheet: Boolean, + firstItemName: Int, + secondItemName: Int, onClickDeleteLink: () -> Unit, onClickMoveFolder: () -> Unit, onDismissRequest: () -> Unit, From b39c6f834d0569778032f8b90316ebe8647efa89 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sun, 7 Jul 2024 18:14:17 +0900 Subject: [PATCH 10/22] =?UTF-8?q?[feat]=20=EB=B3=B4=EA=B4=80=ED=95=A8?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=ED=8F=B4=EB=8D=94=EA=B4=80=EB=A6=AC=20nav?= =?UTF-8?q?igation=20=EC=84=B8=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dorabangs/navigation/MainNavHost.kt | 2 +- .../mashup/core/navigation/NavigationRoute.kt | 4 +-- .../feature/folders/FolderManageViewModel.kt | 26 +++++++++++++++++++ .../navigation/FolderManageNavigation.kt | 20 +++++++++++--- .../feature/navigation/StorageNavigation.kt | 5 ++-- 5 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/FolderManageViewModel.kt 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 20c67e5e..83444019 100644 --- a/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt +++ b/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt @@ -49,7 +49,7 @@ fun MainNavHost( ) storageNavigation( navigateToStorageDetail = { appState.navController.navigateToStorageDetail() }, - navigateToCreateFolder = { appState.navController.navigateToStorageFolderManage() }, + navigateToFolderManage = { folderManageType -> appState.navController.navigateToStorageFolderManage(folderManageType = folderManageType) }, ) storageFolderManageNavigation( onClickBackIcon = { appState.navController.popBackStack() }, 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 8c6a0d49..7f8b5cc6 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 @@ -3,11 +3,11 @@ package com.mashup.core.navigation sealed class NavigationRoute(val route: String) { object OnBoardingScreen : NavigationRoute("onboarding") object HomeScreen : NavigationRoute("home") { - object HomeCreateFolder : NavigationRoute("home/createfolder") + object HomeCreateFolder : NavigationRoute("home/createFolder") } object StorageScreen : NavigationRoute("storage") { object StorageDetailScreen : NavigationRoute("storage/detail") - object StorageFolderManageScreen : NavigationRoute("storage/foldermanage") + object StorageFolderManageScreen : NavigationRoute("storage/folderManage") } object ClassificationScreen : NavigationRoute("classification") object SaveLink : NavigationRoute("save/copiedUrl") { diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/FolderManageViewModel.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/FolderManageViewModel.kt new file mode 100644 index 00000000..e0a5af09 --- /dev/null +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/FolderManageViewModel.kt @@ -0,0 +1,26 @@ +package com.mashup.dorabangs.feature.folders + +import androidx.lifecycle.ViewModel +import com.mashup.dorabangs.feature.folders.model.FolderManageState +import com.mashup.dorabangs.feature.folders.model.FolderManageType +import org.orbitmvi.orbit.ContainerHost +import org.orbitmvi.orbit.syntax.simple.intent +import org.orbitmvi.orbit.syntax.simple.reduce +import org.orbitmvi.orbit.viewmodel.container +import javax.inject.Inject + +class FolderManageViewModel @Inject constructor() : ViewModel(), + ContainerHost { + override val container = container(FolderManageState()) + + fun setFolderManageType(name: String) = intent { + reduce { + when(name) { + FolderManageType.CREATE.name -> state.copy(type = FolderManageType.CREATE) + FolderManageType.CHANGE.name -> state.copy(type = FolderManageType.CHANGE) + else -> state.copy(type = FolderManageType.CREATE) + } + } + } + +} diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/FolderManageNavigation.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/FolderManageNavigation.kt index 7c48be5e..4648afcc 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/FolderManageNavigation.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/FolderManageNavigation.kt @@ -1,21 +1,35 @@ package com.mashup.dorabangs.feature.navigation +import android.icu.text.CaseMap.Fold import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavOptions +import androidx.navigation.NavType import androidx.navigation.compose.composable +import androidx.navigation.navArgument import com.mashup.core.navigation.NavigationRoute import com.mashup.dorabangs.feature.folders.StorageFolderManageRoute +import com.mashup.dorabangs.feature.folders.model.FolderManageType -fun NavController.navigateToStorageFolderManage(navOptions: NavOptions? = null) = navigate(NavigationRoute.StorageScreen.StorageFolderManageScreen.route, navOptions) +fun NavController.navigateToStorageFolderManage( + folderManageType: FolderManageType, + navOptions: NavOptions? = null) = navigate("${NavigationRoute.StorageScreen.StorageFolderManageScreen.route}/${folderManageType.name}", navOptions) fun NavGraphBuilder.storageFolderManageNavigation( onClickBackIcon: () -> Unit = {}, ) { composable( - route = NavigationRoute.StorageScreen.StorageFolderManageScreen.route, - ) { + route = "${NavigationRoute.StorageScreen.StorageFolderManageScreen.route}/{folderManageType}", + arguments = listOf( + navArgument("folderManageType") { + type = NavType.StringType + defaultValue = FolderManageType.CHANGE.name + } + ) + ) { navBackStackEntry -> + val folderManageType = navBackStackEntry.arguments?.getString("folderManageType") ?: FolderManageType.CHANGE.name StorageFolderManageRoute( + folderManageType = folderManageType, onClickBackIcon = onClickBackIcon, ) } diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/StorageNavigation.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/StorageNavigation.kt index 439b561c..aa079c42 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/StorageNavigation.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/StorageNavigation.kt @@ -5,6 +5,7 @@ import androidx.navigation.NavGraphBuilder import androidx.navigation.NavOptions import androidx.navigation.compose.composable import com.mashup.core.navigation.NavigationRoute +import com.mashup.dorabangs.feature.folders.model.FolderManageType import com.mashup.dorabangs.feature.storage.storage.StorageRoute import com.mashup.dorabangs.feature.storage.storage.model.StorageFolderItem @@ -12,7 +13,7 @@ fun NavController.navigateToStorage(navOptions: NavOptions) = navigate(Navigatio fun NavGraphBuilder.storageNavigation( navigateToStorageDetail: (StorageFolderItem) -> Unit = {}, - navigateToCreateFolder: () -> Unit, + navigateToFolderManage: (FolderManageType) -> Unit, ) { composable( @@ -20,7 +21,7 @@ fun NavGraphBuilder.storageNavigation( ) { StorageRoute( navigateToStorageDetail = navigateToStorageDetail, - navigateToCreateFolder = navigateToCreateFolder, + navigateToFolderManage = navigateToFolderManage, ) } } From 637e0e6c99c7369f924936992b30ea69ed4b085b Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sun, 7 Jul 2024 18:22:18 +0900 Subject: [PATCH 11/22] =?UTF-8?q?[fix]=20spotless=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/mashup/dorabangs/navigation/MainNavHost.kt | 2 +- .../dorabangs/feature/folders/FolderManageSideEffect.kt | 2 +- .../dorabangs/feature/folders/FolderManageViewModel.kt | 6 +++--- .../feature/folders/StorageFolderManageScreen.kt | 2 +- .../dorabangs/feature/folders/model/FolderManageState.kt | 2 +- .../dorabangs/feature/folders/model/FolderManageType.kt | 5 ++--- .../feature/navigation/FolderManageNavigation.kt | 8 ++++---- .../dorabangs/feature/navigation/StorageNavigation.kt | 2 +- .../dorabangs/feature/storage/storage/StorageScreen.kt | 5 ++--- .../dorabangs/feature/storage/storage/StorageViewModel.kt | 2 -- .../storage/storage/model/StorageListSideEffect.kt | 2 +- 11 files changed, 17 insertions(+), 21 deletions(-) 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 83444019..6cd9fc12 100644 --- a/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt +++ b/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt @@ -49,7 +49,7 @@ fun MainNavHost( ) storageNavigation( navigateToStorageDetail = { appState.navController.navigateToStorageDetail() }, - navigateToFolderManage = { folderManageType -> appState.navController.navigateToStorageFolderManage(folderManageType = folderManageType) }, + navigateToFolderManage = { folderManageType -> appState.navController.navigateToStorageFolderManage(folderManageType = folderManageType) }, ) storageFolderManageNavigation( onClickBackIcon = { appState.navController.popBackStack() }, diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/FolderManageSideEffect.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/FolderManageSideEffect.kt index 2db0b118..4342bb45 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/FolderManageSideEffect.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/FolderManageSideEffect.kt @@ -1,3 +1,3 @@ package com.mashup.dorabangs.feature.folders -sealed class FolderManageSideEffect {} \ No newline at end of file +sealed class FolderManageSideEffect diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/FolderManageViewModel.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/FolderManageViewModel.kt index e0a5af09..1c3fa4c6 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/FolderManageViewModel.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/FolderManageViewModel.kt @@ -9,18 +9,18 @@ import org.orbitmvi.orbit.syntax.simple.reduce import org.orbitmvi.orbit.viewmodel.container import javax.inject.Inject -class FolderManageViewModel @Inject constructor() : ViewModel(), +class FolderManageViewModel @Inject constructor() : + ViewModel(), ContainerHost { override val container = container(FolderManageState()) fun setFolderManageType(name: String) = intent { reduce { - when(name) { + when (name) { FolderManageType.CREATE.name -> state.copy(type = FolderManageType.CREATE) FolderManageType.CHANGE.name -> state.copy(type = FolderManageType.CHANGE) else -> state.copy(type = FolderManageType.CREATE) } } } - } diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/StorageFolderManageScreen.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/StorageFolderManageScreen.kt index 1eb8b5f7..87eaa71d 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/StorageFolderManageScreen.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/StorageFolderManageScreen.kt @@ -26,7 +26,7 @@ import org.orbitmvi.orbit.compose.collectAsState fun StorageFolderManageRoute( folderManageType: String, onClickBackIcon: () -> Unit, - folderManageViewModel: FolderManageViewModel = hiltViewModel() + folderManageViewModel: FolderManageViewModel = hiltViewModel(), ) { val folderManageState by folderManageViewModel.collectAsState() diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/model/FolderManageState.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/model/FolderManageState.kt index 2f6858df..759755dc 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/model/FolderManageState.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/model/FolderManageState.kt @@ -1,5 +1,5 @@ package com.mashup.dorabangs.feature.folders.model data class FolderManageState( - val type: FolderManageType = FolderManageType.CREATE + val type: FolderManageType = FolderManageType.CREATE, ) diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/model/FolderManageType.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/model/FolderManageType.kt index 67303061..78691abd 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/model/FolderManageType.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/folders/model/FolderManageType.kt @@ -1,10 +1,9 @@ package com.mashup.dorabangs.feature.folders.model -import androidx.annotation.DrawableRes import androidx.annotation.StringRes import com.mashup.dorabangs.feature.storage.R enum class FolderManageType(@StringRes val title: Int) { CREATE(R.string.storage_create_folder_title), - CHANGE(R.string.storage_edit_folder_title) -} \ No newline at end of file + CHANGE(R.string.storage_edit_folder_title), +} diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/FolderManageNavigation.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/FolderManageNavigation.kt index 4648afcc..3b85bc13 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/FolderManageNavigation.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/FolderManageNavigation.kt @@ -1,6 +1,5 @@ package com.mashup.dorabangs.feature.navigation -import android.icu.text.CaseMap.Fold import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavOptions @@ -13,7 +12,8 @@ import com.mashup.dorabangs.feature.folders.model.FolderManageType fun NavController.navigateToStorageFolderManage( folderManageType: FolderManageType, - navOptions: NavOptions? = null) = navigate("${NavigationRoute.StorageScreen.StorageFolderManageScreen.route}/${folderManageType.name}", navOptions) + navOptions: NavOptions? = null, +) = navigate("${NavigationRoute.StorageScreen.StorageFolderManageScreen.route}/${folderManageType.name}", navOptions) fun NavGraphBuilder.storageFolderManageNavigation( onClickBackIcon: () -> Unit = {}, @@ -24,8 +24,8 @@ fun NavGraphBuilder.storageFolderManageNavigation( navArgument("folderManageType") { type = NavType.StringType defaultValue = FolderManageType.CHANGE.name - } - ) + }, + ), ) { navBackStackEntry -> val folderManageType = navBackStackEntry.arguments?.getString("folderManageType") ?: FolderManageType.CHANGE.name StorageFolderManageRoute( diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/StorageNavigation.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/StorageNavigation.kt index aa079c42..addc4a3d 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/StorageNavigation.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/StorageNavigation.kt @@ -21,7 +21,7 @@ fun NavGraphBuilder.storageNavigation( ) { StorageRoute( navigateToStorageDetail = navigateToStorageDetail, - navigateToFolderManage = navigateToFolderManage, + navigateToFolderManage = navigateToFolderManage, ) } } diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt index 3ccbb0b6..42dc9e24 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt @@ -34,7 +34,7 @@ import org.orbitmvi.orbit.compose.collectAsState fun StorageRoute( storageViewModel: StorageViewModel = hiltViewModel(), navigateToStorageDetail: (StorageFolderItem) -> Unit = {}, - navigateToFolderManage: (FolderManageType) -> Unit = {} + navigateToFolderManage: (FolderManageType) -> Unit = {}, ) { val storageState by storageViewModel.collectAsState() Box { @@ -46,7 +46,7 @@ fun StorageRoute( DoraBottomSheet.MoreButtonBottomSheet( modifier = Modifier.height(320.dp), isShowSheet = storageState.isShowMoreButtonSheet, - firstItemName = R.string.storage_more_bottom_sheet_folder_remove , + firstItemName = R.string.storage_more_bottom_sheet_folder_remove, secondItemName = R.string.storage_more_bottom_sheet_folder_name_change, onClickDeleteLinkButton = { storageViewModel.setVisibleMoreButtonBottomSheet(false) @@ -55,7 +55,6 @@ fun StorageRoute( onClickMoveFolderButton = { storageViewModel.setVisibleMoreButtonBottomSheet(false) navigateToFolderManage(FolderManageType.CHANGE) - }, onDismissRequest = { storageViewModel.setVisibleMoreButtonBottomSheet(false) }, ) diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageViewModel.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageViewModel.kt index 8bc2677d..ba0c2248 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageViewModel.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageViewModel.kt @@ -1,13 +1,11 @@ package com.mashup.dorabangs.feature.storage.storage import androidx.lifecycle.ViewModel -import com.mashup.dorabangs.feature.storage.storage.model.StorageFolderItem import com.mashup.dorabangs.feature.storage.storage.model.StorageListSideEffect import com.mashup.dorabangs.feature.storage.storage.model.StorageListState import dagger.hilt.android.lifecycle.HiltViewModel import org.orbitmvi.orbit.ContainerHost import org.orbitmvi.orbit.syntax.simple.intent -import org.orbitmvi.orbit.syntax.simple.postSideEffect import org.orbitmvi.orbit.syntax.simple.reduce import org.orbitmvi.orbit.viewmodel.container import javax.inject.Inject diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListSideEffect.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListSideEffect.kt index 602e51f5..273e1bf4 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListSideEffect.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListSideEffect.kt @@ -1,3 +1,3 @@ package com.mashup.dorabangs.feature.storage.storage.model -sealed class StorageListSideEffect {} +sealed class StorageListSideEffect From fd66fbc35042bec169b56243a7cb3eb92a04c5bd Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sun, 7 Jul 2024 22:15:06 +0900 Subject: [PATCH 12/22] =?UTF-8?q?[fix]=20=ED=99=88=20=ED=8F=B4=EB=8D=94?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EB=92=A4=EB=A1=9C=EA=B0=80=EA=B8=B0=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dorabangs/feature/navigation/HomeCreateFolderNavigation.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeCreateFolderNavigation.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeCreateFolderNavigation.kt index a4f91251..62d61833 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeCreateFolderNavigation.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeCreateFolderNavigation.kt @@ -17,7 +17,7 @@ fun NavGraphBuilder.homeCreateFolderNavigation( route = NavigationRoute.HomeScreen.HomeCreateFolder.route, ) { HomeCreateFolderRoute( - onClickBackIcon = {}, + onClickBackIcon = onClickBackIcon, ) } } From 2f80adfba218df19e8c30e9633e9737a0b75c2bc Mon Sep 17 00:00:00 2001 From: ddyeon Date: Mon, 8 Jul 2024 23:09:30 +0900 Subject: [PATCH 13/22] =?UTF-8?q?[fix]=20bottomsheet=20=EB=8B=AB=ED=9E=8C?= =?UTF-8?q?=20=ED=9B=84=20=EC=9D=B4=EB=8F=99=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/mashup/dorabangs/feature/home/HomeScreen.kt | 9 +++------ .../com/mashup/dorabangs/feature/home/HomeSideEffect.kt | 1 + .../com/mashup/dorabangs/feature/home/HomeViewModel.kt | 3 ++- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt index c8704708..58702f95 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt @@ -72,10 +72,10 @@ fun HomeRoute( ) } } - - HomeSideEffect.HideSnackBar -> { + is HomeSideEffect.HideSnackBar -> { snackBarHostState.currentSnackbarData?.dismiss() } + is HomeSideEffect.NavigateToCreateFolder -> navigateToCreateFolder() } } @@ -134,10 +134,7 @@ fun HomeRoute( isShowSheet = state.isShowMovingFolderSheet, folderList = testFolderListData, onDismissRequest = { viewModel.setVisibleMovingFolderBottomSheet(false) }, - onClickCreateFolder = { - viewModel.setVisibleMovingFolderBottomSheet(false) - navigateToCreateFolder() - }, + onClickCreateFolder = { viewModel.setVisibleMovingFolderBottomSheet(visible = false, isNavigate = true) }, onClickMoveFolder = {}, ) diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeSideEffect.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeSideEffect.kt index 6c50982f..51f75fd1 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeSideEffect.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeSideEffect.kt @@ -3,4 +3,5 @@ package com.mashup.dorabangs.feature.home sealed class HomeSideEffect { data class ShowSnackBar(val copiedText: String) : HomeSideEffect() object HideSnackBar : HomeSideEffect() + object NavigateToCreateFolder : HomeSideEffect() } diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt index 60364f1a..d6e8acae 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt @@ -71,10 +71,11 @@ class HomeViewModel @Inject constructor( } } - fun setVisibleMovingFolderBottomSheet(visible: Boolean) = intent { + fun setVisibleMovingFolderBottomSheet(visible: Boolean, isNavigate: Boolean = false) = intent { reduce { state.copy(isShowMovingFolderSheet = visible) } + if(isNavigate) postSideEffect(HomeSideEffect.NavigateToCreateFolder) } init { From 776d6b61e5dffb5cc8a42f0d2c50fe8b66298527 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Tue, 9 Jul 2024 00:07:37 +0900 Subject: [PATCH 14/22] =?UTF-8?q?[fix]=20=ED=8F=B4=EB=8D=94=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=ED=8E=98=EC=9D=B4=EC=A7=80=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=92=A4=EB=A1=9C=EA=B0=80=EA=B8=B0=20=EC=8B=9C=20=EB=B0=94?= =?UTF-8?q?=ED=85=80=20=EC=8B=9C=ED=8A=B8=20=EB=85=B8=EC=B6=9C=EB=90=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mashup/dorabangs/navigation/MainNavHost.kt | 8 +++++++- .../mashup/dorabangs/feature/home/HomeScreen.kt | 9 +++++++++ .../dorabangs/feature/home/HomeViewModel.kt | 2 +- .../feature/navigation/HomeNavigation.kt | 17 ++++++++++++++++- 4 files changed, 33 insertions(+), 3 deletions(-) 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 6cd9fc12..fd66d4be 100644 --- a/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt +++ b/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt @@ -45,7 +45,13 @@ fun MainNavHost( navigateToCreateFolder = { appState.navController.navigateToHomeCrateFolder() }, ) homeCreateFolderNavigation( - onClickBackIcon = { appState.navController.popBackStack() }, + onClickBackIcon = { + appState.navController.previousBackStackEntry?.savedStateHandle?.set( + key = "isVisibleMovingBottomSheet", + value = true, + ) + appState.navController.popBackStack() + }, ) storageNavigation( navigateToStorageDetail = { appState.navController.navigateToStorageDetail() }, diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt index 58702f95..20811a03 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt @@ -20,6 +20,7 @@ import androidx.compose.material3.SnackbarDuration import androidx.compose.material3.SnackbarHostState import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @@ -50,6 +51,7 @@ import org.orbitmvi.orbit.compose.collectSideEffect @Composable fun HomeRoute( + isVisibleBottomSheet: Boolean, modifier: Modifier = Modifier, view: View = LocalView.current, clipboardManager: ClipboardManager = LocalClipboardManager.current, @@ -62,6 +64,13 @@ fun HomeRoute( val snackBarHostState by remember { mutableStateOf(SnackbarHostState()) } val state by viewModel.collectAsState() val scope = rememberCoroutineScope() + + LaunchedEffect(key1 = Unit) { + if (isVisibleBottomSheet) { + viewModel.setVisibleMovingFolderBottomSheet(true) + } + } + viewModel.collectSideEffect { sideEffect -> when (sideEffect) { is HomeSideEffect.ShowSnackBar -> { diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt index d6e8acae..c9b1da3a 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt @@ -75,7 +75,7 @@ class HomeViewModel @Inject constructor( reduce { state.copy(isShowMovingFolderSheet = visible) } - if(isNavigate) postSideEffect(HomeSideEffect.NavigateToCreateFolder) + if (isNavigate) postSideEffect(HomeSideEffect.NavigateToCreateFolder) } init { 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 7c9ad3b0..ac56b076 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 @@ -1,9 +1,12 @@ package com.mashup.dorabangs.feature.navigation +import androidx.compose.runtime.collectAsState import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavOptions +import androidx.navigation.NavType import androidx.navigation.compose.composable +import androidx.navigation.navArgument import com.mashup.core.navigation.NavigationRoute import com.mashup.dorabangs.feature.home.HomeRoute @@ -18,8 +21,20 @@ fun NavGraphBuilder.homeNavigation( ) { composable( route = NavigationRoute.HomeScreen.route, - ) { + arguments = listOf( + navArgument(name = "isVisibleMovingBottomSheet") { + type = NavType.BoolType + defaultValue = false + }, + ), + ) { backStackEntry -> + + val isVisibleBottomSheet = backStackEntry.savedStateHandle.getStateFlow( + "isVisibleMovingBottomSheet", + initialValue = false, + ).collectAsState().value HomeRoute( + isVisibleBottomSheet = isVisibleBottomSheet, navigateToClassification = navigateToClassification, navigateToSaveScreenWithLink = navigateToSaveScreenWithLink, navigateToSaveScreenWithoutLink = navigateToSaveScreenWithoutLink, From b087a478b7f792d74c1bc3ad26bdc3f4b748b4ca Mon Sep 17 00:00:00 2001 From: ddyeon Date: Tue, 9 Jul 2024 22:07:09 +0900 Subject: [PATCH 15/22] =?UTF-8?q?[fix]=20bottomsheet=20annotation=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designsystem/component/bottomsheet/BottomSheetType.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/bottomsheet/BottomSheetType.kt b/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/bottomsheet/BottomSheetType.kt index d930b8bd..f18431ab 100644 --- a/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/bottomsheet/BottomSheetType.kt +++ b/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/bottomsheet/BottomSheetType.kt @@ -1,5 +1,6 @@ package com.mashup.dorabangs.core.designsystem.component.bottomsheet +import androidx.annotation.StringRes import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn @@ -131,8 +132,8 @@ sealed interface BottomSheetType { fun MoreButtonBottomSheet( modifier: Modifier, isShowSheet: Boolean, - firstItemName: Int, - secondItemName: Int, + @StringRes firstItemName: Int, + @StringRes secondItemName: Int, onClickDeleteLink: () -> Unit, onClickMoveFolder: () -> Unit, onDismissRequest: () -> Unit, From c749480ca86a311fc697f186caa71e7ec3f6cc79 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Tue, 9 Jul 2024 22:08:38 +0900 Subject: [PATCH 16/22] =?UTF-8?q?[fix]=20defaultvalue=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/navigation/StorageNavigation.kt | 2 +- .../feature/storage/storage/StorageScreen.kt | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/StorageNavigation.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/StorageNavigation.kt index addc4a3d..0c962e32 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/StorageNavigation.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/navigation/StorageNavigation.kt @@ -12,7 +12,7 @@ import com.mashup.dorabangs.feature.storage.storage.model.StorageFolderItem fun NavController.navigateToStorage(navOptions: NavOptions) = navigate(NavigationRoute.StorageScreen.route, navOptions) fun NavGraphBuilder.storageNavigation( - navigateToStorageDetail: (StorageFolderItem) -> Unit = {}, + navigateToStorageDetail: (StorageFolderItem) -> Unit, navigateToFolderManage: (FolderManageType) -> Unit, ) { diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt index 42dc9e24..b3356a53 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt @@ -33,8 +33,8 @@ import org.orbitmvi.orbit.compose.collectAsState @Composable fun StorageRoute( storageViewModel: StorageViewModel = hiltViewModel(), - navigateToStorageDetail: (StorageFolderItem) -> Unit = {}, - navigateToFolderManage: (FolderManageType) -> Unit = {}, + navigateToStorageDetail: (StorageFolderItem) -> Unit, + navigateToFolderManage: (FolderManageType) -> Unit, ) { val storageState by storageViewModel.collectAsState() Box { @@ -73,8 +73,8 @@ fun StorageRoute( @Composable fun StorageScreen( - navigateToStorageDetail: (StorageFolderItem) -> Unit = {}, - onClickSettingButton: (StorageFolderItem) -> Unit = {}, + navigateToStorageDetail: (StorageFolderItem) -> Unit, + onClickSettingButton: (StorageFolderItem) -> Unit, onClickAddFolderIcon: () -> Unit = {}, ) { Column( @@ -124,5 +124,8 @@ fun StorageTopAppBar( @Preview @Composable fun PreviewStorageScreen() { - StorageRoute() + StorageRoute( + navigateToStorageDetail = {}, + navigateToFolderManage = {} + ) } From 2e35cb8dbc4d818300c7f1b38d18440f0cea0826 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Tue, 9 Jul 2024 22:49:29 +0900 Subject: [PATCH 17/22] =?UTF-8?q?[fix]=20savestatehandler=EB=A1=9C=20?= =?UTF-8?q?=EA=B0=92=20=EB=B0=9B=EA=B8=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mashup/dorabangs/feature/home/HomeScreen.kt | 5 +---- .../com/mashup/dorabangs/feature/home/HomeViewModel.kt | 9 +++++++++ .../dorabangs/feature/navigation/HomeNavigation.kt | 10 ++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt index 20811a03..23dd0f67 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt @@ -51,7 +51,6 @@ import org.orbitmvi.orbit.compose.collectSideEffect @Composable fun HomeRoute( - isVisibleBottomSheet: Boolean, modifier: Modifier = Modifier, view: View = LocalView.current, clipboardManager: ClipboardManager = LocalClipboardManager.current, @@ -66,9 +65,7 @@ fun HomeRoute( val scope = rememberCoroutineScope() LaunchedEffect(key1 = Unit) { - if (isVisibleBottomSheet) { - viewModel.setVisibleMovingFolderBottomSheet(true) - } + viewModel.getIsVisibleMoreBottomSheet() } viewModel.collectSideEffect { sideEffect -> diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt index c9b1da3a..e80ddb21 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt @@ -1,5 +1,6 @@ package com.mashup.dorabangs.feature.home +import android.util.Log import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope @@ -17,6 +18,7 @@ import org.orbitmvi.orbit.syntax.simple.postSideEffect import org.orbitmvi.orbit.syntax.simple.reduce import org.orbitmvi.orbit.viewmodel.container import javax.inject.Inject +import kotlin.math.log @HiltViewModel class HomeViewModel @Inject constructor( @@ -26,6 +28,13 @@ class HomeViewModel @Inject constructor( ) : ViewModel(), ContainerHost { override val container = container(HomeState()) + fun getIsVisibleMoreBottomSheet() { + savedStateHandle.get("isVisibleMovingBottomSheet")?.let { isVisible -> + Log.d("HomeViewModel", ": ${isVisible} ") + setVisibleMovingFolderBottomSheet(isVisible) + } + } + fun changeSelectedTapIdx(index: Int) = intent { reduce { state.copy(selectedIndex = index) 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 ac56b076..e3c0dc73 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 @@ -14,7 +14,7 @@ fun NavController.navigateToHome(navOptions: NavOptions? = null) = navigate(NavigationRoute.HomeScreen.route, navOptions) fun NavGraphBuilder.homeNavigation( - navigateToClassification: () -> Unit = {}, + navigateToClassification: () -> Unit, navigateToSaveScreenWithLink: (String) -> Unit, navigateToSaveScreenWithoutLink: () -> Unit, navigateToCreateFolder: () -> Unit, @@ -27,14 +27,8 @@ fun NavGraphBuilder.homeNavigation( defaultValue = false }, ), - ) { backStackEntry -> - - val isVisibleBottomSheet = backStackEntry.savedStateHandle.getStateFlow( - "isVisibleMovingBottomSheet", - initialValue = false, - ).collectAsState().value + ) { HomeRoute( - isVisibleBottomSheet = isVisibleBottomSheet, navigateToClassification = navigateToClassification, navigateToSaveScreenWithLink = navigateToSaveScreenWithLink, navigateToSaveScreenWithoutLink = navigateToSaveScreenWithoutLink, From af5835aa3111e3e79371d827c52cb65765ec5343 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Thu, 11 Jul 2024 00:33:59 +0900 Subject: [PATCH 18/22] =?UTF-8?q?[fix]=20savestatehandle=20=EC=B0=BE?= =?UTF-8?q?=EB=8A=94=EC=A4=91,,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mashup/dorabangs/navigation/MainNavHost.kt | 18 ++++++++++++++++++ .../dorabangs/feature/home/HomeScreen.kt | 3 --- .../dorabangs/feature/home/HomeViewModel.kt | 18 ++++++++++++++---- .../feature/navigation/HomeNavigation.kt | 15 +++++++++++---- 4 files changed, 43 insertions(+), 11 deletions(-) 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 fd66d4be..05f755d8 100644 --- a/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt +++ b/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt @@ -1,7 +1,10 @@ package com.mashup.dorabangs.navigation +import android.content.ContentValues.TAG +import android.util.Log import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.compose.NavHost import androidx.navigation.navOptions import com.dorabangs.feature.navigation.navigateToSaveLink @@ -9,6 +12,7 @@ import com.dorabangs.feature.navigation.navigateToSaveLinkSelectFolder import com.dorabangs.feature.navigation.saveLinkNavigation import com.dorabangs.feature.navigation.saveLinkSelectFolder import com.mashup.core.navigation.NavigationRoute +import com.mashup.dorabangs.feature.home.HomeViewModel import com.mashup.dorabangs.feature.navigation.homeCreateFolderNavigation import com.mashup.dorabangs.feature.navigation.homeNavigation import com.mashup.dorabangs.feature.navigation.navigateToHome @@ -50,7 +54,21 @@ fun MainNavHost( key = "isVisibleMovingBottomSheet", value = true, ) + Log.d(TAG, "doradora11: ${ appState.navController.previousBackStackEntry?.savedStateHandle?.get("isVisibleMovingBottomSheet")}") + Log.d(TAG, "doradora22: ${ appState.navController.currentBackStackEntry?.savedStateHandle?.get("isVisibleMovingBottomSheet")}") appState.navController.popBackStack() + appState.navController.currentBackStackEntry?.savedStateHandle?.get("isVisibleMovingBottomSheet") + Log.d(TAG, "doradora33: ${ appState.navController.previousBackStackEntry?.savedStateHandle?.get("isVisibleMovingBottomSheet")}") + Log.d(TAG, "doradora44: ${ appState.navController.currentBackStackEntry?.savedStateHandle?.get("isVisibleMovingBottomSheet")}") + +// appState.navController.navigateToHome( +// navOptions = navOptions { +// popUpTo(appState.navController.graph.id) { +// inclusive = true +// } +// }, +// isVisibleMovingBottomSheet = true +// ) }, ) storageNavigation( diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt index 23dd0f67..1443a4a1 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt @@ -64,9 +64,6 @@ fun HomeRoute( val state by viewModel.collectAsState() val scope = rememberCoroutineScope() - LaunchedEffect(key1 = Unit) { - viewModel.getIsVisibleMoreBottomSheet() - } viewModel.collectSideEffect { sideEffect -> when (sideEffect) { diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt index e80ddb21..cb093f2f 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt @@ -1,5 +1,6 @@ package com.mashup.dorabangs.feature.home +import android.content.ContentValues import android.util.Log import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.ViewModel @@ -12,6 +13,7 @@ import com.mashup.dorabangs.domain.usecase.user.GetLastCopiedUrlUseCase import com.mashup.dorabangs.domain.usecase.user.SetLastCopiedUrlUseCase import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.firstOrNull +import kotlinx.coroutines.launch import org.orbitmvi.orbit.ContainerHost import org.orbitmvi.orbit.syntax.simple.intent import org.orbitmvi.orbit.syntax.simple.postSideEffect @@ -28,10 +30,18 @@ class HomeViewModel @Inject constructor( ) : ViewModel(), ContainerHost { override val container = container(HomeState()) - fun getIsVisibleMoreBottomSheet() { - savedStateHandle.get("isVisibleMovingBottomSheet")?.let { isVisible -> - Log.d("HomeViewModel", ": ${isVisible} ") - setVisibleMovingFolderBottomSheet(isVisible) + + init { + Log.d(ContentValues.TAG, "homeNavigationViewModel: ${savedStateHandle.hashCode()}") + viewModelScope.launch { + savedStateHandle.getStateFlow( + "isVisibleMovingBottomSheet", + initialValue = false, + ).collect { isVisible -> + Log.d("dorabangs", "getIsVisibleMoreBottomSheet: $isVisible ") + if(isVisible) + setVisibleMoreButtonBottomSheet(visible = true) + } } } 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 e3c0dc73..a20297b3 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 @@ -1,6 +1,9 @@ package com.mashup.dorabangs.feature.navigation +import android.content.ContentValues.TAG +import android.util.Log import androidx.compose.runtime.collectAsState +import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavOptions @@ -9,9 +12,10 @@ import androidx.navigation.compose.composable import androidx.navigation.navArgument import com.mashup.core.navigation.NavigationRoute import com.mashup.dorabangs.feature.home.HomeRoute +import com.mashup.dorabangs.feature.home.HomeViewModel -fun NavController.navigateToHome(navOptions: NavOptions? = null) = - navigate(NavigationRoute.HomeScreen.route, navOptions) +fun NavController.navigateToHome(navOptions: NavOptions? = null, isVisibleMovingBottomSheet: Boolean = false) = + navigate("${NavigationRoute.HomeScreen.route}/${isVisibleMovingBottomSheet}", navOptions) fun NavGraphBuilder.homeNavigation( navigateToClassification: () -> Unit, @@ -20,15 +24,18 @@ fun NavGraphBuilder.homeNavigation( navigateToCreateFolder: () -> Unit, ) { composable( - route = NavigationRoute.HomeScreen.route, + route = "${NavigationRoute.HomeScreen.route}/{isVisibleMovingBottomSheet}", arguments = listOf( navArgument(name = "isVisibleMovingBottomSheet") { type = NavType.BoolType defaultValue = false }, ), - ) { + ) { backStackEntry -> + val homeViewModel: HomeViewModel = hiltViewModel() + Log.d(TAG, "homeNavigationbackStackEntry: ${backStackEntry.savedStateHandle.get("isVisibleMovingBottomSheet")}") HomeRoute( + viewModel = homeViewModel, navigateToClassification = navigateToClassification, navigateToSaveScreenWithLink = navigateToSaveScreenWithLink, navigateToSaveScreenWithoutLink = navigateToSaveScreenWithoutLink, From ff0bd1accd1347d0e50198425e9b0337b504cfee Mon Sep 17 00:00:00 2001 From: ddyeon Date: Thu, 11 Jul 2024 01:18:20 +0900 Subject: [PATCH 19/22] =?UTF-8?q?[fix]=20savestatehandle=EC=9D=84=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C,,=20viewmodel=EA=B3=B5=EC=9C=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dorabangs/navigation/MainNavHost.kt | 27 ++----------------- .../createfolder/HomeCreateFolderScreen.kt | 5 ++++ .../dorabangs/feature/home/HomeScreen.kt | 2 -- .../dorabangs/feature/home/HomeViewModel.kt | 16 +++-------- .../navigation/HomeCreateFolderNavigation.kt | 13 ++++++++- .../feature/navigation/HomeNavigation.kt | 4 +-- .../feature/storage/storage/StorageScreen.kt | 2 +- 7 files changed, 25 insertions(+), 44 deletions(-) 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 05f755d8..89b3cb6e 100644 --- a/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt +++ b/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt @@ -1,10 +1,7 @@ package com.mashup.dorabangs.navigation -import android.content.ContentValues.TAG -import android.util.Log import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.compose.NavHost import androidx.navigation.navOptions import com.dorabangs.feature.navigation.navigateToSaveLink @@ -12,7 +9,6 @@ import com.dorabangs.feature.navigation.navigateToSaveLinkSelectFolder import com.dorabangs.feature.navigation.saveLinkNavigation import com.dorabangs.feature.navigation.saveLinkSelectFolder import com.mashup.core.navigation.NavigationRoute -import com.mashup.dorabangs.feature.home.HomeViewModel import com.mashup.dorabangs.feature.navigation.homeCreateFolderNavigation import com.mashup.dorabangs.feature.navigation.homeNavigation import com.mashup.dorabangs.feature.navigation.navigateToHome @@ -49,27 +45,8 @@ fun MainNavHost( navigateToCreateFolder = { appState.navController.navigateToHomeCrateFolder() }, ) homeCreateFolderNavigation( - onClickBackIcon = { - appState.navController.previousBackStackEntry?.savedStateHandle?.set( - key = "isVisibleMovingBottomSheet", - value = true, - ) - Log.d(TAG, "doradora11: ${ appState.navController.previousBackStackEntry?.savedStateHandle?.get("isVisibleMovingBottomSheet")}") - Log.d(TAG, "doradora22: ${ appState.navController.currentBackStackEntry?.savedStateHandle?.get("isVisibleMovingBottomSheet")}") - appState.navController.popBackStack() - appState.navController.currentBackStackEntry?.savedStateHandle?.get("isVisibleMovingBottomSheet") - Log.d(TAG, "doradora33: ${ appState.navController.previousBackStackEntry?.savedStateHandle?.get("isVisibleMovingBottomSheet")}") - Log.d(TAG, "doradora44: ${ appState.navController.currentBackStackEntry?.savedStateHandle?.get("isVisibleMovingBottomSheet")}") - -// appState.navController.navigateToHome( -// navOptions = navOptions { -// popUpTo(appState.navController.graph.id) { -// inclusive = true -// } -// }, -// isVisibleMovingBottomSheet = true -// ) - }, + previousBackStackEntry = appState.navController, + onClickBackIcon = { appState.navController.popBackStack() }, ) storageNavigation( navigateToStorageDetail = { appState.navController.navigateToStorageDetail() }, diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/createfolder/HomeCreateFolderScreen.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/createfolder/HomeCreateFolderScreen.kt index 0ba8f2c4..5e88f07a 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/createfolder/HomeCreateFolderScreen.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/createfolder/HomeCreateFolderScreen.kt @@ -1,5 +1,6 @@ package com.mashup.dorabangs.feature.createfolder +import android.util.Log import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer @@ -11,16 +12,20 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel import com.mashup.dorabangs.core.designsystem.component.buttons.DoraButtons import com.mashup.dorabangs.core.designsystem.component.textfield.DoraTextField import com.mashup.dorabangs.core.designsystem.component.topbar.DoraTopBar import com.mashup.dorabangs.core.designsystem.theme.LinkSaveColorTokens +import com.mashup.dorabangs.feature.home.HomeViewModel import com.mashup.dorabangs.home.R @Composable fun HomeCreateFolderRoute( + homeViewModel: HomeViewModel = hiltViewModel(), onClickBackIcon: () -> Unit, ) { + Log.d("DOAROA", "HomeCreateFolderRoute: $homeViewModel") HomeCreateFolderScreen( onClickBackIcon = onClickBackIcon, onClickSaveButton = {}, diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt index 1443a4a1..9c147d9c 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeScreen.kt @@ -20,7 +20,6 @@ import androidx.compose.material3.SnackbarDuration import androidx.compose.material3.SnackbarHostState import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @@ -64,7 +63,6 @@ fun HomeRoute( val state by viewModel.collectAsState() val scope = rememberCoroutineScope() - viewModel.collectSideEffect { sideEffect -> when (sideEffect) { is HomeSideEffect.ShowSnackBar -> { diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt index cb093f2f..fe32c541 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt @@ -1,7 +1,5 @@ package com.mashup.dorabangs.feature.home -import android.content.ContentValues -import android.util.Log import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope @@ -13,35 +11,27 @@ import com.mashup.dorabangs.domain.usecase.user.GetLastCopiedUrlUseCase import com.mashup.dorabangs.domain.usecase.user.SetLastCopiedUrlUseCase import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.firstOrNull -import kotlinx.coroutines.launch import org.orbitmvi.orbit.ContainerHost import org.orbitmvi.orbit.syntax.simple.intent import org.orbitmvi.orbit.syntax.simple.postSideEffect import org.orbitmvi.orbit.syntax.simple.reduce import org.orbitmvi.orbit.viewmodel.container import javax.inject.Inject -import kotlin.math.log @HiltViewModel class HomeViewModel @Inject constructor( - private val savedStateHandle: SavedStateHandle, + val savedStateHandle: SavedStateHandle, private val getLastCopiedUrlUseCase: GetLastCopiedUrlUseCase, private val setLastCopiedUrlUseCase: SetLastCopiedUrlUseCase, ) : ViewModel(), ContainerHost { override val container = container(HomeState()) - init { - Log.d(ContentValues.TAG, "homeNavigationViewModel: ${savedStateHandle.hashCode()}") - viewModelScope.launch { + viewModelScope.doraLaunch { savedStateHandle.getStateFlow( "isVisibleMovingBottomSheet", initialValue = false, - ).collect { isVisible -> - Log.d("dorabangs", "getIsVisibleMoreBottomSheet: $isVisible ") - if(isVisible) - setVisibleMoreButtonBottomSheet(visible = true) - } + ).collect { isVisible -> setVisibleMoreButtonBottomSheet(visible = isVisible) } } } diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeCreateFolderNavigation.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeCreateFolderNavigation.kt index 62d61833..b92d9aff 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeCreateFolderNavigation.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeCreateFolderNavigation.kt @@ -1,22 +1,33 @@ package com.mashup.dorabangs.feature.navigation +import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavOptions import androidx.navigation.compose.composable import com.mashup.core.navigation.NavigationRoute import com.mashup.dorabangs.feature.createfolder.HomeCreateFolderRoute +import com.mashup.dorabangs.feature.home.HomeViewModel fun NavController.navigateToHomeCrateFolder(navOptions: NavOptions? = null) = navigate(NavigationRoute.HomeScreen.HomeCreateFolder.route, navOptions) fun NavGraphBuilder.homeCreateFolderNavigation( + navController: NavController, onClickBackIcon: () -> Unit, ) { composable( route = NavigationRoute.HomeScreen.HomeCreateFolder.route, ) { - HomeCreateFolderRoute( + navController.currentBackStackEntry?.let { backStackEntry -> + val homeViewModel: HomeViewModel = hiltViewModel(backStackEntry) + homeViewModel.savedStateHandle["isVisibleMovingBottomSheet"] = true + + HomeCreateFolderRoute( + homeViewModel = homeViewModel, + onClickBackIcon = onClickBackIcon, + ) + } ?: HomeCreateFolderRoute( onClickBackIcon = onClickBackIcon, ) } 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 a20297b3..f3758b09 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 @@ -2,7 +2,6 @@ package com.mashup.dorabangs.feature.navigation import android.content.ContentValues.TAG import android.util.Log -import androidx.compose.runtime.collectAsState import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder @@ -15,7 +14,7 @@ import com.mashup.dorabangs.feature.home.HomeRoute import com.mashup.dorabangs.feature.home.HomeViewModel fun NavController.navigateToHome(navOptions: NavOptions? = null, isVisibleMovingBottomSheet: Boolean = false) = - navigate("${NavigationRoute.HomeScreen.route}/${isVisibleMovingBottomSheet}", navOptions) + navigate("${NavigationRoute.HomeScreen.route}/$isVisibleMovingBottomSheet", navOptions) fun NavGraphBuilder.homeNavigation( navigateToClassification: () -> Unit, @@ -32,6 +31,7 @@ fun NavGraphBuilder.homeNavigation( }, ), ) { backStackEntry -> + val homeViewModel: HomeViewModel = hiltViewModel() Log.d(TAG, "homeNavigationbackStackEntry: ${backStackEntry.savedStateHandle.get("isVisibleMovingBottomSheet")}") HomeRoute( diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt index b3356a53..348856f9 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt @@ -126,6 +126,6 @@ fun StorageTopAppBar( fun PreviewStorageScreen() { StorageRoute( navigateToStorageDetail = {}, - navigateToFolderManage = {} + navigateToFolderManage = {}, ) } From bb8d8eaf3130034f686d8e0600712a474a05e8c6 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Thu, 11 Jul 2024 01:18:42 +0900 Subject: [PATCH 20/22] =?UTF-8?q?[fix]=20savestatehandle=EC=9D=84=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C,,=20viewmodel=EA=B3=B5=EC=9C=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/mashup/dorabangs/navigation/MainNavHost.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 89b3cb6e..076b672e 100644 --- a/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt +++ b/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt @@ -45,7 +45,7 @@ fun MainNavHost( navigateToCreateFolder = { appState.navController.navigateToHomeCrateFolder() }, ) homeCreateFolderNavigation( - previousBackStackEntry = appState.navController, + navController = appState.navController, onClickBackIcon = { appState.navController.popBackStack() }, ) storageNavigation( From a8dac495d0450474bb4378fa9fc8f15126b52403 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Thu, 11 Jul 2024 01:19:30 +0900 Subject: [PATCH 21/22] =?UTF-8?q?[fix]=20bottomsheet=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/mashup/dorabangs/feature/home/HomeViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt index fe32c541..3c488764 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/home/HomeViewModel.kt @@ -31,7 +31,7 @@ class HomeViewModel @Inject constructor( savedStateHandle.getStateFlow( "isVisibleMovingBottomSheet", initialValue = false, - ).collect { isVisible -> setVisibleMoreButtonBottomSheet(visible = isVisible) } + ).collect { isVisible -> setVisibleMovingFolderBottomSheet(visible = isVisible) } } } From 66093bb4b25ecd591de11008e5cf742f0a4ace8a Mon Sep 17 00:00:00 2001 From: ddyeon Date: Thu, 11 Jul 2024 01:21:19 +0900 Subject: [PATCH 22/22] =?UTF-8?q?[fix]=20=ED=99=88=20=ED=8F=B4=EB=8D=94=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20naventry=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dorabangs/feature/navigation/HomeCreateFolderNavigation.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeCreateFolderNavigation.kt b/feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeCreateFolderNavigation.kt index b92d9aff..d0d2c3bf 100644 --- a/feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeCreateFolderNavigation.kt +++ b/feature/home/src/main/java/com/mashup/dorabangs/feature/navigation/HomeCreateFolderNavigation.kt @@ -19,7 +19,7 @@ fun NavGraphBuilder.homeCreateFolderNavigation( composable( route = NavigationRoute.HomeScreen.HomeCreateFolder.route, ) { - navController.currentBackStackEntry?.let { backStackEntry -> + navController.previousBackStackEntry?.let { backStackEntry -> val homeViewModel: HomeViewModel = hiltViewModel(backStackEntry) homeViewModel.savedStateHandle["isVisibleMovingBottomSheet"] = true