From b1c08411f8713346a08569ef13c078c19a1b2e95 Mon Sep 17 00:00:00 2001 From: yunsehwan Date: Sun, 17 Nov 2024 18:58:32 +0900 Subject: [PATCH] =?UTF-8?q?[FIX]=20#79=20=EC=A6=90=EA=B2=A8=EC=B0=BE?= =?UTF-8?q?=EA=B8=B0/=EC=95=88=EC=9D=BD=EC=9D=8C=20=EB=A7=81=ED=81=AC=20?= =?UTF-8?q?=EB=AA=A9=EB=A1=9D=20=ED=99=94=EB=A9=B4=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EC=84=B8=EB=B6=80=20=EB=A7=81=ED=81=AC=20bottomSheet=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EB=A7=81=ED=81=AC=20=EC=A0=9C=EA=B1=B0=20bottomShe?= =?UTF-8?q?et=20=ED=98=B8=EC=B6=9C=EC=8B=9C=20=EB=A7=81=ED=81=AC=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0=20bottomSheet=EA=B0=80=20=EB=B0=94=EB=A1=9C?= =?UTF-8?q?=20=EC=88=A8=EA=B2=A8=EC=A7=80=EB=8A=94=20=EB=AC=B8=EC=A0=9C=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 --- .../pokit/linklist/LinkListScreen.kt | 19 ++++++++++++------- .../pokit/linklist/LinkListViewModel.kt | 10 +++++++++- .../java/pokitmons/pokit/linklist/Preview.kt | 3 ++- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/feature/linklist/src/main/java/pokitmons/pokit/linklist/LinkListScreen.kt b/feature/linklist/src/main/java/pokitmons/pokit/linklist/LinkListScreen.kt index 65d209c..bc530d3 100644 --- a/feature/linklist/src/main/java/pokitmons/pokit/linklist/LinkListScreen.kt +++ b/feature/linklist/src/main/java/pokitmons/pokit/linklist/LinkListScreen.kt @@ -67,8 +67,9 @@ fun LinkListScreenContainer( linkList = linkList, linkListState = linkListState, showLinkDetailBottomSheet = viewModel::showLinkDetailBottomSheet, + hideLinkDetailBottomSheet = viewModel::hideLinkDetailBottomSheet, showCheckLinkRemoveBottomSheet = viewModel::showCheckLinkRemoveBottomSheet, - hideBottomSheet = viewModel::hideBottomSheet, + hideCheckLinkRemoveBottomSheet = viewModel::hideCheckLinkRemoveBottomSheet, onClickLinkRemove = viewModel::removeLink, onClickModifyLink = onNavigateToLinkModify, onClickBookmark = viewModel::toggleBookmark @@ -85,8 +86,9 @@ fun LinkListScreen( loadNextLinkList: () -> Unit, toggleSort: () -> Unit, showLinkDetailBottomSheet: (Link) -> Unit, + hideLinkDetailBottomSheet: () -> Unit, showCheckLinkRemoveBottomSheet: () -> Unit, - hideBottomSheet: () -> Unit, + hideCheckLinkRemoveBottomSheet: () -> Unit, onClickLinkRemove: () -> Unit, onClickModifyLink: (String) -> Unit, onClickBookmark: () -> Unit, @@ -211,6 +213,9 @@ fun LinkListScreen( val context: Context = LocalContext.current val link = state.bottomSheetInfo?.link ?: Link() + + // 수정 필요 + // onHideBottomSheet 호출로 인해 후속 호출로 발생한 삭제 bottomSheet가 종료되고 있음 LinkDetailBottomSheet( title = link.title, memo = link.memo, @@ -220,7 +225,7 @@ fun LinkListScreen( openWebBrowserByClick = true, pokitName = link.pokitName, dateString = link.dateString, - onHideBottomSheet = hideBottomSheet, + onHideBottomSheet = hideLinkDetailBottomSheet, show = state.bottomSheetInfo?.type == BottomSheetType.DETAIL, onClickShareLink = { val intent = Intent(Intent.ACTION_SEND_MULTIPLE).apply { @@ -230,7 +235,7 @@ fun LinkListScreen( context.startActivity(Intent.createChooser(intent, "Pokit")) }, onClickModifyLink = { - hideBottomSheet() + hideLinkDetailBottomSheet() onClickModifyLink(link.id) }, onClickRemoveLink = { @@ -242,17 +247,17 @@ fun LinkListScreen( PokitBottomSheet( - onHideBottomSheet = hideBottomSheet, + onHideBottomSheet = hideCheckLinkRemoveBottomSheet, show = state.bottomSheetInfo?.type == BottomSheetType.CHECK_REMOVE ) { TwoButtonBottomSheetContent( title = stringResource(id = R.string.title_remove_link), subText = stringResource(id = R.string.sub_remove_link), - onClickLeftButton = hideBottomSheet, + onClickLeftButton = hideCheckLinkRemoveBottomSheet, onClickRightButton = remember { { onClickLinkRemove() - hideBottomSheet() + hideCheckLinkRemoveBottomSheet() } } ) diff --git a/feature/linklist/src/main/java/pokitmons/pokit/linklist/LinkListViewModel.kt b/feature/linklist/src/main/java/pokitmons/pokit/linklist/LinkListViewModel.kt index 2b532fe..98a880e 100644 --- a/feature/linklist/src/main/java/pokitmons/pokit/linklist/LinkListViewModel.kt +++ b/feature/linklist/src/main/java/pokitmons/pokit/linklist/LinkListViewModel.kt @@ -144,6 +144,13 @@ class LinkListViewModel @Inject constructor( } } + fun hideLinkDetailBottomSheet() { + if (_state.value.bottomSheetInfo?.type != BottomSheetType.DETAIL) return + _state.update { + it.copy(bottomSheetInfo = null) + } + } + fun showCheckLinkRemoveBottomSheet() { val currentState = _state.value.copy() @@ -155,7 +162,8 @@ class LinkListViewModel @Inject constructor( } } - fun hideBottomSheet() { + fun hideCheckLinkRemoveBottomSheet() { + if (_state.value.bottomSheetInfo?.type != BottomSheetType.CHECK_REMOVE) return _state.update { it.copy(bottomSheetInfo = null) } diff --git a/feature/linklist/src/main/java/pokitmons/pokit/linklist/Preview.kt b/feature/linklist/src/main/java/pokitmons/pokit/linklist/Preview.kt index e073d97..1740821 100644 --- a/feature/linklist/src/main/java/pokitmons/pokit/linklist/Preview.kt +++ b/feature/linklist/src/main/java/pokitmons/pokit/linklist/Preview.kt @@ -21,8 +21,9 @@ fun Preview() { loadNextLinkList = { }, toggleSort = {}, showLinkDetailBottomSheet = {}, + hideLinkDetailBottomSheet = {}, showCheckLinkRemoveBottomSheet = {}, - hideBottomSheet = {}, + hideCheckLinkRemoveBottomSheet = {}, onClickBookmark = {}, onClickModifyLink = {}, onClickLinkRemove = {}