-
Notifications
You must be signed in to change notification settings - Fork 6
[Feat]#125 - 내가 업로드한 코스 삭제 및 수정하기 기능 구현 #133
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
The head ref may contain hidden characters: "#125-\uB0B4\uAC00\uADF8\uB9B0\uCF54\uC2A4\uC0AD\uC81C"
Conversation
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.
수고하셨습니다~!
리뷰 단 내용들 체크해주세요!
새로 고침 안하고 바로 볼 수 있는 방법은 업로드한 코스 뷰에서 서버 통신 시점을 viewDidLoad에서 viewWillAppear로 바꾸면 됩니다!
| guard let isMyCourse = self.isMyCourse, let uploadedCourseDetailModel = self.uploadedCourseDetailModel else { return } | ||
|
|
||
| let cancelAction = UIAlertAction(title: "닫기", style: .cancel, handler: nil) | ||
|
|
||
| if isMyCourse == true { | ||
| let editAlertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) | ||
| let courseEditVC = CourseEditVC() | ||
| courseEditVC.loadData(model: uploadedCourseDetailModel) | ||
| courseEditVC.publicCourseId = self.publicCourseId | ||
| let editAction = UIAlertAction(title: "수정하기", style: .default, handler: {(_: UIAlertAction!) in | ||
| self.navigationController?.pushViewController(courseEditVC, animated: false) | ||
| }) | ||
| let deleteVC = RNAlertVC(description: "코스를 정말로 삭제하시겠어요?") | ||
| deleteVC.rightButtonTapAction = { [weak self] in | ||
| deleteVC.dismiss(animated: false) | ||
| self?.deleteCourse() | ||
| } | ||
| deleteVC.modalPresentationStyle = .overFullScreen | ||
| let deleteAction = UIAlertAction(title: "삭제하기", style: .destructive, handler: {(_: UIAlertAction!) in | ||
| self.present(deleteVC, animated: false, completion: nil)}) | ||
| [ editAction, deleteAction, cancelAction].forEach { editAlertController.addAction($0) } | ||
| present(editAlertController, animated: false, completion: nil) | ||
| } else { | ||
| // 신고폼 올라오는 거(유저아이디가 내가 아닌 경우) | ||
| let reportAlertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) | ||
| let formUrl = NSURL(string: "https://docs.google.com/forms/d/e/1FAIpQLSek2rkClKfGaz1zwTEHX3Oojbq_pbF3ifPYMYezBU0_pe-_Tg/viewform") | ||
| let formSafariView: SFSafariViewController = SFSafariViewController(url: formUrl! as URL) | ||
| let reportAction = UIAlertAction(title: "신고하기", style: .destructive, handler: {(_: UIAlertAction!) in | ||
| self.present(formSafariView, animated: true, completion: nil) | ||
| }) | ||
| [ reportAction, cancelAction ].forEach { reportAlertController.addAction($0) } | ||
| present(reportAlertController, animated: true, completion: nil) | ||
| } |
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.
함수가 커지는 것은 지양합시다! -> 함수 내부 코드들을 쪼개서 다른 함수들로 만들고 여기서 호출하는 식으로 각 함수의 역할을 분리하면 좋아요~!
가독성과 유지보수에 큰 영향을 줍니다! (객체지향의 SOLID 원칙에 대해 공부해보면 좋을 것 같아요!)
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.
넵 !!! 지금 당장 해보려고 했으나 급한 불 끄고 깔끔하게 고쳐볼게용
| import Then | ||
| import Moya | ||
|
|
||
| class CourseEditVC: UIViewController { |
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.
혹시 이 뷰 se 같이 작은 폰에서 잘 스크롤 될까요?
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.
넹 !!!
| // private let afterEditTopView = UIView() | ||
| // private let selectCouseLabel = UILabel().then { | ||
| // $0.text = "코스 선택" | ||
| // $0.font = .b6 | ||
| // $0.textColor = .g2 | ||
| // } |
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.
사용하지 않는 코드라면 지워주세요~!
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.
넵 !
| $0.tintColor = .g1 | ||
| } | ||
| private let totalCourseNum = UILabel().then{ | ||
| $0.text = "총 100개" |
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.
label text의 기본값은 테스트용으로만 처음에 넣고 잘 동작하는 걸 확인했으면 없애는게 좋아요!
실제 사용자가 이 뷰에 접근했을 때 서버 통신이 완료되기 전까지 계속 "총 100개"라는 텍스트를 봐야하는데 이건 좋지 않은 UX입니다!
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.
넵 !! 다음 이슈 파서 반영하도록 하겠습니닷 ,,,!!
🌱 작업한 내용
🌱 PR Point
📸 스크린샷
📮 관련 이슈