Skip to content

Commit

Permalink
[FIX] #79 즐겨찾기/안읽음 링크 목록 화면에서 세부 링크 bottomSheet에서 링크 제거 bottomSheet 호…
Browse files Browse the repository at this point in the history
…출시 링크 제거 bottomSheet가 바로 숨겨지는 문제 수정
  • Loading branch information
l5x5l committed Nov 17, 2024
1 parent 378af64 commit b1c0841
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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 {
Expand All @@ -230,7 +235,7 @@ fun LinkListScreen(
context.startActivity(Intent.createChooser(intent, "Pokit"))
},
onClickModifyLink = {
hideBottomSheet()
hideLinkDetailBottomSheet()
onClickModifyLink(link.id)
},
onClickRemoveLink = {
Expand All @@ -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()
}
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ fun Preview() {
loadNextLinkList = { },
toggleSort = {},
showLinkDetailBottomSheet = {},
hideLinkDetailBottomSheet = {},
showCheckLinkRemoveBottomSheet = {},
hideBottomSheet = {},
hideCheckLinkRemoveBottomSheet = {},
onClickBookmark = {},
onClickModifyLink = {},
onClickLinkRemove = {}
Expand Down

0 comments on commit b1c0841

Please sign in to comment.