-
Notifications
You must be signed in to change notification settings - Fork 6
[Feat] #199 - 내가 그린 코스 상세 페이지를 변경 하였습니다. #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
thingineeer
merged 16 commits into
Runnect:develop
from
thingineeer:#199---내가-그린-코스-상세-페이지-변경
Dec 13, 2023
The head ref may contain hidden characters: "#199---\uB0B4\uAC00-\uADF8\uB9B0-\uCF54\uC2A4-\uC0C1\uC138-\uD398\uC774\uC9C0-\uBCC0\uACBD"
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
7ffd398
[Feat] #199 - 네비게이션 바 추가
thingineeer 8fdeb16
[Feat] #199 - 더보기 버튼 추가
thingineeer aac4ea9
[Feat] #199 - naviBar에 코스 이름 연결
thingineeer d6d5e6e
[Feat] #199 - Test Code 추가
thingineeer a16246e
[Style] #199 - 코드 위치 수정
thingineeer ba62221
Merge branch 'develop' into #199---내가-그린-코스-상세-페이지-변경
thingineeer 386857b
Merge branch 'develop' into #199---내가-그린-코스-상세-페이지-변경
thingineeer 6544e3d
[Feat] #199 - 바텀 시트 연결
thingineeer d876d01
Merge branch 'develop' into #199---내가-그린-코스-상세-페이지-변경
thingineeer e041e2f
[Fix] #199 - ScrapCourseResponseDto Codingkey 제거
thingineeer ac8976f
[Feat] #199 - 코스 이름 Cell에 등록
thingineeer 8591881
[Chore] #199 - makePath 선언 범위 수정
thingineeer f193349
[Fix] #199 - 레이아웃 수정
thingineeer ed4a735
[Feat] #199 - 수정하기 뷰 연결
thingineeer 91a8b3a
Merge branch 'develop' into #199---내가-그린-코스-상세-페이지-변경
thingineeer f517a1e
Merge branch 'develop' into #199---내가-그린-코스-상세-페이지-변경
thingineeer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ import UIKit | |
|
|
||
| import NMapsMap | ||
| import Moya | ||
| import DropDown | ||
|
|
||
| final class RunningWaitingVC: UIViewController { | ||
|
|
||
|
|
@@ -17,14 +18,20 @@ final class RunningWaitingVC: UIViewController { | |
| private var courseId: Int? | ||
| private var publicCourseId: Int? | ||
| private var courseModel: Course? | ||
| private var courseTitle: String? | ||
|
|
||
| private let courseProvider = Providers.courseProvider | ||
|
|
||
| private let recordProvider = Providers.recordProvider | ||
|
|
||
| // MARK: - UI Components | ||
|
|
||
| private lazy var naviBar = CustomNavigationBar(self, type: .titleWithLeftButton) | ||
|
|
||
| private lazy var naviBar = CustomNavigationBar(self, type: .titleWithLeftButton).setTitle(courseTitle ?? "Test Code") | ||
|
|
||
| private let moreButton = UIButton(type: .system).then { | ||
| $0.setImage(ImageLiterals.icMore, for: .normal) | ||
| $0.tintColor = .g1 | ||
| } | ||
|
|
||
| private let mapView = RNMapView() | ||
|
|
||
|
|
@@ -72,9 +79,10 @@ final class RunningWaitingVC: UIViewController { | |
| // MARK: - Methods | ||
|
|
||
| extension RunningWaitingVC { | ||
| func setData(courseId: Int, publicCourseId: Int?) { | ||
| func setData(courseId: Int, publicCourseId: Int?, courseTitle: String) { | ||
| self.courseId = courseId | ||
| self.publicCourseId = publicCourseId | ||
| self.courseTitle = courseTitle | ||
|
|
||
| getCourseDetail(courseId: courseId) | ||
| } | ||
|
|
@@ -88,12 +96,13 @@ extension RunningWaitingVC { | |
| self.distanceLabel.text = String(distance) | ||
| } | ||
|
|
||
| func makePath(locations: [NMGLatLng]) { | ||
| private func makePath(locations: [NMGLatLng]) { | ||
| self.mapView.makeMarkersWithStartMarker(at: locations, moveCameraToStartMarker: true) | ||
| } | ||
|
|
||
| private func setAddTarget() { | ||
| self.startButton.addTarget(self, action: #selector(startButtonDidTap), for: .touchUpInside) | ||
| moreButton.addTarget(self, action: #selector(moreButtonDidTap), for: .touchUpInside) | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -115,6 +124,38 @@ extension RunningWaitingVC { | |
| countDownVC.setData(runningModel: runningModel) | ||
| self.navigationController?.pushViewController(countDownVC, animated: true) | ||
| } | ||
|
|
||
| @objc private func moreButtonDidTap() { | ||
| guard let courseModel = self.courseModel else {return} | ||
|
|
||
| let items = ["수정하기", "삭제하기"] | ||
| let imageArray: [UIImage] = [ImageLiterals.icModify, ImageLiterals.icRemove] | ||
|
|
||
| let menu = DropDown().then { | ||
| $0.anchorView = moreButton | ||
| $0.backgroundColor = .w1 | ||
| $0.bottomOffset = CGPoint(x: -136, y: moreButton.bounds.height - 10) | ||
| $0.width = 170 | ||
| $0.cellHeight = 40 | ||
| $0.cornerRadius = 12 | ||
| $0.dismissMode = .onTap | ||
| $0.separatorColor = UIColor(hex: "#EBEBEB") | ||
| $0.dataSource = items | ||
| $0.textFont = .b3 | ||
| } | ||
|
|
||
| menu.customCellConfiguration = { (index: Index, _: String, cell: DropDownCell) -> Void in | ||
| let lastDividerLineRemove = UIView(frame: CGRect(origin: CGPoint(x: 0, y: (items.count * 40) - 1), size: CGSize(width: 170, height: 10))) | ||
| lastDividerLineRemove.backgroundColor = .white | ||
| cell.separatorInset = .zero | ||
| cell.dropDownImage.image = imageArray[index] | ||
| cell.addSubview(lastDividerLineRemove) | ||
| } | ||
|
|
||
| dropDownTouchAction(menu: menu, courseModel: courseModel) | ||
|
|
||
| menu.show() | ||
| } | ||
| } | ||
|
|
||
| // MARK: - UI & Layout | ||
|
|
@@ -123,11 +164,11 @@ extension RunningWaitingVC { | |
| private func setUI() { | ||
| self.view.backgroundColor = .w1 | ||
| self.distanceContainerView.layer.applyShadow(alpha: 0.2, x: 2, y: 4, blur: 9) | ||
| self.naviBar.backgroundColor = .clear | ||
| } | ||
|
|
||
| private func setLayout() { | ||
| view.addSubviews(naviBar, | ||
| moreButton, | ||
| mapView, | ||
| distanceContainerView, | ||
| startButton) | ||
|
|
@@ -139,8 +180,16 @@ extension RunningWaitingVC { | |
|
|
||
| view.bringSubviewToFront(naviBar) | ||
|
|
||
| moreButton.snp.makeConstraints { make in | ||
| make.trailing.equalTo(self.view.safeAreaLayoutGuide) | ||
| make.centerY.equalTo(naviBar) | ||
| } | ||
| view.bringSubviewToFront(moreButton) | ||
|
|
||
| mapView.snp.makeConstraints { make in | ||
| make.edges.equalToSuperview() | ||
| make.leading.trailing.equalTo(self.view.safeAreaLayoutGuide) | ||
| make.top.equalTo(naviBar.snp.bottom) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 네이버 로고를 보이게 해준 코드네요 ,, 확인 했습니다 ~ |
||
| make.bottom.equalToSuperview() | ||
| } | ||
|
|
||
| distanceContainerView.snp.makeConstraints { make in | ||
|
|
@@ -155,11 +204,11 @@ extension RunningWaitingVC { | |
| distanceStackView.snp.makeConstraints { make in | ||
| make.center.equalToSuperview() | ||
| } | ||
|
|
||
| startButton.snp.makeConstraints { make in | ||
| make.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(16) | ||
| make.height.equalTo(44) | ||
| make.top.equalTo(view.snp.bottom).offset(34) | ||
| make.top.equalTo(view.snp.bottom).offset(24) | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -207,3 +256,76 @@ extension RunningWaitingVC { | |
| } | ||
| } | ||
| } | ||
| // MARK: - Network | ||
|
|
||
| extension RunningWaitingVC { | ||
| private func deleteCourse() { | ||
| guard let courseId = self.courseId else { return } | ||
| LoadingIndicator.showLoading() | ||
| courseProvider.request(.deleteCourse(courseIdList: [courseId])) { [weak self] response in | ||
| LoadingIndicator.hideLoading() | ||
| guard let self = self else { return } | ||
| switch response { | ||
| case .success(let result): | ||
| print("리절트", result) | ||
| let status = result.statusCode | ||
| if 200..<300 ~= status { | ||
| print("삭제 성공") | ||
| } | ||
| if status >= 400 { | ||
| print("400 error") | ||
| self.showNetworkFailureToast() | ||
| } | ||
| case .failure(let error): | ||
| print(error.localizedDescription) | ||
| self.showNetworkFailureToast() | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // MARK: - DropDown | ||
|
|
||
| extension RunningWaitingVC { | ||
| private func dropDownTouchAction(menu: DropDown, courseModel: Course) { | ||
| DropDown.appearance().textColor = .g1 | ||
| DropDown.appearance().selectionBackgroundColor = .w1 | ||
| DropDown.appearance().shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.2) | ||
| DropDown.appearance().shadowOpacity = 1 | ||
| DropDown.appearance().shadowRadius = 10 | ||
|
|
||
| menu.selectionAction = { [unowned self] (_, item) in | ||
| menu.clearSelection() | ||
|
|
||
| switch item { | ||
| case "수정하기": | ||
| // 현재 코스 모델의 이름 변경 | ||
| ModifyCourseTitle() | ||
| case "삭제하기": | ||
| let deleteAlertVC = RNAlertVC(description: "러닝 기록을 정말로 삭제하시겠어요?").setButtonTitle("취소", "삭제하기") | ||
| deleteAlertVC.modalPresentationStyle = .overFullScreen | ||
| deleteAlertVC.rightButtonTapAction = { | ||
| deleteAlertVC.dismiss(animated: false) | ||
| self.deleteCourse() | ||
| self.navigationController?.popViewController(animated: true) | ||
| } | ||
| self.present(deleteAlertVC, animated: false) | ||
| default: | ||
| self.showToast(message: "없는 명령어 입니다.") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private func ModifyCourseTitle() { | ||
| let bottomSheetVC = CustomBottomSheetVC(type: .textField) | ||
| bottomSheetVC.modalPresentationStyle = .overFullScreen | ||
| bottomSheetVC.completeButtonTapAction = { [weak self] text in | ||
| guard let self = self else { return } | ||
| guard handleVisitor() else { return } | ||
| self.courseTitle = text | ||
| /// 여기에 id 랑 text post 작업 필요 할 듯? | ||
| self.dismiss(animated: false) | ||
| } | ||
| self.present(bottomSheetVC, animated: false) | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didSelect 부분에 삼항연산자를 써준 것 이외에 기존 코드를 바꾼 이유가 또 있나용?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
옵셔널 체이닝 부분이였는데,
그냥 한줄로 표현 했습니다.. ㅎㅎ