Skip to content

Commit

Permalink
[Feat] #193 - 세부 클립 (링크 수정 & 링크 제목 편집) 이중 바텀시트 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
mini-min committed Aug 31, 2024
1 parent 85bc6bf commit 8476ed2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// DetailEditLinkBottomSheetView.swift
// EditLinkBottomSheetView.swift
// TOASTER-iOS
//
// Created by Gahyun Kim on 2024/04/12.
Expand Down Expand Up @@ -70,8 +70,8 @@ final class EditLinkBottomSheetView: UIView {
fatalError("init(coder:) has not been implemented")
}

override func layoutSubviews() {
super.layoutSubviews()
override func didMoveToWindow() {
super.didMoveToWindow()
setupKeyboard()
}
}
Expand Down
29 changes: 10 additions & 19 deletions TOASTER-iOS/Present/DetailClip/View/DetailClipViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@ final class DetailClipViewController: UIViewController {
private let deleteLinkBottomSheetView = DeleteLinkBottomSheetView()
private lazy var editBottom = ToasterBottomSheetViewController(bottomType: .gray,
bottomTitle: "수정하기",
height: 126,
insertView: deleteLinkBottomSheetView)

private let editLinkBottomSheetView = EditLinkBottomSheetView()
private lazy var editLinkBottom = ToasterBottomSheetViewController(bottomType: .white,
bottomTitle: "링크 제목 편집",
height: 198,
insertView: editLinkBottomSheetView)

// MARK: - Life Cycle
Expand Down Expand Up @@ -161,18 +159,16 @@ extension DetailClipViewController: UICollectionViewDataSource {
}
deleteLinkBottomSheetView.setupDeleteLinkBottomSheetButtonAction {
self.viewModel.deleteLinkAPI(toastId: self.viewModel.toastId)
self.editBottom.hideBottomSheet()
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
self.showToastMessage(width: 152, status: .check, message: StringLiterals.ToastMessage.completeDeleteLink)
self.dismiss(animated: true) { [weak self] in
self?.showToastMessage(width: 152, status: .check, message: StringLiterals.ToastMessage.completeDeleteLink)
}
}
deleteLinkBottomSheetView.setupEditLinkTitleBottomSheetButtonAction {
self.viewModel.getDetailCategoryAPI(categoryID: self.viewModel.categoryId,
filter: DetailCategoryFilter.all)
self.editBottom.hideBottomSheet()
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
self.dismiss(animated: true) {
self.viewModel.segmentIndex = indexPath.item - 1
self.editLinkBottom.modalPresentationStyle = .overFullScreen
self.editLinkBottom.setupSheetPresentation(bottomHeight: 198)
self.present(self.editLinkBottom, animated: true)
}
}
Expand Down Expand Up @@ -274,8 +270,8 @@ extension DetailClipViewController: DetailClipSegmentedDelegate {
extension DetailClipViewController: DetailClipListCollectionViewCellDelegate {
func modifiedButtonTapped(toastId: Int) {
viewModel.toastId = toastId
editBottom.modalPresentationStyle = .overFullScreen
present(editBottom, animated: false)
editBottom.setupSheetPresentation(bottomHeight: 226)
present(editBottom, animated: true)
}
}

Expand All @@ -287,23 +283,18 @@ extension DetailClipViewController: EditLinkBottomSheetViewDelegate {
}

func addHeightBottom() {
editLinkBottom.changeHeightBottomSheet(height: 219)
editLinkBottom.setupSheetHeightChanges(bottomHeight: 219)
}

func minusHeightBottom() {
editLinkBottom.changeHeightBottomSheet(height: 198)
editLinkBottom.setupSheetHeightChanges(bottomHeight: 198)
}

func dismissButtonTapped(title: String) {
viewModel.patchEditLinkTitleAPI(toastId: viewModel.toastId,
title: title)
// 이중 바텀시트 순차적으로 내리기
editLinkBottom.hideBottomSheet()
editBottom.hideBottomSheet()

DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in
guard let self else { return }
self.showToastMessage(width: 152, status: .check, message: StringLiterals.ToastMessage.completeEditTitle)
dismiss(animated: true) { [weak self] in
self?.showToastMessage(width: 152, status: .check, message: StringLiterals.ToastMessage.completeEditTitle)
}
}
}
Expand Down

0 comments on commit 8476ed2

Please sign in to comment.