From b041045c0b12a685a2a9c00e330884685b7730ae Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Sun, 10 Dec 2023 21:25:45 +0900 Subject: [PATCH 01/17] =?UTF-8?q?[Feat]=20#224=20-=20=EC=82=AD=EC=A0=9C=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CourseDetail/VC/CourseDetailVC.swift | 3 ++- .../Views/VC/CourseDiscoveryVC.swift | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index 28548e56..a6f18751 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -535,6 +535,7 @@ extension CourseDetailVC { DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { self.navigationController?.popViewController(animated: true) } + delegate?.didRemoveCourse(publicCourseId: courseId) } if status >= 400 { print("400 error") @@ -572,8 +573,8 @@ extension CourseDetailVC { let deleteAlertVC = RNAlertVC(description: "러닝 기록을 정말로 삭제하시겠어요?").setButtonTitle("취소", "삭제하기") deleteAlertVC.modalPresentationStyle = .overFullScreen deleteAlertVC.rightButtonTapAction = { - deleteAlertVC.dismiss(animated: false) self.deleteCourse() + deleteAlertVC.dismiss(animated: false) } self.present(deleteAlertVC, animated: false) case "신고하기": diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift index ac7f271d..403330a8 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift @@ -13,6 +13,7 @@ import Moya protocol ScrapStateDelegate: AnyObject { func didUpdateScrapState(publicCourseId: Int, isScrapped: Bool) + func didRemoveCourse(publicCourseId: Int) // 코스 상세 에서 스크랩 누르면 코스발견에 해당 부분 스크랩 누르는 이벤트 전달 } @@ -80,7 +81,7 @@ final class CourseDiscoveryVC: UIViewController { setLayout() setAddTarget() setCombineEvent() - self.getCourseData() + self.getCourseData(pageNo: pageNo) } override func viewWillAppear(_ animated: Bool) { @@ -369,7 +370,7 @@ extension CourseDiscoveryVC: UIScrollViewDelegate { if pageNo < totalPageNum { if !isDataLoaded { isDataLoaded = true - getCourseData() + getCourseData(pageNo: pageNo) pageNo += 1 isDataLoaded = false } @@ -441,12 +442,20 @@ extension CourseDiscoveryVC: ScrapStateDelegate { print("‼️CourseDiscoveryVC 델리게이트 받음 index=\(index)") } } + + func didRemoveCourse(publicCourseId: Int) { + if let index = courseList.firstIndex(where: { $0.id == publicCourseId }) { + self.courseList.remove(at: index) + self.mapCollectionView.reloadData() + print("didRemoveCourse= 삭제되었음\n") + } + } } // MARK: - Network extension CourseDiscoveryVC { - private func getCourseData() { + private func getCourseData(pageNo: Int) { LoadingIndicator.showLoading() // 항상 0.5초 늦게 로딩이 되어 버림 0.5초를 넣은 이유는 pagination을 구현할때 한번에 다 받아오지 않게 하기 위함 DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { [self] in publicCourseProvider.request(.getCourseData(pageNo: pageNo, sort: sort)) { response in @@ -462,7 +471,6 @@ extension CourseDiscoveryVC { self.totalPageNum = data.totalPageSize self.isEnd = data.isEnd self.courseList.append(contentsOf: data.publicCourses) - self.mapCollectionView.reloadData() print("isEnd= \(self.isEnd), totalPageNum= \(self.totalPageNum)") } catch { print(error.localizedDescription) @@ -546,6 +554,6 @@ extension CourseDiscoveryVC: TitleCollectionViewCellDelegate { print("‼️\(ordering)‼️ 터치 하셨습니다. 0.7초 후에 ‼️\(ordering)‼️ 으로 정렬이 되는 데이터가 불러 옵니다.") sort = ordering self.courseList.removeAll() - getCourseData() + getCourseData(pageNo: pageNo) } } From fadd42adc0af850b54ad65fd3227b61457649aec Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Sun, 10 Dec 2023 21:59:06 +0900 Subject: [PATCH 02/17] =?UTF-8?q?[Feat]=20#224=20-=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EB=84=A4=EC=9D=B4=EC=85=98=20=EC=BD=94=EB=93=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 --- .../CourseDiscovery/Views/VC/CourseDiscoveryVC.swift | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift index 403330a8..7e8dcd4d 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift @@ -366,12 +366,13 @@ extension CourseDiscoveryVC: UIScrollViewDelegate { // 페이지네이션 중단 코드 return } - print("🫠\(pageNo)") + if pageNo < totalPageNum { if !isDataLoaded { isDataLoaded = true + print("🫠\(pageNo)") + self.pageNo += 1 getCourseData(pageNo: pageNo) - pageNo += 1 isDataLoaded = false } } @@ -456,8 +457,8 @@ extension CourseDiscoveryVC: ScrapStateDelegate { extension CourseDiscoveryVC { private func getCourseData(pageNo: Int) { - LoadingIndicator.showLoading() // 항상 0.5초 늦게 로딩이 되어 버림 0.5초를 넣은 이유는 pagination을 구현할때 한번에 다 받아오지 않게 하기 위함 - DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { [self] in + LoadingIndicator.showLoading() // 항상 0.7초 늦게 로딩이 되어 버림 0.5초를 넣은 이유는 pagination을 구현할때 한번에 다 받아오지 않게 하기 위함 + DispatchQueue.main.asyncAfter(deadline: .now() + 0.7) { [self] in publicCourseProvider.request(.getCourseData(pageNo: pageNo, sort: sort)) { response in LoadingIndicator.hideLoading() print("‼️ sort= \(self.sort) ‼️\n") @@ -471,7 +472,8 @@ extension CourseDiscoveryVC { self.totalPageNum = data.totalPageSize self.isEnd = data.isEnd self.courseList.append(contentsOf: data.publicCourses) - print("isEnd= \(self.isEnd), totalPageNum= \(self.totalPageNum)") + self.mapCollectionView.reloadData() + print("pageNo= \(pageNo), isEnd= \(self.isEnd), totalPageNum= \(self.totalPageNum)") } catch { print(error.localizedDescription) } From 584a6c68ef658adde5025f348ff1591bf2b930dc Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Wed, 13 Dec 2023 17:53:44 +0900 Subject: [PATCH 03/17] =?UTF-8?q?[Feat]=20#224=20-=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C=20=EB=B2=84=ED=8A=BC=20=EB=A0=88=EC=9D=B4=EC=95=84?= =?UTF-8?q?=EC=9B=83=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 당근 마켓 글쓰기 버튼 처럼, 바꾸었습니다. --- .../Views/VC/CourseDiscoveryVC.swift | 58 ++++++------------- 1 file changed, 19 insertions(+), 39 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift index 7e8dcd4d..a9ecbc5f 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift @@ -29,11 +29,10 @@ final class CourseDiscoveryVC: UIViewController { private var cancelBag = CancelBag() private var specialList = [String]() private var totalPageNum = 0 - private var isEnd = false - private var pageNo = 1 + private var isEnd: Bool = false + private var pageNo: Int = 1 private var sort = "date" private var isDataLoaded = false - private var uploadButtonChanged = false // MARK: - UIComponents @@ -166,8 +165,7 @@ extension CourseDiscoveryVC { view.backgroundColor = .w1 mapCollectionView.backgroundColor = .w1 self.emptyView.isHidden = true - self.miniUploadButton.isHidden = true - self.uploadButton.isHidden = false + self.miniUploadButton.alpha = 0.0 /// 이거 없으면 처음에 UIView.animate 효과 보임 } private func setNavigationBar() { @@ -203,7 +201,7 @@ extension CourseDiscoveryVC { } miniUploadButton.snp.makeConstraints { make in - make.trailing.equalTo(self.view.safeAreaLayoutGuide).inset(38) + make.leading.equalTo(self.view.safeAreaLayoutGuide).inset(276) make.bottom.equalTo(self.view.safeAreaLayoutGuide).inset(20) make.width.height.equalTo(41) } @@ -359,14 +357,14 @@ extension CourseDiscoveryVC: UIScrollViewDelegate { let collectionViewHeight = mapCollectionView.contentSize.height // 전체 사이즈 let paginationY = mapCollectionView.bounds.size.height // 유저 화면의 가장 아래 y축 이라고 생각 + /// 페이지네이션 중단 코드 if contentOffsetY > collectionViewHeight - paginationY { if courseList.count < pageNo * serverResponseNumber { // 페이지 끝에 도달하면 현재 페이지에 더 이상 데이터가 없음을 의미 // 새로온 데이터의 갯수가 원래 서버에서 응답에서 온 갯수보다 작으면 페이지네이션 금지 - // 페이지네이션 중단 코드 return } - + if pageNo < totalPageNum { if !isDataLoaded { isDataLoaded = true @@ -383,37 +381,19 @@ extension CourseDiscoveryVC: UIScrollViewDelegate { let contentOffsetY = mapCollectionView.contentOffset.y let scrollThreshold = mapCollectionView.bounds.size.height * 0.1 // 10% 스크롤 했으면 UI 변경 - if contentOffsetY > scrollThreshold { - handleButtonVisibility(uploadButtonChanged: true, hidden: true, miniHidden: false) - } else { - handleButtonVisibility(uploadButtonChanged: false, hidden: false, miniHidden: true) - } - } - - private func handleButtonVisibility(uploadButtonChanged: Bool, hidden: Bool, miniHidden: Bool) { - guard self.uploadButtonChanged != uploadButtonChanged else { return } - - toggleUploadButtons(hidden: hidden, miniHidden: miniHidden) - self.uploadButtonChanged = uploadButtonChanged - } - - private func toggleUploadButtons(hidden: Bool, miniHidden: Bool) { - animateButtonTransition(button: uploadButton, hidden: hidden, delay: 0) - animateButtonTransition(button: miniUploadButton, hidden: miniHidden, delay: 0.1) // 예시로 0.25초 딜레이 적용 - } - - private func animateButtonTransition(button: UIButton, hidden: Bool, delay: TimeInterval) { - let scale: CGFloat = hidden ? 0.1 : 1.0 - let alpha: CGFloat = hidden ? 0.0 : 1.0 - - UIView.animate(withDuration: 0.5, delay: delay, options: .transitionCurlUp, animations: { - button.transform = CGAffineTransform(scaleX: scale, y: scale) - button.alpha = alpha - }) { _ in - button.isHidden = hidden - - // Reset transform after animation completes - button.transform = CGAffineTransform.identity + UIView.animate(withDuration: 0.15) { + if contentOffsetY > scrollThreshold { + // 10% 이상 스크롤 했을 때 + self.uploadButton.transform = CGAffineTransform(scaleX: 0.5, y: 0.96) + self.miniUploadButton.frame.origin.x = 332 // 직접 피그마보고 상수 맞췄습니다. + self.uploadButton.alpha = 0.0 + self.miniUploadButton.alpha = 1.0 + } else { + self.uploadButton.transform = .identity + self.miniUploadButton.alpha = 0.0 + self.uploadButton.alpha = 1.0 + self.miniUploadButton.frame.origin.x = 276 + } } } } From 6517c291e3ed8fcd235870f0f0c170cfbd7748d4 Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Wed, 13 Dec 2023 18:29:01 +0900 Subject: [PATCH 04/17] =?UTF-8?q?[refactor]=20#224=20-=20=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=A1=A4=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=EB=A1=9C=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/VC/CourseDiscoveryVC.swift | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift index a9ecbc5f..608b982b 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift @@ -381,21 +381,29 @@ extension CourseDiscoveryVC: UIScrollViewDelegate { let contentOffsetY = mapCollectionView.contentOffset.y let scrollThreshold = mapCollectionView.bounds.size.height * 0.1 // 10% 스크롤 했으면 UI 변경 - UIView.animate(withDuration: 0.15) { + UIView.animate(withDuration: 0.2) { if contentOffsetY > scrollThreshold { // 10% 이상 스크롤 했을 때 - self.uploadButton.transform = CGAffineTransform(scaleX: 0.5, y: 0.96) - self.miniUploadButton.frame.origin.x = 332 // 직접 피그마보고 상수 맞췄습니다. - self.uploadButton.alpha = 0.0 - self.miniUploadButton.alpha = 1.0 + self.downScroll() } else { - self.uploadButton.transform = .identity - self.miniUploadButton.alpha = 0.0 - self.uploadButton.alpha = 1.0 - self.miniUploadButton.frame.origin.x = 276 + self.upScroll() } } } + + private func downScroll() { + self.uploadButton.transform = CGAffineTransform(scaleX: 0.45, y: 0.96) + self.miniUploadButton.frame.origin.x = 332 // 직접 피그마보고 상수 맞췄습니다. + self.uploadButton.alpha = 0.0 + self.miniUploadButton.alpha = 1.0 + } + + private func upScroll() { + self.uploadButton.transform = .identity + self.miniUploadButton.alpha = 0.0 + self.uploadButton.alpha = 1.0 + self.miniUploadButton.frame.origin.x = 276 + } } // MARK: - CourseListCVCDelegate From ddcaa1c04ed992717b9a9b7bad2461324f4b7429 Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Wed, 13 Dec 2023 18:32:12 +0900 Subject: [PATCH 05/17] =?UTF-8?q?[Fix]=20#224=20-=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C=20=EB=B2=84=ED=8A=BC=20scale=20=EA=B0=92=20=EC=A1=B0?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CourseDiscovery/Views/VC/CourseDiscoveryVC.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift index 608b982b..e6c5fa41 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift @@ -381,7 +381,7 @@ extension CourseDiscoveryVC: UIScrollViewDelegate { let contentOffsetY = mapCollectionView.contentOffset.y let scrollThreshold = mapCollectionView.bounds.size.height * 0.1 // 10% 스크롤 했으면 UI 변경 - UIView.animate(withDuration: 0.2) { + UIView.animate(withDuration: 0.25) { if contentOffsetY > scrollThreshold { // 10% 이상 스크롤 했을 때 self.downScroll() @@ -392,7 +392,7 @@ extension CourseDiscoveryVC: UIScrollViewDelegate { } private func downScroll() { - self.uploadButton.transform = CGAffineTransform(scaleX: 0.45, y: 0.96) + self.uploadButton.transform = CGAffineTransform(scaleX: 0.3, y: 0.96) self.miniUploadButton.frame.origin.x = 332 // 직접 피그마보고 상수 맞췄습니다. self.uploadButton.alpha = 0.0 self.miniUploadButton.alpha = 1.0 From 6ff35857adc5da2bd5af910680a01f9b5acb5f3c Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Wed, 13 Dec 2023 21:40:40 +0900 Subject: [PATCH 06/17] =?UTF-8?q?[Add]=20#224=20-=20GoogleService.info=20?= =?UTF-8?q?=EA=B7=B8=EB=A3=B9=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index b7ccc67c..83bc27ff 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -18,6 +18,7 @@ 71288ED32B26ED2500D6C921 /* UserUploadedLabelCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71288ED22B26ED2500D6C921 /* UserUploadedLabelCell.swift */; }; 712F661D2A7B7BAB00D9539B /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = 712F661C2A7B7BAB00D9539B /* Config.swift */; }; 7136BF8A2AF921A900679364 /* CustomBottomSheetVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7136BF892AF921A900679364 /* CustomBottomSheetVC.swift */; }; + 713A98F02B29DD9900189B3C /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 713A98EF2B29DD9900189B3C /* GoogleService-Info.plist */; }; 717916DA2B13613B009CEF97 /* MarathonListResponseDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 717916D92B13613B009CEF97 /* MarathonListResponseDto.swift */; }; 717916DE2B137DC3009CEF97 /* TotalPageCountDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 717916DD2B137DC3009CEF97 /* TotalPageCountDto.swift */; }; 71BAD06A2B24CECC0061E31D /* UserProfileDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71BAD0692B24CECC0061E31D /* UserProfileDto.swift */; }; @@ -189,6 +190,7 @@ 71288ED22B26ED2500D6C921 /* UserUploadedLabelCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserUploadedLabelCell.swift; sourceTree = ""; }; 712F661C2A7B7BAB00D9539B /* Config.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Config.swift; sourceTree = ""; }; 7136BF892AF921A900679364 /* CustomBottomSheetVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomBottomSheetVC.swift; sourceTree = ""; }; + 713A98EF2B29DD9900189B3C /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 717916D92B13613B009CEF97 /* MarathonListResponseDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarathonListResponseDto.swift; sourceTree = ""; }; 717916DD2B137DC3009CEF97 /* TotalPageCountDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TotalPageCountDto.swift; sourceTree = ""; }; 71BAD0692B24CECC0061E31D /* UserProfileDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserProfileDto.swift; sourceTree = ""; }; @@ -196,7 +198,6 @@ 71F7804D2B0893B600B53253 /* MarathonTitleCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarathonTitleCollectionViewCell.swift; sourceTree = ""; }; 71F7804F2B0893D700B53253 /* MarathonMapCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarathonMapCollectionViewCell.swift; sourceTree = ""; }; 71F7BF062B0CDFE300B752B3 /* MarathonCourseListCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarathonCourseListCVC.swift; sourceTree = ""; }; - A3305A96296EF58C000B1A10 /* GoalRewardInfoDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoalRewardInfoDto.swift; sourceTree = ""; }; A3BC2F2A2962C3D500198261 /* GoalRewardInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoalRewardInfoVC.swift; sourceTree = ""; }; A3BC2F2C2962C3F200198261 /* ActivityRecordInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityRecordInfoVC.swift; sourceTree = ""; }; @@ -863,7 +864,7 @@ CE6655A9295D7FAA00C64E12 /* Network */, CE6655A8295D7F7D00C64E12 /* Presentation */, CE4545D6295D7AF5003201E1 /* Info.plist */, - 713BA40A2B218AF8009091A8 /* GoogleService-Info.plist */, + 713A98EF2B29DD9900189B3C /* GoogleService-Info.plist */, ); path = "Runnect-iOS"; sourceTree = ""; @@ -1319,7 +1320,7 @@ files = ( CE665615295D989A00C64E12 /* .swiftlint.yml in Resources */, CE17F0342961BEF800E1DED0 /* Pretendard-Bold.otf in Resources */, - 713BA40B2B218AF8009091A8 /* GoogleService-Info.plist in Resources */, + 713A98F02B29DD9900189B3C /* GoogleService-Info.plist in Resources */, CE17F0352961BEF800E1DED0 /* Pretendard-SemiBold.otf in Resources */, CE17F0332961BEF800E1DED0 /* Pretendard-Medium.otf in Resources */, CE6655BF295D82E200C64E12 /* .gitkeep in Resources */, From 7585a0c62088658a1494824ef9a0c977704f091a Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Thu, 14 Dec 2023 00:02:59 +0900 Subject: [PATCH 07/17] =?UTF-8?q?[Feat]=20#224=20-=20setMarathonCourseSele?= =?UTF-8?q?ction=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit courseList[indexPath.item] 를 가져왔기 때문에, 자연스럽지 못했는데 그 부분을 marathonCourseList로 바꾸어 해결 하였습니다. --- .../ResponseDto/MarathonListResponseDto.swift | 2 +- .../CourseDetail/VC/CourseDetailVC.swift | 2 +- .../Views/MarathonMapCollectionViewCell.swift | 24 +++++++++---------- .../Views/VC/CourseDiscoveryVC.swift | 13 ++++++---- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDiscoveryDto/ResponseDto/MarathonListResponseDto.swift b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDiscoveryDto/ResponseDto/MarathonListResponseDto.swift index 7f25ef11..98aa9bf4 100644 --- a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDiscoveryDto/ResponseDto/MarathonListResponseDto.swift +++ b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDiscoveryDto/ResponseDto/MarathonListResponseDto.swift @@ -19,7 +19,7 @@ struct marathonCourse: Codable { let id, courseId: Int let title: String let image: String - let scrap: Bool? + var scrap: Bool? let departure: MarathonDeparture } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index 0a2b67bc..0778c6b8 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -159,7 +159,7 @@ extension CourseDetailVC { guard let publicCourseId = publicCourseId else { return } scrapCourse(scrapTF: !sender.isSelected) - delegate?.didUpdateScrapState(publicCourseId: publicCourseId, isScrapped: !sender.isSelected) + delegate?.didUpdateScrapState(publicCourseId: publicCourseId, isScrapped: !sender.isSelected) /// UI Update 부분 /// 누른상태(true)에서 누르면 스크랩 취소(false) 하는 이벤트, 즉 -1 let toggle = sender.isSelected ? -1 : 1 diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonMapCollectionViewCell.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonMapCollectionViewCell.swift index 03d718a9..a45dd921 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonMapCollectionViewCell.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonMapCollectionViewCell.swift @@ -17,8 +17,12 @@ class CourseSelectionPublisher { } class MarathonMapCollectionViewCell: UICollectionViewCell { + // MARK: - Properties + private let PublicCourseProvider = Providers.publicCourseProvider - private var marathonCourseList = [marathonCourse]() + var marathonCourseList = [marathonCourse]() // Cell 사용하는 곳에서 사용 중이라 private ❌ + + // MARK: - UIComponents private lazy var marathonCollectionView: UICollectionView = { let layout = UICollectionViewFlowLayout() @@ -50,25 +54,23 @@ class MarathonMapCollectionViewCell: UICollectionViewCell { } } - - // MARK: - Method +// MARK: - Method extension MarathonMapCollectionViewCell { - private func setDelegate() { marathonCollectionView.delegate = self marathonCollectionView.dataSource = self } + private func register() { marathonCollectionView.register(CourseListCVC.self, forCellWithReuseIdentifier: CourseListCVC.className) } } +// MARK: - Layout Helpers + extension MarathonMapCollectionViewCell { - - // MARK: - Layout Helpers - private func setLayout() { contentView.backgroundColor = .clear contentView.addSubview(marathonCollectionView) @@ -84,9 +86,8 @@ extension MarathonMapCollectionViewCell { self.marathonCourseList = marathonCourseList marathonCollectionView.reloadData() } - } - // MARK: - UICollectionViewDelegate, UICollectionViewDataSource +// MARK: - UICollectionViewDelegate, UICollectionViewDataSource extension MarathonMapCollectionViewCell: UICollectionViewDelegate, UICollectionViewDataSource { func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { @@ -105,7 +106,7 @@ extension MarathonMapCollectionViewCell: UICollectionViewDelegate, UICollectionV } } - // MARK: - UICollectionViewDelegateFlowLayout +// MARK: - UICollectionViewDelegateFlowLayout extension MarathonMapCollectionViewCell: UICollectionViewDelegateFlowLayout { func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { @@ -133,8 +134,7 @@ extension MarathonMapCollectionViewCell: UICollectionViewDelegateFlowLayout { } - - // MARK: - NetWork +// MARK: - NetWork extension MarathonMapCollectionViewCell { private func getMarathonCourseData() { diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift index e6c5fa41..57054dc7 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift @@ -336,11 +336,14 @@ extension CourseDiscoveryVC: UICollectionViewDelegateFlowLayout { // 외부에서 Marathon Cell에서 받아오는 indexPath를 처리 합니다. private func setMarathonCourseSelection(at indexPath: IndexPath) { - let courseDetailVC = CourseDetailVC() - let courseModel = courseList[indexPath.item] - courseDetailVC.setCourseId(courseId: courseModel.courseId, publicCourseId: courseModel.id) - courseDetailVC.hidesBottomBarWhenPushed = true - navigationController?.pushViewController(courseDetailVC, animated: true) + if let marathonCell = mapCollectionView.cellForItem(at: IndexPath(item: 0, section: Section.recommendedList)) as? MarathonMapCollectionViewCell { + let marathonCourseList = marathonCell.marathonCourseList + let courseDetailVC = CourseDetailVC() + let courseModel = marathonCourseList[indexPath.item] + courseDetailVC.setCourseId(courseId: courseModel.courseId, publicCourseId: courseModel.id) + courseDetailVC.hidesBottomBarWhenPushed = true + navigationController?.pushViewController(courseDetailVC, animated: true) + } } } From 58547cd0f5df4beee40b3ad89b01ac75577e0230 Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Thu, 14 Dec 2023 00:25:42 +0900 Subject: [PATCH 08/17] =?UTF-8?q?[Chore]=20#224=20-=20totalPage=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit course와 함께 전체 페이지를 보내는 API로 바뀌어서 필요없는 코드는 삭제 합니다. --- .../Runnect-iOS.xcodeproj/project.pbxproj | 4 --- .../ResponseDto/TotalPageCountDto.swift | 14 ---------- .../Network/Router/PublicCourseRouter.swift | 9 ++---- .../Views/VC/CourseDiscoveryVC.swift | 28 ------------------- 4 files changed, 3 insertions(+), 52 deletions(-) delete mode 100644 Runnect-iOS/Runnect-iOS/Network/Dto/CourseDiscoveryDto/ResponseDto/TotalPageCountDto.swift diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index 83bc27ff..273afdf6 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -20,7 +20,6 @@ 7136BF8A2AF921A900679364 /* CustomBottomSheetVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7136BF892AF921A900679364 /* CustomBottomSheetVC.swift */; }; 713A98F02B29DD9900189B3C /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 713A98EF2B29DD9900189B3C /* GoogleService-Info.plist */; }; 717916DA2B13613B009CEF97 /* MarathonListResponseDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 717916D92B13613B009CEF97 /* MarathonListResponseDto.swift */; }; - 717916DE2B137DC3009CEF97 /* TotalPageCountDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 717916DD2B137DC3009CEF97 /* TotalPageCountDto.swift */; }; 71BAD06A2B24CECC0061E31D /* UserProfileDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71BAD0692B24CECC0061E31D /* UserProfileDto.swift */; }; 71BAD06C2B24D1F70061E31D /* UserProfileVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71BAD06B2B24D1F70061E31D /* UserProfileVC.swift */; }; 71F7804E2B0893B600B53253 /* MarathonTitleCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71F7804D2B0893B600B53253 /* MarathonTitleCollectionViewCell.swift */; }; @@ -192,7 +191,6 @@ 7136BF892AF921A900679364 /* CustomBottomSheetVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomBottomSheetVC.swift; sourceTree = ""; }; 713A98EF2B29DD9900189B3C /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 717916D92B13613B009CEF97 /* MarathonListResponseDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarathonListResponseDto.swift; sourceTree = ""; }; - 717916DD2B137DC3009CEF97 /* TotalPageCountDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TotalPageCountDto.swift; sourceTree = ""; }; 71BAD0692B24CECC0061E31D /* UserProfileDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserProfileDto.swift; sourceTree = ""; }; 71BAD06B2B24D1F70061E31D /* UserProfileVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserProfileVC.swift; sourceTree = ""; }; 71F7804D2B0893B600B53253 /* MarathonTitleCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarathonTitleCollectionViewCell.swift; sourceTree = ""; }; @@ -1252,7 +1250,6 @@ children = ( 717916D92B13613B009CEF97 /* MarathonListResponseDto.swift */, DAD5A3E1296D4C6500C8166B /* PickedMapListResponseDto.swift */, - 717916DD2B137DC3009CEF97 /* TotalPageCountDto.swift */, ); path = ResponseDto; sourceTree = ""; @@ -1498,7 +1495,6 @@ CE1006572968230800FD31FB /* DepartureLocationModel.swift in Sources */, CECA695C296E61D6002AF05C /* PrivateCourseNotUploadedResponseDto.swift in Sources */, CE6655EC295D88D000C64E12 /* UITableView+.swift in Sources */, - 717916DE2B137DC3009CEF97 /* TotalPageCountDto.swift in Sources */, CEEC6B3A2961C4F300D00E1E /* CourseDrawingHomeVC.swift in Sources */, CEB0BCBC29D123350048CCD5 /* GuideView.swift in Sources */, CEC2A6902962B06C00160BF7 /* convertLocationObject.swift in Sources */, diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDiscoveryDto/ResponseDto/TotalPageCountDto.swift b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDiscoveryDto/ResponseDto/TotalPageCountDto.swift deleted file mode 100644 index f0f1f3e2..00000000 --- a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDiscoveryDto/ResponseDto/TotalPageCountDto.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// TotalPageCountDto.swift -// Runnect-iOS -// -// Created by 이명진 on 11/26/23. -// - -import Foundation - -// MARK: - TotalPageCountDto - -struct TotalPageCountDto: Codable { - let totalPageCount: Int -} diff --git a/Runnect-iOS/Runnect-iOS/Network/Router/PublicCourseRouter.swift b/Runnect-iOS/Runnect-iOS/Network/Router/PublicCourseRouter.swift index f992f25c..321f2005 100644 --- a/Runnect-iOS/Runnect-iOS/Network/Router/PublicCourseRouter.swift +++ b/Runnect-iOS/Runnect-iOS/Network/Router/PublicCourseRouter.swift @@ -12,7 +12,6 @@ enum PublicCourseRouter { case getCourseData(pageNo: Int, sort: String) case getCourseSearchData(keyword: String) case getMarathonCourseData - case getTotalPageCount case courseUploadingData(param: CourseUploadingRequestDto) case getUploadedCourseDetail(publicCourseId: Int) case getUploadedCourseInfo @@ -37,8 +36,6 @@ extension PublicCourseRouter: TargetType { return "/public-course/marathon" case .getCourseSearchData: return "/public-course/search" - case .getTotalPageCount: - return "public-course/total-page-count" case .getUploadedCourseDetail(let publicCourseId): return "/public-course/detail/\(publicCourseId)" case .getUploadedCourseInfo: @@ -52,7 +49,7 @@ extension PublicCourseRouter: TargetType { var method: Moya.Method { switch self { - case .getCourseData, .getCourseSearchData, .getMarathonCourseData, .getUploadedCourseDetail, .getUploadedCourseInfo, .getTotalPageCount: + case .getCourseData, .getCourseSearchData, .getMarathonCourseData, .getUploadedCourseDetail, .getUploadedCourseInfo: return .get case .courseUploadingData: return .post @@ -66,7 +63,7 @@ extension PublicCourseRouter: TargetType { var task: Moya.Task { switch self { case .getCourseData(let pageNo, let sort): - var parameters: [String: Any] = ["pageNo": pageNo, "sort": sort] + let parameters: [String: Any] = ["pageNo": pageNo, "sort": sort] return .requestParameters(parameters: parameters, encoding: URLEncoding.default) case .getCourseSearchData(let keyword): return .requestParameters(parameters: ["keyword": keyword], encoding: URLEncoding.default) @@ -82,7 +79,7 @@ extension PublicCourseRouter: TargetType { fatalError("Encoding 실패")} case .deleteUploadedCourse(let publicCourseIdList): return .requestParameters(parameters: ["publicCourseIdList": publicCourseIdList], encoding: JSONEncoding.default) - case .getMarathonCourseData, .getTotalPageCount, .getUploadedCourseDetail, .getUploadedCourseInfo: + case .getMarathonCourseData, .getUploadedCourseDetail, .getUploadedCourseInfo: return .requestPlain } } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift index 57054dc7..b3b30f82 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift @@ -481,34 +481,6 @@ extension CourseDiscoveryVC { } } - private func getTotalPageNum() { - LoadingIndicator.showLoading() - publicCourseProvider.request(.getTotalPageCount) { response in - LoadingIndicator.hideLoading() - switch response { - case .success(let result): - let status = result.statusCode - if 200..<300 ~= status { - do { - let responseDto = try result.map(BaseResponse.self) - guard let data = responseDto.data else { return } - self.totalPageNum = data.totalPageCount - print("추천 코스의 코스의 수는 \(self.totalPageNum) 입니다. 🏃‍♀️\n") - } catch { - print(error.localizedDescription) - } - } - if status >= 400 { - print("400 error") - self.showNetworkFailureToast() - } - case .failure(let error): - print(error.localizedDescription) - self.showNetworkFailureToast() - } - } - } - private func scrapCourse(publicCourseId: Int, scrapTF: Bool) { LoadingIndicator.showLoading() scrapProvider.request(.createAndDeleteScrap(publicCourseId: publicCourseId, scrapTF: scrapTF)) { [weak self] response in From 5511b75328027cda0811940c84d8612c0682cd29 Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Thu, 14 Dec 2023 03:15:06 +0900 Subject: [PATCH 09/17] =?UTF-8?q?[Chore]=20#224=20-=20=EC=83=81=EC=86=8D?= =?UTF-8?q?=20=EC=97=86=EB=8A=94=20=ED=81=B4=EB=9E=98=EC=8A=A4=20final=20?= =?UTF-8?q?=EC=84=A0=EC=96=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CourseDiscovery/Views/AdImageCollectionViewCell.swift | 2 +- .../CourseDiscovery/Views/MapCollectionViewCell.swift | 2 +- .../Views/MarathonMapCollectionViewCell.swift | 2 +- .../Views/MarathonTitleCollectionViewCell.swift | 2 +- .../CourseDiscovery/Views/TitleCollectionViewCell.swift | 2 +- .../UserProfile/CollectionViewCell/UserInfoCell.swift | 2 +- .../UserProfile/CollectionViewCell/UserProgressCell.swift | 2 +- .../CollectionViewCell/UserUploadedLabelCell.swift | 6 ++---- 8 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/AdImageCollectionViewCell.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/AdImageCollectionViewCell.swift index 97142a43..8b9ff2c2 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/AdImageCollectionViewCell.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/AdImageCollectionViewCell.swift @@ -10,7 +10,7 @@ import SnapKit import Then -class AdImageCollectionViewCell: UICollectionViewCell, UIScrollViewDelegate { +final class AdImageCollectionViewCell: UICollectionViewCell, UIScrollViewDelegate { // MARK: - collectionview diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MapCollectionViewCell.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MapCollectionViewCell.swift index 13a7fb7b..61f50ec6 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MapCollectionViewCell.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MapCollectionViewCell.swift @@ -14,7 +14,7 @@ import SnapKit import Then -class MapCollectionViewCell: UICollectionViewCell { +final class MapCollectionViewCell: UICollectionViewCell { // MARK: - collectionview diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonMapCollectionViewCell.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonMapCollectionViewCell.swift index a45dd921..b8b2a061 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonMapCollectionViewCell.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonMapCollectionViewCell.swift @@ -16,7 +16,7 @@ class CourseSelectionPublisher { let didSelectCourse = PassthroughSubject() } -class MarathonMapCollectionViewCell: UICollectionViewCell { +final class MarathonMapCollectionViewCell: UICollectionViewCell { // MARK: - Properties private let PublicCourseProvider = Providers.publicCourseProvider diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonTitleCollectionViewCell.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonTitleCollectionViewCell.swift index 7ba7c535..789bdd75 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonTitleCollectionViewCell.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonTitleCollectionViewCell.swift @@ -7,7 +7,7 @@ import UIKit -class MarathonTitleCollectionViewCell: UICollectionViewCell { +final class MarathonTitleCollectionViewCell: UICollectionViewCell { // MARK: - UI Components diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/TitleCollectionViewCell.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/TitleCollectionViewCell.swift index a52bb527..e5dd62e0 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/TitleCollectionViewCell.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/TitleCollectionViewCell.swift @@ -12,7 +12,7 @@ protocol TitleCollectionViewCellDelegate: AnyObject { func didTapSortButton(ordering: String) } -class TitleCollectionViewCell: UICollectionViewCell { +final class TitleCollectionViewCell: UICollectionViewCell { private var cancellables: Set = [] weak var delegate: TitleCollectionViewCellDelegate? diff --git a/Runnect-iOS/Runnect-iOS/Presentation/UserProfile/CollectionViewCell/UserInfoCell.swift b/Runnect-iOS/Runnect-iOS/Presentation/UserProfile/CollectionViewCell/UserInfoCell.swift index ebc265be..a9b86340 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/UserProfile/CollectionViewCell/UserInfoCell.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/UserProfile/CollectionViewCell/UserInfoCell.swift @@ -7,7 +7,7 @@ import UIKit -class UserInfoCell: UICollectionViewCell { +final class UserInfoCell: UICollectionViewCell { // MARK: - properties diff --git a/Runnect-iOS/Runnect-iOS/Presentation/UserProfile/CollectionViewCell/UserProgressCell.swift b/Runnect-iOS/Runnect-iOS/Presentation/UserProfile/CollectionViewCell/UserProgressCell.swift index 8a5e8b30..eaff4e3e 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/UserProfile/CollectionViewCell/UserProgressCell.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/UserProfile/CollectionViewCell/UserProgressCell.swift @@ -7,7 +7,7 @@ import UIKit -class UserProgressCell: UICollectionViewCell { +final class UserProgressCell: UICollectionViewCell { // MARK: - properties diff --git a/Runnect-iOS/Runnect-iOS/Presentation/UserProfile/CollectionViewCell/UserUploadedLabelCell.swift b/Runnect-iOS/Runnect-iOS/Presentation/UserProfile/CollectionViewCell/UserUploadedLabelCell.swift index 9e62bb13..f30b3a0f 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/UserProfile/CollectionViewCell/UserUploadedLabelCell.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/UserProfile/CollectionViewCell/UserUploadedLabelCell.swift @@ -7,7 +7,7 @@ import UIKit -class UserUploadedLabelCell: UICollectionViewCell { +final class UserUploadedLabelCell: UICollectionViewCell { // MARK: - UI Components private lazy var uploadedCourseInfoLabelView = makeInfoView(title: "업로드한 코스") @@ -23,8 +23,7 @@ class UserUploadedLabelCell: UICollectionViewCell { } } - -// MARK: - Layout Helpers + // MARK: - Layout Helpers extension UserUploadedLabelCell { @@ -66,4 +65,3 @@ extension UserUploadedLabelCell { return containerView } } - From 2ba04187f0ffac1ce4f52b4725e0e97d5ae78a56 Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Thu, 14 Dec 2023 03:21:11 +0900 Subject: [PATCH 10/17] =?UTF-8?q?[Chore]=20#224=20-=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=ED=95=98=EC=A7=80=20=EC=95=8A=EC=9D=80=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runnect-iOS.xcodeproj/project.pbxproj | 8 - .../Views/MapCollectionViewCell.swift | 118 ---------- .../Views/CVC/MarathonCourseListCVC.swift | 202 ------------------ 3 files changed, 328 deletions(-) delete mode 100644 Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MapCollectionViewCell.swift delete mode 100644 Runnect-iOS/Runnect-iOS/Presentation/CourseStorage/Views/CVC/MarathonCourseListCVC.swift diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index 273afdf6..e1b82b4d 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -24,7 +24,6 @@ 71BAD06C2B24D1F70061E31D /* UserProfileVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71BAD06B2B24D1F70061E31D /* UserProfileVC.swift */; }; 71F7804E2B0893B600B53253 /* MarathonTitleCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71F7804D2B0893B600B53253 /* MarathonTitleCollectionViewCell.swift */; }; 71F780502B0893D700B53253 /* MarathonMapCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71F7804F2B0893D700B53253 /* MarathonMapCollectionViewCell.swift */; }; - 71F7BF072B0CDFE300B752B3 /* MarathonCourseListCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71F7BF062B0CDFE300B752B3 /* MarathonCourseListCVC.swift */; }; A3305A97296EF58C000B1A10 /* GoalRewardInfoDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3305A96296EF58C000B1A10 /* GoalRewardInfoDto.swift */; }; A3BC2F2B2962C3D500198261 /* GoalRewardInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F2A2962C3D500198261 /* GoalRewardInfoVC.swift */; }; A3BC2F2D2962C3F200198261 /* ActivityRecordInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F2C2962C3F200198261 /* ActivityRecordInfoVC.swift */; }; @@ -171,7 +170,6 @@ DA97A033296E65D80086760E /* CourseUploadingRequestDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA97A032296E65D80086760E /* CourseUploadingRequestDto.swift */; }; DAD5A3D8296C6D9600C8166B /* AdImageCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAD5A3D7296C6D9600C8166B /* AdImageCollectionViewCell.swift */; }; DAD5A3DA296C6DA500C8166B /* TitleCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAD5A3D9296C6DA500C8166B /* TitleCollectionViewCell.swift */; }; - DAD5A3DC296C6DB800C8166B /* MapCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAD5A3DB296C6DB800C8166B /* MapCollectionViewCell.swift */; }; DAD5A3E2296D4C6500C8166B /* PickedMapListResponseDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAD5A3E1296D4C6500C8166B /* PickedMapListResponseDto.swift */; }; /* End PBXBuildFile section */ @@ -195,7 +193,6 @@ 71BAD06B2B24D1F70061E31D /* UserProfileVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserProfileVC.swift; sourceTree = ""; }; 71F7804D2B0893B600B53253 /* MarathonTitleCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarathonTitleCollectionViewCell.swift; sourceTree = ""; }; 71F7804F2B0893D700B53253 /* MarathonMapCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarathonMapCollectionViewCell.swift; sourceTree = ""; }; - 71F7BF062B0CDFE300B752B3 /* MarathonCourseListCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarathonCourseListCVC.swift; sourceTree = ""; }; A3305A96296EF58C000B1A10 /* GoalRewardInfoDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoalRewardInfoDto.swift; sourceTree = ""; }; A3BC2F2A2962C3D500198261 /* GoalRewardInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoalRewardInfoVC.swift; sourceTree = ""; }; A3BC2F2C2962C3F200198261 /* ActivityRecordInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityRecordInfoVC.swift; sourceTree = ""; }; @@ -354,7 +351,6 @@ DA97A032296E65D80086760E /* CourseUploadingRequestDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourseUploadingRequestDto.swift; sourceTree = ""; }; DAD5A3D7296C6D9600C8166B /* AdImageCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdImageCollectionViewCell.swift; sourceTree = ""; }; DAD5A3D9296C6DA500C8166B /* TitleCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TitleCollectionViewCell.swift; sourceTree = ""; }; - DAD5A3DB296C6DB800C8166B /* MapCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapCollectionViewCell.swift; sourceTree = ""; }; DAD5A3E1296D4C6500C8166B /* PickedMapListResponseDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PickedMapListResponseDto.swift; sourceTree = ""; }; E837271A78E1C0A0C30789BF /* Pods-Runnect-iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runnect-iOS.release.xcconfig"; path = "Target Support Files/Pods-Runnect-iOS/Pods-Runnect-iOS.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -765,7 +761,6 @@ 71F7804D2B0893B600B53253 /* MarathonTitleCollectionViewCell.swift */, 71F7804F2B0893D700B53253 /* MarathonMapCollectionViewCell.swift */, DAD5A3D9296C6DA500C8166B /* TitleCollectionViewCell.swift */, - DAD5A3DB296C6DB800C8166B /* MapCollectionViewCell.swift */, CE17F0432961C3D600E1DED0 /* VC */, ); path = Views; @@ -1197,7 +1192,6 @@ isa = PBXGroup; children = ( CE6B63D2296725E6003F900F /* CourseListCVC.swift */, - 71F7BF062B0CDFE300B752B3 /* MarathonCourseListCVC.swift */, ); path = CVC; sourceTree = ""; @@ -1490,7 +1484,6 @@ A3D1A77E29CF09B600DD54EC /* SignInResponseDto.swift in Sources */, CE21C028299E5FFC00F62AF5 /* PublicCourseRouter.swift in Sources */, CE18E894296C79B900FEB569 /* CourseDrawingRequestDto.swift in Sources */, - 71F7BF072B0CDFE300B752B3 /* MarathonCourseListCVC.swift in Sources */, DA20D84E2966A9B300F1581F /* CourseSearchVC.swift in Sources */, CE1006572968230800FD31FB /* DepartureLocationModel.swift in Sources */, CECA695C296E61D6002AF05C /* PrivateCourseNotUploadedResponseDto.swift in Sources */, @@ -1512,7 +1505,6 @@ CE665608295D921500C64E12 /* setImage.swift in Sources */, CE146770296568DC00DCEA1B /* RunTrackingVC.swift in Sources */, DA20D849296697B400F1581F /* CourseUploadVC.swift in Sources */, - DAD5A3DC296C6DB800C8166B /* MapCollectionViewCell.swift in Sources */, CE665612295D92E400C64E12 /* UserDefaultWrapper.swift in Sources */, A3BC2F3A2963D0ED00198261 /* ActivityRecordInfoTVC.swift in Sources */, CE665610295D92C200C64E12 /* setTextLineHeight.swift in Sources */, diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MapCollectionViewCell.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MapCollectionViewCell.swift deleted file mode 100644 index 61f50ec6..00000000 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MapCollectionViewCell.swift +++ /dev/null @@ -1,118 +0,0 @@ -// -// CollectionViewCell.swift -// Runnect-iOS -// -// Created by YEONOO on 2023/01/10. -// - -/// 여기 있는 코드는 사용되지 않습니다. -/// CourseDiscoveryVC에 따로 선언 되어있습니다. -/// 추가 사용안할시 삭제 예정 - -import UIKit -import SnapKit - -import Then - -final class MapCollectionViewCell: UICollectionViewCell { - - // MARK: - collectionview - - private lazy var mapCollectionView: UICollectionView = { - let layout = UICollectionViewFlowLayout() - layout.scrollDirection = .vertical - - let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout) - collectionView.backgroundColor = .clear - collectionView.translatesAutoresizingMaskIntoConstraints = false - collectionView.isScrollEnabled = false - collectionView.showsVerticalScrollIndicator = false - return collectionView - }() - - // MARK: - Constants - - final let collectionViewInset = UIEdgeInsets(top: 28, left: 16, bottom: 28, right: 16) - final let itemSpacing: CGFloat = 10 - final let lineSpacing: CGFloat = 20 - - // MARK: - Life cycle - override init(frame: CGRect) { - super.init(frame: frame) - setLayout() - register() - setDelegate() - } - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } -} - -extension MapCollectionViewCell { - - private func setDelegate() { - mapCollectionView.delegate = self - mapCollectionView.dataSource = self - } - private func register() { - mapCollectionView.register(CourseListCVC.self, - forCellWithReuseIdentifier: CourseListCVC.className) - } -} - -extension MapCollectionViewCell { - - // MARK: - Layout Helpers - - private func setLayout() { - contentView.backgroundColor = .clear - contentView.addSubview(mapCollectionView) - mapCollectionView.snp.makeConstraints { - $0.top.equalToSuperview() - $0.leading.trailing.equalTo(contentView.safeAreaLayoutGuide) - $0.bottom.equalToSuperview() - // $0.height.equalTo(1000) - } - } - - -} -// MARK: - UICollectionViewDelegate, UICollectionViewDataSource - -extension MapCollectionViewCell: UICollectionViewDelegate, UICollectionViewDataSource { - func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - return 15 - } - - func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CourseListCVC.className, - for: indexPath) - as? CourseListCVC else { return UICollectionViewCell() } - cell.setCellType(type: .all) - return cell - } -} - -// MARK: - UICollectionViewDelegateFlowLayout - -extension MapCollectionViewCell: UICollectionViewDelegateFlowLayout { - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { - let cellWidth = (UIScreen.main.bounds.width - (self.itemSpacing + 2*self.collectionViewInset.left)) / 2 - let cellHeight = CourseListCVCType.getCellHeight(type: .all, cellWidth: cellWidth) - - return CGSize(width: cellWidth, height: cellHeight) - } - - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { - return self.collectionViewInset - } - - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { - return self.itemSpacing - } - - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { - return self.lineSpacing - } - -} diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseStorage/Views/CVC/MarathonCourseListCVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseStorage/Views/CVC/MarathonCourseListCVC.swift deleted file mode 100644 index 97981b83..00000000 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseStorage/Views/CVC/MarathonCourseListCVC.swift +++ /dev/null @@ -1,202 +0,0 @@ -// -// MarathonCourseListCVC.swift -// Runnect-iOS -// -// Created by 이명진 on 11/21/23. -// - -import UIKit - -protocol MarathonCourseListCVCDeleagte: AnyObject { - func likeButtonTapped(wantsTolike: Bool, index: Int) -} - -@frozen -enum MarathonCourseListCVCType { - case title - case titleWithLocation - case all - - static func getCellHeight(type: CourseListCVCType, cellWidth: CGFloat) -> CGFloat { - let imageHeight = cellWidth * (111/156) - switch type { - case .title: - return imageHeight + 24 - case .titleWithLocation, .all: - return imageHeight + 40 - } - } -} - -final class MarathonCourseListCVC: UICollectionViewCell { - - // MARK: - Properties - - weak var delegate: MarathonCourseListCVCDeleagte? - - private var indexPath: Int? - - // MARK: - UI Components - - private let courseImageView = UIImageView().then { - $0.backgroundColor = .g3 - $0.contentMode = .scaleToFill - $0.layer.cornerRadius = 5 - $0.clipsToBounds = true - } - - private let imageCoverView = UIImageView().then { - $0.backgroundColor = .m1.withAlphaComponent(0.2) - $0.layer.cornerRadius = 5 - $0.isHidden = true - } - - private let titleLabel = UILabel().then { - $0.text = "제목" - $0.font = .b4 - $0.textColor = .g1 - } - - private let locationLabel = UILabel().then { - $0.text = "위치" - $0.font = .b6 - $0.textColor = .g2 - } - - private lazy var labelStackView = UIStackView( - arrangedSubviews: [titleLabel, locationLabel] - ).then { - $0.axis = .vertical - $0.alignment = .leading - } - - private let likeButton = UIButton(type: .custom).then { - $0.setImage(ImageLiterals.icHeartFill, for: .selected) - $0.setImage(ImageLiterals.icHeart, for: .normal) - $0.backgroundColor = .w1 - } - - private let selectIndicatorButton = UIButton(type: .custom).then { - $0.setImage(ImageLiterals.icCheckFill, for: .selected) - $0.setImage(ImageLiterals.icCheck, for: .normal) - $0.isSelected = false - $0.isHidden = true - } - - // MARK: - initialization - - override init(frame: CGRect) { - super.init(frame: frame) - self.setUI() - self.setLayout() - self.setAddTarget() - - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } -} - -// MARK: - Methods - -extension MarathonCourseListCVC { - private func setAddTarget() { - likeButton.addTarget(self, action: #selector(likeButtonDidTap), for: .touchUpInside) - } - - func setData(imageURL: String, title: String, location: String?, didLike: Bool?, indexPath: Int? = nil, isEditMode: Bool = false) { - self.courseImageView.setImage(with: imageURL) - self.titleLabel.text = title - self.indexPath = indexPath - if let location = location { - self.locationLabel.text = location - } - if let didLike = didLike { - self.likeButton.isSelected = didLike - } - self.selectIndicatorButton.isHidden = !isEditMode - } - - func selectCell(didSelect: Bool) { - if didSelect { - courseImageView.layer.borderColor = UIColor.m1.cgColor - courseImageView.layer.borderWidth = 2 - imageCoverView.isHidden = false - selectIndicatorButton.isSelected = true - } else { - courseImageView.layer.borderColor = UIColor.clear.cgColor - imageCoverView.isHidden = true - selectIndicatorButton.isSelected = false - - } - } -} - -// MARK: - @objc Function - -extension MarathonCourseListCVC { - @objc func likeButtonDidTap(_ sender: UIButton) { - guard let indexPath = self.indexPath else { return } - if UserManager.shared.userType != .visitor { - sender.isSelected.toggle() - } - delegate?.likeButtonTapped(wantsTolike: (sender.isSelected == true), index: indexPath) - } -} - -// MARK: - UI & Layout - -extension MarathonCourseListCVC { - private func setUI() { - self.contentView.backgroundColor = .w1 - } - - private func setLayout() { - self.contentView.addSubviews(courseImageView, imageCoverView, labelStackView, likeButton, selectIndicatorButton) - - courseImageView.snp.makeConstraints { make in - make.leading.top.trailing.equalToSuperview() - let imageHeight = contentView.frame.width * (111/156) - make.height.equalTo(imageHeight) - } - - imageCoverView.snp.makeConstraints { make in - make.edges.equalTo(courseImageView) - } - - likeButton.snp.makeConstraints { make in - make.top.equalTo(courseImageView.snp.bottom).offset(4) - make.trailing.equalToSuperview() - make.width.equalTo(22) - make.height.equalTo(20) - } - - selectIndicatorButton.snp.makeConstraints { make in - make.top.leading.equalToSuperview().inset(8) - make.leading.equalToSuperview().offset(8) - make.width.equalTo(20) - make.height.equalTo(20) - } - - labelStackView.snp.makeConstraints { make in - make.top.equalTo(courseImageView.snp.bottom).offset(4) - make.leading.equalToSuperview() - make.width.equalTo(courseImageView.snp.width).multipliedBy(0.7) - } - } - - func setCellType(type: MarathonCourseListCVCType) { - switch type { - case .title: - self.locationLabel.isHidden = true - self.likeButton.isHidden = true - case .titleWithLocation: - self.locationLabel.isHidden = false - self.likeButton.isHidden = true - case .all: - self.locationLabel.isHidden = false - self.likeButton.isHidden = false - } - } -} From 79ad34e4a04f2508253292b67b41bc50435c1e22 Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Thu, 14 Dec 2023 04:21:04 +0900 Subject: [PATCH 11/17] =?UTF-8?q?[Fix]=20#224=20-=20=EB=A7=88=EC=9D=B4?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20UI=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/MyPage/VC/MyPageVC.swift | 182 +++++++++--------- 1 file changed, 88 insertions(+), 94 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/MyPageVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/MyPageVC.swift index a2ffebfa..fd188235 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/MyPageVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/MyPageVC.swift @@ -49,8 +49,8 @@ final class MyPageVC: UIViewController { $0.setImage(ImageLiterals.icEdit, for: .normal) $0.setTitle("수정하기", for: .normal) $0.titleLabel?.font = .b7 - $0.setTitleColor(.m2, for: .normal) - $0.tintColor = .m2 + $0.setTitleColor(.m1, for: .normal) + $0.tintColor = .m1 $0.layer.borderWidth = 1 $0.layer.borderColor = UIColor.m2.cgColor $0.layer.cornerRadius = 14 @@ -65,7 +65,7 @@ final class MyPageVC: UIViewController { $0.translatesAutoresizingMaskIntoConstraints = false $0.setProgress(0, animated: false) $0.progressTintColor = .m1 - $0.trackTintColor = .m3 + $0.trackTintColor = .m6 $0.layer.cornerRadius = 6 $0.clipsToBounds = true $0.layer.sublayers![1].cornerRadius = 6 @@ -278,7 +278,7 @@ extension MyPageVC { private func setUI() { view.backgroundColor = .w1 - myProfileView.backgroundColor = .m3 + myRunningProgressView.backgroundColor = .m3 firstDivideView.backgroundColor = .g5 secondDivideView.backgroundColor = .g4 thirdDivideView.backgroundColor = .g4 @@ -295,8 +295,8 @@ extension MyPageVC { } view.addSubviews(myProfileView, myRunningProgressView, firstDivideView, - activityRecordInfoView, secondDivideView, goalRewardInfoView, - thirdDivideView, uploadedCourseInfoView, fourthDivideView, settingView, fifthDivideView, kakaoChannelAsk) + activityRecordInfoView, secondDivideView, goalRewardInfoView, + thirdDivideView, uploadedCourseInfoView, fourthDivideView, settingView, fifthDivideView, kakaoChannelAsk) myProfileView.snp.makeConstraints { make in make.top.equalTo(navibar.snp.bottom).offset(6) @@ -307,12 +307,6 @@ extension MyPageVC { setMyProfileLayout() setRunningProgressLayout() - firstDivideView.snp.makeConstraints { make in - make.top.equalTo(myRunningProgressView.snp.bottom).offset(34) - make.leading.trailing.equalToSuperview() - make.height.equalTo(10) - } - setInfoButtonLayout() setVersionInfoLayout() } @@ -320,29 +314,29 @@ extension MyPageVC { private func setMyProfileLayout() { myProfileView.addSubviews(myProfileImage, myProfileNameLabel, myProfileEditButton) - myProfileImage.snp.makeConstraints { make in - make.top.equalToSuperview().offset(11) - make.leading.equalToSuperview().offset(23) - make.width.equalTo(63) - make.height.equalTo(63) + myProfileImage.snp.makeConstraints { + $0.top.equalToSuperview().offset(11) + $0.leading.equalToSuperview().offset(23) + $0.width.equalTo(63) + $0.height.equalTo(63) } - myProfileNameLabel.snp.makeConstraints { make in - make.top.equalToSuperview().offset(32) - make.leading.equalTo(myProfileImage.snp.trailing).offset(10) + myProfileNameLabel.snp.makeConstraints { + $0.top.equalToSuperview().offset(32) + $0.leading.equalTo(myProfileImage.snp.trailing).offset(10) } - myProfileEditButton.snp.makeConstraints { make in - make.top.equalToSuperview().offset(29) - make.trailing.equalToSuperview().inset(16) - make.width.equalTo(78) - make.height.equalTo(28) + myProfileEditButton.snp.makeConstraints { + $0.top.equalToSuperview().offset(29) + $0.trailing.equalToSuperview().inset(16) + $0.width.equalTo(78) + $0.height.equalTo(28) } - myRunningProgressView.snp.makeConstraints { make in - make.top.equalTo(myProfileView.snp.bottom).offset(31) - make.leading.trailing.equalToSuperview().inset(32) - make.height.equalTo(61) + myRunningProgressView.snp.makeConstraints { + $0.top.equalTo(myProfileView.snp.bottom) + $0.leading.trailing.equalToSuperview() + $0.height.equalTo(101) } } @@ -350,111 +344,111 @@ extension MyPageVC { myRunningProgressView.addSubviews(myRunningLevelLabel, myRunningProgressBar, myRunnigProgressPercentLabel) - myRunningLevelLabel.snp.makeConstraints { make in - make.top.equalToSuperview() - make.leading.equalToSuperview().offset(3) + myRunningLevelLabel.snp.makeConstraints { + $0.top.equalToSuperview().offset(20) + $0.leading.equalToSuperview().offset(36.53) } - myRunningProgressBar.snp.makeConstraints { make in - make.top.equalTo(myRunningLevelLabel.snp.bottom).offset(6) - make.leading.trailing.equalToSuperview() - make.height.equalTo(11) + myRunningProgressBar.snp.makeConstraints { + $0.top.equalTo(myRunningLevelLabel.snp.bottom).offset(6) + $0.leading.equalToSuperview().offset(36.53) + $0.trailing.equalToSuperview().inset(31.6) + $0.height.equalTo(11) } - myRunnigProgressPercentLabel.snp.makeConstraints { make in - make.bottom.equalToSuperview() - make.trailing.equalToSuperview() + myRunnigProgressPercentLabel.snp.makeConstraints { + $0.bottom.equalToSuperview().inset(20) + $0.trailing.equalToSuperview().inset(31.6) } } private func setInfoButtonLayout() { - activityRecordInfoView.snp.makeConstraints { make in - make.top.equalTo(firstDivideView.snp.bottom) - make.leading.trailing.equalToSuperview() - make.height.equalTo(60) + activityRecordInfoView.snp.makeConstraints { + $0.top.equalTo(myRunningProgressView.snp.bottom) + $0.leading.trailing.equalToSuperview() + $0.height.equalTo(60) } - secondDivideView.snp.makeConstraints { make in - make.top.equalTo(activityRecordInfoView.snp.bottom).offset(1) - make.leading.trailing.equalToSuperview() - make.height.equalTo(0.5) + secondDivideView.snp.makeConstraints { + $0.top.equalTo(activityRecordInfoView.snp.bottom).offset(1) + $0.leading.trailing.equalToSuperview() + $0.height.equalTo(0.5) } - goalRewardInfoView.snp.makeConstraints { make in - make.top.equalTo(secondDivideView.snp.bottom) - make.leading.trailing.equalToSuperview() - make.height.equalTo(60) + goalRewardInfoView.snp.makeConstraints { + $0.top.equalTo(secondDivideView.snp.bottom) + $0.leading.trailing.equalToSuperview() + $0.height.equalTo(60) } - thirdDivideView.snp.makeConstraints { make in - make.top.equalTo(goalRewardInfoView.snp.bottom).offset(1) - make.leading.trailing.equalToSuperview() - make.height.equalTo(0.5) + thirdDivideView.snp.makeConstraints { + $0.top.equalTo(goalRewardInfoView.snp.bottom).offset(1) + $0.leading.trailing.equalToSuperview() + $0.height.equalTo(0.5) } - uploadedCourseInfoView.snp.makeConstraints { make in - make.top.equalTo(thirdDivideView.snp.bottom) - make.leading.trailing.equalToSuperview() - make.height.equalTo(60) + uploadedCourseInfoView.snp.makeConstraints { + $0.top.equalTo(thirdDivideView.snp.bottom) + $0.leading.trailing.equalToSuperview() + $0.height.equalTo(60) } - fourthDivideView.snp.makeConstraints { make in - make.top.equalTo(uploadedCourseInfoView.snp.bottom).offset(1) - make.leading.trailing.equalToSuperview() - make.height.equalTo(0.5) + fourthDivideView.snp.makeConstraints { + $0.top.equalTo(uploadedCourseInfoView.snp.bottom).offset(1) + $0.leading.trailing.equalToSuperview() + $0.height.equalTo(0.5) } - settingView.snp.makeConstraints { make in - make.top.equalTo(fourthDivideView.snp.bottom) - make.leading.trailing.equalToSuperview() - make.height.equalTo(60) + settingView.snp.makeConstraints { + $0.top.equalTo(fourthDivideView.snp.bottom) + $0.leading.trailing.equalToSuperview() + $0.height.equalTo(60) } - fifthDivideView.snp.makeConstraints { make in - make.top.equalTo(settingView.snp.bottom).offset(1) - make.leading.trailing.equalToSuperview() - make.height.equalTo(0.5) + fifthDivideView.snp.makeConstraints { + $0.top.equalTo(settingView.snp.bottom).offset(1) + $0.leading.trailing.equalToSuperview() + $0.height.equalTo(0.5) } - kakaoChannelAsk.snp.makeConstraints { make in - make.top.equalTo(fifthDivideView.snp.bottom) - make.leading.trailing.equalToSuperview() - make.height.equalTo(62) + kakaoChannelAsk.snp.makeConstraints { + $0.top.equalTo(fifthDivideView.snp.bottom) + $0.leading.trailing.equalToSuperview() + $0.height.equalTo(62) } - } private func setVersionInfoLayout() { view.addSubviews(topVersionDivideView, versionInfoView, bottomVersionDivideView) - topVersionDivideView.snp.makeConstraints { make in - make.top.equalTo(kakaoChannelAsk.snp.bottom) - make.leading.trailing.equalToSuperview() - make.height.equalTo(4) + topVersionDivideView.snp.makeConstraints { + $0.top.equalTo(kakaoChannelAsk.snp.bottom) + $0.leading.trailing.equalToSuperview() + $0.height.equalTo(4) } - versionInfoView.snp.makeConstraints { make in - make.top.equalTo(kakaoChannelAsk.snp.bottom) - make.leading.trailing.equalToSuperview() - make.height.equalTo(62) + versionInfoView.snp.makeConstraints { + $0.top.equalTo(kakaoChannelAsk.snp.bottom) + $0.leading.trailing.equalToSuperview() + $0.height.equalTo(62) } - bottomVersionDivideView.snp.makeConstraints { make in - make.top.equalTo(versionInfoView.snp.bottom) - make.leading.trailing.equalToSuperview() - make.height.equalTo(4) + bottomVersionDivideView.snp.makeConstraints { + $0.top.equalTo(versionInfoView.snp.bottom) + $0.leading.trailing.equalToSuperview() + $0.height.equalTo(4) } versionInfoView.addSubviews(versionInfoLabel, versionInfoValueLabel) - versionInfoLabel.snp.makeConstraints { make in - make.centerY.equalToSuperview() - make.leading.equalToSuperview().offset(18) + versionInfoLabel.snp.makeConstraints { + $0.centerY.equalToSuperview() + $0.leading.equalToSuperview().offset(18) } - versionInfoValueLabel.snp.makeConstraints { make in - make.centerY.equalToSuperview() - make.trailing.equalToSuperview().inset(18) + versionInfoValueLabel.snp.makeConstraints { + $0.centerY.equalToSuperview() + $0.trailing.equalToSuperview().inset(18) } } } From f1073e955d56dc42084e0e9afa713670aa0bc8ce Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Thu, 14 Dec 2023 04:41:31 +0900 Subject: [PATCH 12/17] =?UTF-8?q?[Feat]=20#224=20-=20=EC=9C=A0=EC=A0=80=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=ED=95=84=20=ED=84=B0=EC=B9=98=20=EC=98=81?= =?UTF-8?q?=EC=97=AD=20=EC=8A=A4=ED=83=9D=EB=B7=B0=EB=A1=9C=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 유저 프로필 터치영역을 명세서에 맞게 수정 하였습니다. --- .../CourseDetail/VC/CourseDetailVC.swift | 149 +++++++++--------- 1 file changed, 77 insertions(+), 72 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index 0778c6b8..8b5bda1a 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -69,6 +69,15 @@ final class CourseDetailVC: UIViewController { $0.backgroundColor = .w1 } + private lazy var userProfileStackView = UIStackView( + arrangedSubviews: [profileImageView, profileNameLabel, runningLevelLabel] + ).then { + $0.axis = .horizontal + $0.alignment = .center + $0.spacing = 9 + $0.isUserInteractionEnabled = true + } + private lazy var startButton = CustomButton(title: "시작하기").then { $0.addTarget(self, action: #selector(startButtonDidTap), for: .touchUpInside) } @@ -85,7 +94,6 @@ final class CourseDetailVC: UIViewController { $0.text = "닉네임" $0.textColor = .g1 $0.font = .h5 - $0.isUserInteractionEnabled = true } private let runningLevelLabel = UILabel().then { @@ -317,7 +325,7 @@ extension CourseDetailVC { shareButton.addTarget(self, action: #selector(shareButtonTapped), for: .touchUpInside) let profileTouch = UITapGestureRecognizer(target: self, action: #selector(pushToUserProfileVC)) - profileNameLabel.addGestureRecognizer(profileTouch) + userProfileStackView.addGestureRecognizer(profileTouch) } private func pushToCountDownVC() { @@ -370,17 +378,20 @@ extension CourseDetailVC { view.addSubview(navibar) view.addSubview(moreButton) view.addSubview(shareButton) - navibar.snp.makeConstraints { make in - make.top.leading.trailing.equalTo(view.safeAreaLayoutGuide) - make.height.equalTo(48) + + navibar.snp.makeConstraints { + $0.top.leading.trailing.equalTo(view.safeAreaLayoutGuide) + $0.height.equalTo(48) } - moreButton.snp.makeConstraints { make in - make.trailing.equalTo(self.view.safeAreaLayoutGuide) - make.centerY.equalTo(navibar) + + moreButton.snp.makeConstraints { + $0.trailing.equalTo(self.view.safeAreaLayoutGuide) + $0.centerY.equalTo(navibar) } - shareButton.snp.makeConstraints { make in - make.trailing.trailing.equalTo(moreButton).offset(-50) - make.centerY.equalTo(navibar) + + shareButton.snp.makeConstraints { + $0.trailing.trailing.equalTo(moreButton).offset(-50) + $0.centerY.equalTo(navibar) } } @@ -397,99 +408,93 @@ extension CourseDetailVC { private func setLayout() { view.addSubviews(middleScorollView, thirdHorizontalDivideLine, bottomView) - bottomView.snp.makeConstraints { make in - make.bottom.leading.trailing.equalToSuperview() - make.height.equalTo(84) + bottomView.snp.makeConstraints { + $0.bottom.leading.trailing.equalToSuperview() + $0.height.equalTo(84) } - thirdHorizontalDivideLine.snp.makeConstraints { make in - make.bottom.equalTo(bottomView.snp.top) - make.leading.trailing.equalTo(view.safeAreaLayoutGuide) - make.height.equalTo(0.5) + thirdHorizontalDivideLine.snp.makeConstraints { + $0.bottom.equalTo(bottomView.snp.top) + $0.leading.trailing.equalTo(view.safeAreaLayoutGuide) + $0.height.equalTo(0.5) } bottomView.addSubviews(likeButton, startButton, scrapCountLabel) - likeButton.snp.makeConstraints { make in - make.top.equalToSuperview().offset(13) - make.leading.equalToSuperview().offset(26) - make.width.equalTo(24) - make.height.equalTo(22) + likeButton.snp.makeConstraints { + $0.top.equalToSuperview().offset(13) + $0.leading.equalToSuperview().offset(26) + $0.width.equalTo(24) + $0.height.equalTo(22) } - scrapCountLabel.snp.makeConstraints { make in - make.top.equalTo(likeButton.snp.bottom).offset(2) - make.leading.equalToSuperview().offset(26) - make.width.equalTo(20) - make.height.equalTo(13) + scrapCountLabel.snp.makeConstraints { + $0.top.equalTo(likeButton.snp.bottom).offset(2) + $0.leading.equalToSuperview().offset(26) + $0.width.equalTo(20) + $0.height.equalTo(13) } - startButton.snp.makeConstraints { make in - make.leading.equalTo(likeButton.snp.trailing).offset(20) - make.top.equalToSuperview().offset(10) - make.trailing.equalToSuperview().inset(16) - make.height.equalTo(40) + + startButton.snp.makeConstraints { + $0.leading.equalTo(likeButton.snp.trailing).offset(20) + $0.top.equalToSuperview().offset(10) + $0.trailing.equalToSuperview().inset(16) + $0.height.equalTo(40) } setMiddleScrollView() } private func setMiddleScrollView() { - middleScorollView.snp.makeConstraints { make in - make.top.equalTo(navibar.snp.bottom) - make.leading.trailing.equalTo(view.safeAreaLayoutGuide) - make.bottom.equalTo(thirdHorizontalDivideLine.snp.top) + middleScorollView.snp.makeConstraints { + $0.top.equalTo(navibar.snp.bottom) + $0.leading.trailing.equalTo(view.safeAreaLayoutGuide) + $0.bottom.equalTo(thirdHorizontalDivideLine.snp.top) } - middleScorollView.addSubviews(mapImageView, profileImageView, profileNameLabel, runningLevelLabel, firstHorizontalDivideLine, courseTitleLabel, courseDetailStackView, secondHorizontalDivideLine, courseExplanationTextView) - - mapImageView.snp.makeConstraints { make in - make.top.equalToSuperview() - make.leading.trailing.equalTo(view.safeAreaLayoutGuide) - make.height.equalTo(middleScorollView.snp.width).multipliedBy(0.7) - } + middleScorollView.addSubviews(mapImageView, userProfileStackView, firstHorizontalDivideLine, courseTitleLabel, courseDetailStackView, secondHorizontalDivideLine, courseExplanationTextView) - profileImageView.snp.makeConstraints { make in - make.top.equalTo(mapImageView.snp.bottom).offset(14) - make.leading.equalToSuperview().offset(14) - make.width.height.equalTo(34) + mapImageView.snp.makeConstraints { + $0.top.equalToSuperview() + $0.leading.trailing.equalTo(view.safeAreaLayoutGuide) + $0.height.equalTo(middleScorollView.snp.width).multipliedBy(0.7) } - profileNameLabel.snp.makeConstraints { make in - make.centerY.equalTo(profileImageView.snp.centerY) - make.leading.equalTo(profileImageView.snp.trailing).offset(12) + userProfileStackView.snp.makeConstraints { + $0.leading.equalTo(view.safeAreaLayoutGuide).offset(12) + $0.top.equalTo(mapImageView.snp.bottom).offset(14) } - runningLevelLabel.snp.makeConstraints { make in - make.bottom.equalTo(profileNameLabel.snp.bottom) - make.leading.equalTo(profileNameLabel.snp.trailing).offset(10) + profileImageView.snp.makeConstraints { + $0.width.height.equalTo(34) } - firstHorizontalDivideLine.snp.makeConstraints { make in - make.top.equalTo(mapImageView.snp.bottom).offset(62) - make.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(14) - make.height.equalTo(0.5) + firstHorizontalDivideLine.snp.makeConstraints { + $0.top.equalTo(mapImageView.snp.bottom).offset(62) + $0.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(14) + $0.height.equalTo(0.5) } - courseTitleLabel.snp.makeConstraints { make in - make.top.equalTo(firstHorizontalDivideLine.snp.bottom).offset(16) - make.leading.equalTo(view.safeAreaLayoutGuide).offset(16) + courseTitleLabel.snp.makeConstraints { + $0.top.equalTo(firstHorizontalDivideLine.snp.bottom).offset(16) + $0.leading.equalTo(view.safeAreaLayoutGuide).offset(16) } - courseDetailStackView.snp.makeConstraints { make in - make.top.equalTo(courseTitleLabel.snp.bottom).offset(19) - make.leading.trailing.equalToSuperview().inset(16) + courseDetailStackView.snp.makeConstraints { + $0.top.equalTo(courseTitleLabel.snp.bottom).offset(19) + $0.leading.trailing.equalToSuperview().inset(16) } - secondHorizontalDivideLine.snp.makeConstraints { make in - make.top.equalTo(courseDetailStackView.snp.bottom).offset(27) - make.leading.trailing.equalTo(view.safeAreaLayoutGuide) - make.height.equalTo(8) + secondHorizontalDivideLine.snp.makeConstraints { + $0.top.equalTo(courseDetailStackView.snp.bottom).offset(27) + $0.leading.trailing.equalTo(view.safeAreaLayoutGuide) + $0.height.equalTo(8) } - courseExplanationTextView.snp.makeConstraints { make in - make.top.equalTo(secondHorizontalDivideLine.snp.bottom).offset(17) - make.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(16) - make.bottom.equalToSuperview().inset(20) + courseExplanationTextView.snp.makeConstraints { + $0.top.equalTo(secondHorizontalDivideLine.snp.bottom).offset(17) + $0.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(16) + $0.bottom.equalToSuperview().inset(20) } } } From 9059037f1ec6a2f4ef8ea2e0c3ec4060eea797a4 Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Thu, 14 Dec 2023 04:59:12 +0900 Subject: [PATCH 13/17] =?UTF-8?q?[Feat]=20#224=20-=20=EC=8A=A4=ED=81=AC?= =?UTF-8?q?=EB=9E=A9=200=EC=9D=BC=EC=8B=9C=20scrapCountLabel=20=EC=95=88?= =?UTF-8?q?=EB=B3=B4=EC=9D=B4=EA=B2=8C=20=ED=95=98=EB=8A=94=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CourseDetail/VC/CourseDetailVC.swift | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index 8b5bda1a..2ab37a45 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -74,7 +74,7 @@ final class CourseDetailVC: UIViewController { ).then { $0.axis = .horizontal $0.alignment = .center - $0.spacing = 9 + $0.spacing = 10 $0.isUserInteractionEnabled = true } @@ -145,7 +145,7 @@ final class CourseDetailVC: UIViewController { setUI() setLayout() setAddTarget() - setupRefreshControl() + setRefreshControl() self.hideTabBar(wantsToHide: true) } @@ -310,7 +310,7 @@ extension CourseDetailVC { self.likeButton.isSelected = scrap guard let scrapCount = model.publicCourse.scrapCount else {return} self.scrapCount = scrapCount - self.scrapCountLabel.text = "\(self.scrapCount)" + self.scrapCountLabel.text = (self.scrapCount > 0) ? "\(self.scrapCount)" : "" guard let distance = model.publicCourse.distance else { return } self.courseDistanceInfoView.setDescriptionText(description: "\(distance)km") @@ -356,7 +356,7 @@ extension CourseDetailVC { self.runningLevelLabel.isHidden = true } - private func setupRefreshControl() { + private func setRefreshControl() { let refreshControl = UIRefreshControl() refreshControl.addTarget( self, @@ -466,7 +466,11 @@ extension CourseDetailVC { } profileImageView.snp.makeConstraints { - $0.width.height.equalTo(34) + $0.width.height.equalTo(37) + } + + profileNameLabel.snp.makeConstraints { + $0.leading.equalTo(profileImageView.snp.trailing).offset(12) } firstHorizontalDivideLine.snp.makeConstraints { From fbb7c92adf4531b1ce20c2f5d67937c7a2891d5b Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Thu, 14 Dec 2023 18:02:19 +0900 Subject: [PATCH 14/17] =?UTF-8?q?[Feat]=20#224=20-=20privateCourse=20title?= =?UTF-8?q?=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CourseStorageDto/ResponseDto/PrivateCourseResponseDto.swift | 1 + .../Presentation/CourseStorage/VC/CourseStorageVC.swift | 2 +- .../Views/CourseListView/PrivateCourseListView.swift | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseStorageDto/ResponseDto/PrivateCourseResponseDto.swift b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseStorageDto/ResponseDto/PrivateCourseResponseDto.swift index e4a31dd0..b0e5d0d1 100644 --- a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseStorageDto/ResponseDto/PrivateCourseResponseDto.swift +++ b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseStorageDto/ResponseDto/PrivateCourseResponseDto.swift @@ -17,6 +17,7 @@ struct PrivateCourseResponseDto: Codable { struct PrivateCourse: Codable { let id: Int + let title: String let image, createdAt: String let distance: Float? let path: [[Double]]? diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseStorage/VC/CourseStorageVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseStorage/VC/CourseStorageVC.swift index d7f81065..154fed7d 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseStorage/VC/CourseStorageVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseStorage/VC/CourseStorageVC.swift @@ -101,7 +101,7 @@ extension CourseStorageVC { privateCourseListView.cellDidTapped.sink { [weak self] index in guard let self = self else { return } - guard let title = self.privateCourseList[index].departure.name else {return} + let title = self.privateCourseList[index].title let runningWaitingVC = RunningWaitingVC() runningWaitingVC.setData(courseId: self.privateCourseList[index].id, publicCourseId: nil, courseTitle: title) /// 코스 이름을 여기서 가져오는 로직 diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseStorage/Views/CourseListView/PrivateCourseListView.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseStorage/Views/CourseListView/PrivateCourseListView.swift index ee97f6dc..49fb2922 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseStorage/Views/CourseListView/PrivateCourseListView.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseStorage/Views/CourseListView/PrivateCourseListView.swift @@ -197,7 +197,7 @@ extension PrivateCourseListView: UICollectionViewDelegate, UICollectionViewDataS } let model = courseList[indexPath.item] - let cellTitle = model.departure.name ?? " " + let cellTitle = model.title cell.setCellType(type: .title) cell.selectCell(didSelect: collectionView.indexPathsForSelectedItems?.contains(indexPath) ?? false) From 5859798ed9ae17d74845cf53c93cff32b7bc2570 Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Thu, 14 Dec 2023 18:06:07 +0900 Subject: [PATCH 15/17] =?UTF-8?q?[Feat]=20#224=20-=20privateCourse=20title?= =?UTF-8?q?=20PATCH=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 코스 이름 수정하는 API를 연결 해주었습니다. --- .../Network/Router/CourseRouter.swift | 12 ++++++-- .../Running/VC/RunningWaitingVC.swift | 29 +++++++++++++++++-- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Network/Router/CourseRouter.swift b/Runnect-iOS/Runnect-iOS/Network/Router/CourseRouter.swift index 3153a5b7..74426a4b 100644 --- a/Runnect-iOS/Runnect-iOS/Network/Router/CourseRouter.swift +++ b/Runnect-iOS/Runnect-iOS/Network/Router/CourseRouter.swift @@ -14,6 +14,7 @@ enum CourseRouter { case getAllPrivateCourse case getPrivateCourseNotUploaded case getCourseDetail(courseId: Int) + case updateCourseTitle(courseId: Int, title: String) case deleteCourse(courseIdList: [Int]) } @@ -34,6 +35,8 @@ extension CourseRouter: TargetType { return "/course/user" case .getPrivateCourseNotUploaded: return "/course/private/user" + case .updateCourseTitle(let courseId, _): + return "/course/\(courseId)" case .getCourseDetail(let courseId): return "/course/detail/\(courseId)" case .deleteCourse: @@ -43,10 +46,12 @@ extension CourseRouter: TargetType { var method: Moya.Method { switch self { - case .uploadCourseDrawing: - return .post case .getAllPrivateCourse, .getPrivateCourseNotUploaded, .getCourseDetail: return .get + case .uploadCourseDrawing: + return .post + case .updateCourseTitle: + return .patch case .deleteCourse: return .put } @@ -86,6 +91,9 @@ extension CourseRouter: TargetType { } return .uploadMultipart(multipartFormData) + case .updateCourseTitle(_, let title): + return .requestParameters(parameters: ["title": title], encoding: JSONEncoding.default) + case .deleteCourse(let courseIdList): return .requestParameters(parameters: ["courseIdList": courseIdList], encoding: JSONEncoding.default) case .getAllPrivateCourse, .getPrivateCourseNotUploaded, .getCourseDetail: diff --git a/Runnect-iOS/Runnect-iOS/Presentation/Running/VC/RunningWaitingVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/Running/VC/RunningWaitingVC.swift index 50a0e3a0..c712e77c 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/Running/VC/RunningWaitingVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/Running/VC/RunningWaitingVC.swift @@ -282,6 +282,30 @@ extension RunningWaitingVC { } } } + + private func editCourseTitle(courseTitle: String) { + guard let courseId = courseId else { return } + + LoadingIndicator.showLoading() + courseProvider.request(.updateCourseTitle(courseId: courseId, title: courseTitle)) { [weak self] response in + LoadingIndicator.hideLoading() + guard let self = self else { return } + switch response { + case .success(let result): + let status = result.statusCode + if 200..<300 ~= status { + showToast(message: "내 코스 이름 수정이 완료되었어요") + } + if status >= 400 { + print("400 error") + self.showNetworkFailureToast() + } + case .failure(let error): + print(error.localizedDescription) + self.showNetworkFailureToast() + } + } + } } // MARK: - DropDown @@ -299,7 +323,6 @@ extension RunningWaitingVC { switch item { case "수정하기": - // 현재 코스 모델의 이름 변경 ModifyCourseTitle() case "삭제하기": let deleteAlertVC = RNAlertVC(description: "러닝 기록을 정말로 삭제하시겠어요?").setButtonTitle("취소", "삭제하기") @@ -322,8 +345,8 @@ extension RunningWaitingVC { bottomSheetVC.completeButtonTapAction = { [weak self] text in guard let self = self else { return } guard handleVisitor() else { return } - self.courseTitle = text - /// 여기에 id 랑 text post 작업 필요 할 듯? + self.editCourseTitle(courseTitle: text) + self.naviBar.setTitle(text) self.dismiss(animated: false) } self.present(bottomSheetVC, animated: false) From a97c28c82e6dc109a7b321158bc74e382baa1f31 Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Fri, 15 Dec 2023 01:32:15 +0900 Subject: [PATCH 16/17] =?UTF-8?q?[Feat]=20#224=20-=20=EB=A7=88=EB=9D=BC?= =?UTF-8?q?=ED=86=A4=20=EC=8A=A4=ED=81=AC=EB=9E=A9=20=EC=84=9C=EB=B2=84=20?= =?UTF-8?q?=ED=86=B5=EC=8B=A0=20=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/MarathonMapCollectionViewCell.swift | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonMapCollectionViewCell.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonMapCollectionViewCell.swift index b8b2a061..cb43eb5a 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonMapCollectionViewCell.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/MarathonMapCollectionViewCell.swift @@ -17,9 +17,11 @@ class CourseSelectionPublisher { } final class MarathonMapCollectionViewCell: UICollectionViewCell { + // MARK: - Properties private let PublicCourseProvider = Providers.publicCourseProvider + private let scrapProvider = Providers.scrapProvider var marathonCourseList = [marathonCourse]() // Cell 사용하는 곳에서 사용 중이라 private ❌ // MARK: - UIComponents @@ -99,6 +101,7 @@ extension MarathonMapCollectionViewCell: UICollectionViewDelegate, UICollectionV for: indexPath) as? CourseListCVC else { return UICollectionViewCell() } cell.setCellType(type: .all) + cell.delegate = self let model = self.marathonCourseList[indexPath.item] let location = "\(model.departure.region) \(model.departure.city)" cell.setData(imageURL: model.image, title: model.title, location: location, didLike: model.scrap, indexPath: indexPath.item) @@ -131,7 +134,20 @@ extension MarathonMapCollectionViewCell: UICollectionViewDelegateFlowLayout { CourseSelectionPublisher.shared.didSelectCourse.send(indexPath) // 코스 발견에 이벤트 전달 } - +} + +// MARK: - CourseListCVCDelegate + +extension MarathonMapCollectionViewCell: CourseListCVCDeleagte { + func likeButtonTapped(wantsTolike: Bool, index: Int) { + guard UserManager.shared.userType != .visitor else { + return + } + + let publicCourseId = self.marathonCourseList[index].id + self.scrapCourse(publicCourseId: publicCourseId, scrapTF: wantsTolike) + print("마라톤에 들어온 index = \(index)") + } } // MARK: - NetWork @@ -161,4 +177,24 @@ extension MarathonMapCollectionViewCell { } } } + + private func scrapCourse(publicCourseId: Int, scrapTF: Bool) { + LoadingIndicator.showLoading() + scrapProvider.request(.createAndDeleteScrap(publicCourseId: publicCourseId, scrapTF: scrapTF)) { [weak self] response in + LoadingIndicator.hideLoading() + guard let self = self else { return } + switch response { + case .success(let result): + let status = result.statusCode + if 200..<300 ~= status { + print("스크랩 성공") + } + if status >= 400 { + print("400 error") + } + case .failure(let error): + print(error.localizedDescription) + } + } + } } From 2ee47b432263c2ca3ad0be0f18b8fc8e78e3bfd9 Mon Sep 17 00:00:00 2001 From: LeeMyeongJin Date: Fri, 15 Dec 2023 01:33:16 +0900 Subject: [PATCH 17/17] =?UTF-8?q?[Chore]=20#224=20-=20=EC=BD=94=EC=8A=A4?= =?UTF-8?q?=20=EB=B0=9C=EA=B2=AC=20Section=20=EC=9D=B4=EB=A6=84=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CourseDiscovery/Views/VC/CourseDiscoveryVC.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift index b3b30f82..9aff9953 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseDiscoveryVC.swift @@ -223,7 +223,7 @@ extension CourseDiscoveryVC { private enum Section { static let adImage = 0 // 광고 이미지 static let marathonTitle = 1 // 마라톤 코스 설명 - static let recommendedList = 2 // 마라톤 코스 + static let marathonCourseList = 2 // 마라톤 코스 static let title = 3 // 추천 코스 설명 static let courseList = 4 // 추천 코스 } @@ -244,7 +244,7 @@ extension CourseDiscoveryVC: UICollectionViewDelegate, UICollectionViewDataSourc func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { switch section { - case Section.adImage, Section.marathonTitle, Section.recommendedList, Section.title: + case Section.adImage, Section.marathonTitle, Section.marathonCourseList, Section.title: return 1 case Section.courseList: return self.courseList.count @@ -261,7 +261,7 @@ extension CourseDiscoveryVC: UICollectionViewDelegate, UICollectionViewDataSourc case Section.marathonTitle: guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: MarathonTitleCollectionViewCell.className, for: indexPath) as? MarathonTitleCollectionViewCell else { return UICollectionViewCell() } return cell - case Section.recommendedList: + case Section.marathonCourseList: guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: MarathonMapCollectionViewCell.className, for: indexPath) as? MarathonMapCollectionViewCell else { return UICollectionViewCell() } return cell case Section.title: @@ -297,7 +297,7 @@ extension CourseDiscoveryVC: UICollectionViewDelegateFlowLayout { return CGSize(width: screenWidth, height: screenWidth * (174/390)) case Section.marathonTitle: return CGSize(width: screenWidth, height: 98) - case Section.recommendedList: + case Section.marathonCourseList: return CGSize(width: screenWidth, height: 194) case Section.title: return CGSize(width: screenWidth, height: 106) @@ -336,7 +336,7 @@ extension CourseDiscoveryVC: UICollectionViewDelegateFlowLayout { // 외부에서 Marathon Cell에서 받아오는 indexPath를 처리 합니다. private func setMarathonCourseSelection(at indexPath: IndexPath) { - if let marathonCell = mapCollectionView.cellForItem(at: IndexPath(item: 0, section: Section.recommendedList)) as? MarathonMapCollectionViewCell { + if let marathonCell = mapCollectionView.cellForItem(at: IndexPath(item: 0, section: Section.marathonCourseList)) as? MarathonMapCollectionViewCell { let marathonCourseList = marathonCell.marathonCourseList let courseDetailVC = CourseDetailVC() let courseModel = marathonCourseList[indexPath.item]