From 05fa8a9f9e647cec76d8de43714fb2212fba1322 Mon Sep 17 00:00:00 2001 From: MinjaeLee <2alswo7@khu.ac.kr> Date: Sat, 31 Aug 2024 22:44:32 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20#193=20-=20=EB=A7=81=ED=81=AC=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5/=ED=99=88=20=EB=B7=B0=20=ED=81=B4=EB=A6=BD?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=20=EB=B0=94=ED=85=80=EC=8B=9C=ED=8A=B8=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TOASTER-iOS.xcodeproj/project.pbxproj | 8 +-- .../View/SelectClipViewController.swift | 59 +++++++++---------- .../Home/View/HomeViewController.swift | 20 +++---- 3 files changed, 43 insertions(+), 44 deletions(-) diff --git a/TOASTER-iOS.xcodeproj/project.pbxproj b/TOASTER-iOS.xcodeproj/project.pbxproj index ab187cd..50bcf05 100644 --- a/TOASTER-iOS.xcodeproj/project.pbxproj +++ b/TOASTER-iOS.xcodeproj/project.pbxproj @@ -276,7 +276,7 @@ 83474A6D2BED0750009B9C48 /* PatchEditLinkTitleResponseDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8364220B2BE7BFB2005C4085 /* PatchEditLinkTitleResponseDTO.swift */; }; 8364220C2BE7BFB2005C4085 /* PatchEditLinkTitleResponseDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8364220B2BE7BFB2005C4085 /* PatchEditLinkTitleResponseDTO.swift */; }; 8388E98C2BC8FAB200858C5C /* PatchEditLinkTitleRequestDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8388E98B2BC8FAB200858C5C /* PatchEditLinkTitleRequestDTO.swift */; }; - 8388E98E2BC8FC6700858C5C /* DetailEditLinkBottomSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8388E98D2BC8FC6700858C5C /* DetailEditLinkBottomSheetView.swift */; }; + 8388E98E2BC8FC6700858C5C /* EditLinkBottomSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8388E98D2BC8FC6700858C5C /* EditLinkBottomSheetView.swift */; }; 83CFC3372B564F1100A2EB2B /* WeeklyLinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83CFC3362B564F1100A2EB2B /* WeeklyLinkModel.swift */; }; 83CFC3392B568BE700A2EB2B /* RecommendSiteModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83CFC3382B568BE700A2EB2B /* RecommendSiteModel.swift */; }; 83CFC33B2B57324700A2EB2B /* SaveLinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83CFC33A2B57324700A2EB2B /* SaveLinkModel.swift */; }; @@ -487,7 +487,7 @@ 8315CD902B5521F70061F377 /* SelectClipModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectClipModel.swift; sourceTree = ""; }; 8364220B2BE7BFB2005C4085 /* PatchEditLinkTitleResponseDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PatchEditLinkTitleResponseDTO.swift; sourceTree = ""; }; 8388E98B2BC8FAB200858C5C /* PatchEditLinkTitleRequestDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PatchEditLinkTitleRequestDTO.swift; sourceTree = ""; }; - 8388E98D2BC8FC6700858C5C /* DetailEditLinkBottomSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailEditLinkBottomSheetView.swift; sourceTree = ""; }; + 8388E98D2BC8FC6700858C5C /* EditLinkBottomSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditLinkBottomSheetView.swift; sourceTree = ""; }; 83CFC3362B564F1100A2EB2B /* WeeklyLinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeeklyLinkModel.swift; sourceTree = ""; }; 83CFC3382B568BE700A2EB2B /* RecommendSiteModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecommendSiteModel.swift; sourceTree = ""; }; 83CFC33A2B57324700A2EB2B /* SaveLinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SaveLinkModel.swift; sourceTree = ""; }; @@ -679,7 +679,7 @@ 39BE4BBD2B4ABB7C002B471D /* DetailClipSegmentedControlView.swift */, 39BE4BBF2B4ABB9E002B471D /* DetailClipEmptyView.swift */, 39BE4BC12B4ABBB0002B471D /* DeleteLinkBottomSheetView.swift */, - 8388E98D2BC8FC6700858C5C /* DetailEditLinkBottomSheetView.swift */, + 8388E98D2BC8FC6700858C5C /* EditLinkBottomSheetView.swift */, ); path = Component; sourceTree = ""; @@ -1948,7 +1948,7 @@ 6BE6DA9C2B54752B008B06FA /* GetTimerMainpageResponseDTO.swift in Sources */, 6B6AE6AA2B3FF6EA000E2366 /* UIStackView+.swift in Sources */, 8305178A2B4D1E09009FFB60 /* UserClipCollectionViewCell.swift in Sources */, - 8388E98E2BC8FC6700858C5C /* DetailEditLinkBottomSheetView.swift in Sources */, + 8388E98E2BC8FC6700858C5C /* EditLinkBottomSheetView.swift in Sources */, 3913B0AE2BCEC9C00031A3EB /* UpdateAlertManager.swift in Sources */, 3F2FA17D2B4928B700EDBF95 /* LoginUseCase.swift in Sources */, 6BE6DA9A2B54747B008B06FA /* TimerAPIService.swift in Sources */, diff --git a/TOASTER-iOS/Present/AddLink/SelectClip/View/SelectClipViewController.swift b/TOASTER-iOS/Present/AddLink/SelectClip/View/SelectClipViewController.swift index 9d873f4..a1d1f4b 100644 --- a/TOASTER-iOS/Present/AddLink/SelectClip/View/SelectClipViewController.swift +++ b/TOASTER-iOS/Present/AddLink/SelectClip/View/SelectClipViewController.swift @@ -24,9 +24,8 @@ final class SelectClipViewController: UIViewController { private let clipSelectCollectionView: UICollectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) private let completeButton: UIButton = UIButton() private let addClipBottomSheetView = AddClipBottomSheetView() - private lazy var addClipBottom = ToasterBottomSheetViewController(bottomType: .white, + private lazy var addClipBottom = ToasterBottomSheetViewController(bottomType: .white, bottomTitle: "클립 추가", - height: 198, insertView: addClipBottomSheetView) private var selectedClipTapped: RemindClipModel? { @@ -63,10 +62,10 @@ private extension SelectClipViewController { view.backgroundColor = .toasterBackground clipSelectCollectionView.do { - $0.register(RemindSelectClipCollectionViewCell.self, + $0.register(RemindSelectClipCollectionViewCell.self, forCellWithReuseIdentifier: RemindSelectClipCollectionViewCell.className) - $0.register(SelectClipHeaderView.self, + $0.register(SelectClipHeaderView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: SelectClipHeaderView.className) @@ -84,7 +83,7 @@ private extension SelectClipViewController { } func setupHierarchy() { - view.addSubviews(clipSelectCollectionView, + view.addSubviews(clipSelectCollectionView, completeButton) } @@ -129,7 +128,7 @@ private extension SelectClipViewController { func moveBottomAction(isDuplicated: Bool) { if isDuplicated { addHeightBottom() - addClipBottomSheetView.changeTextField(addButton: false, + addClipBottomSheetView.changeTextField(addButton: false, border: true, error: true, clearButton: true) @@ -140,11 +139,12 @@ private extension SelectClipViewController { } func addClipAction() { - addClipBottomSheetView.resetTextField() - addClipBottom.hideBottomSheet() - showToastMessage(width: 157, - status: .check, - message: StringLiterals.ToastMessage.completeAddClip) + dismiss(animated: true) { + self.addClipBottomSheetView.resetTextField() + self.showToastMessage(width: 157, + status: .check, + message: StringLiterals.ToastMessage.completeAddClip) + } } func saveLinkAction() { @@ -154,7 +154,7 @@ private extension SelectClipViewController { func saveFailAction() { self.navigationController?.popToRootViewController(animated: true) - self.navigationController?.showToastMessage(width: 200, + self.navigationController?.showToastMessage(width: 200, status: .warning, message: "링크 저장에 실패했어요!") } @@ -186,14 +186,14 @@ private extension SelectClipViewController { } @objc func completeButtonTapped() { - viewModel.postSaveLink(url: linkURL, + viewModel.postSaveLink(url: linkURL, category: categoryID) } } // MARK: - UICollectionViewDelegate -extension SelectClipViewController: UICollectionViewDelegate { +extension SelectClipViewController: UICollectionViewDelegate { func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { if indexPath.item != 0 { if let cell = collectionView.cellForItem(at: .SubSequence(item: 0, section: 0)) { @@ -203,7 +203,7 @@ extension SelectClipViewController: UICollectionViewDelegate { categoryID = viewModel.selectedClip[indexPath.item].id } - func collectionView(_ collectionView: UICollectionView, + func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) { if indexPath.item == 0 { @@ -233,7 +233,7 @@ extension SelectClipViewController: UICollectionViewDataSource { func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { if kind == UICollectionView.elementKindSectionHeader { - guard let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, + guard let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: SelectClipHeaderView.className, for: indexPath) as? SelectClipHeaderView else { return UICollectionReusableView() } headerView.selectClipHeaderViewDelegate = self @@ -245,7 +245,7 @@ extension SelectClipViewController: UICollectionViewDataSource { } // Header 크기 지정 - func collectionView(_ collectionView: UICollectionView, + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize { return CGSize(width: 335, height: 68) @@ -255,19 +255,19 @@ extension SelectClipViewController: UICollectionViewDataSource { // MARK: - UICollectionViewDelegateFlowLayout extension SelectClipViewController: UICollectionViewDelegateFlowLayout { - func collectionView(_ collectionView: UICollectionView, - layout collectionViewLayout: UICollectionViewLayout, + func collectionView(_ collectionView: UICollectionView, + layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { return CGSize(width: view.convertByWidthRatio(335), height: 52) } - func collectionView(_ collectionView: UICollectionView, + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { return UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20) } - func collectionView(_ collectionView: UICollectionView, + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { return 8 @@ -277,12 +277,12 @@ extension SelectClipViewController: UICollectionViewDelegateFlowLayout { extension SelectClipViewController: SelectClipHeaderViewlDelegate { func addClipCellTapped() { if viewModel.selectedClip.count > 15 { - showToastMessage(width: 243, - status: .warning, + showToastMessage(width: 243, + status: .warning, message: StringLiterals.ToastMessage.noticeMaxClip) } else { - addClipBottom.modalPresentationStyle = .overFullScreen - self.present(addClipBottom, animated: false) + addClipBottom.setupSheetPresentation(bottomHeight: 198) + self.present(addClipBottom, animated: true) } } } @@ -297,17 +297,16 @@ extension SelectClipViewController: AddClipBottomSheetViewDelegate { } func addHeightBottom() { - addClipBottom.changeHeightBottomSheet(height: 219) + addClipBottom.setupSheetHeightChanges(bottomHeight: 219) } func minusHeightBottom() { - addClipBottom.changeHeightBottomSheet(height: 198) + addClipBottom.setupSheetHeightChanges(bottomHeight: 198) } func dismissButtonTapped() { - addClipBottom.hideBottomSheet() - DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { - self.showToastMessage(width: 157, + dismiss(animated: true) { + self.showToastMessage(width: 157, status: .check, message: StringLiterals.ToastMessage.completeAddClip) self.addClipBottomSheetView.resetTextField() diff --git a/TOASTER-iOS/Present/Home/View/HomeViewController.swift b/TOASTER-iOS/Present/Home/View/HomeViewController.swift index 13c2d26..8effaf9 100644 --- a/TOASTER-iOS/Present/Home/View/HomeViewController.swift +++ b/TOASTER-iOS/Present/Home/View/HomeViewController.swift @@ -19,7 +19,6 @@ final class HomeViewController: UIViewController { private let addClipBottomSheetView = AddClipBottomSheetView() private lazy var addClipBottom = ToasterBottomSheetViewController(bottomType: .white, bottomTitle: "클립 추가", - height: 198, insertView: addClipBottomSheetView) // MARK: - Life Cycle @@ -277,11 +276,12 @@ private extension HomeViewController { } func addClipAction() { - addClipBottomSheetView.resetTextField() - addClipBottom.hideBottomSheet() - showToastMessage(width: 157, - status: .check, - message: StringLiterals.ToastMessage.completeAddClip) + dismiss(animated: true) { + self.addClipBottomSheetView.resetTextField() + self.showToastMessage(width: 157, + status: .check, + message: StringLiterals.ToastMessage.completeAddClip) + } } func setupNavigationBar() { @@ -318,11 +318,11 @@ extension HomeViewController: AddClipBottomSheetViewDelegate { } func addHeightBottom() { - addClipBottom.changeHeightBottomSheet(height: 219) + addClipBottom.setupSheetHeightChanges(bottomHeight: 219) } func minusHeightBottom() { - addClipBottom.changeHeightBottomSheet(height: 198) + addClipBottom.setupSheetHeightChanges(bottomHeight: 198) } func dismissButtonTapped(title: String) { @@ -334,8 +334,8 @@ extension HomeViewController: AddClipBottomSheetViewDelegate { extension HomeViewController: UserClipCollectionViewCellDelegate { func addClipCellTapped() { - addClipBottom.modalPresentationStyle = .overFullScreen - self.present(addClipBottom, animated: false) + addClipBottom.setupSheetPresentation(bottomHeight: 198) + self.present(addClipBottom, animated: true) } }