Skip to content

Conversation

@lee-yeonwoo
Copy link
Collaborator

@lee-yeonwoo lee-yeonwoo commented May 6, 2023

🌱 작업한 내용

  • 내가 업로드한 코스와 내가 아닌 다른사람이 업로드한 코스를 분기처리해서 각각 다른 액션시트가 뜨도록 했습니다
  • editCourseVC 를 생성하고, detailVC에서 사용한 데이터 모델을 그대로 가져와 해당 데이터에서 수정이 가능하도록 구현했습니다
  • editCourseVC에 수정하기 API를 연결했습니다
  • 필요한 팝업창들을 연결했습니다
  • 수정하고 업로드 할 때, 기존에는 공백일 때는 버튼이 활성화 되지 않았지만 스페이스바를 눌렀을 땐 버튼이 활성화되었습니다. 이 부분에서 스페이스바를 눌러도 버튼이 활성화되지 않도록 수정했습니다.
  • 삭제팝업창에 삭제 API를 연결했습니다
  • 고마워 세진...

🌱 PR Point

  • 새로고침..안해도 바로 결과가 보이게도 할 수있나용 ..? 지금은 새로고침해야 삭제된거랑 수정된게 반영되네요 !

📸 스크린샷

Simulator Screen Recording - iPhone 14 Pro - 2023-05-06 at 19 21 11

📮 관련 이슈

  • Resolved: #이슈번호

Copy link
Collaborator

@lsj8706 lsj8706 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다~!
리뷰 단 내용들 체크해주세요!

새로 고침 안하고 바로 볼 수 있는 방법은 업로드한 코스 뷰에서 서버 통신 시점을 viewDidLoad에서 viewWillAppear로 바꾸면 됩니다!

Comment on lines +132 to +164
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)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

함수가 커지는 것은 지양합시다! -> 함수 내부 코드들을 쪼개서 다른 함수들로 만들고 여기서 호출하는 식으로 각 함수의 역할을 분리하면 좋아요~!
가독성과 유지보수에 큰 영향을 줍니다! (객체지향의 SOLID 원칙에 대해 공부해보면 좋을 것 같아요!)

Copy link
Collaborator Author

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 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

혹시 이 뷰 se 같이 작은 폰에서 잘 스크롤 될까요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넹 !!!

Comment on lines +42 to +47
// private let afterEditTopView = UIView()
// private let selectCouseLabel = UILabel().then {
// $0.text = "코스 선택"
// $0.font = .b6
// $0.textColor = .g2
// }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사용하지 않는 코드라면 지워주세요~!

Copy link
Collaborator Author

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개"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

label text의 기본값은 테스트용으로만 처음에 넣고 잘 동작하는 걸 확인했으면 없애는게 좋아요!
실제 사용자가 이 뷰에 접근했을 때 서버 통신이 완료되기 전까지 계속 "총 100개"라는 텍스트를 봐야하는데 이건 좋지 않은 UX입니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵 !! 다음 이슈 파서 반영하도록 하겠습니닷 ,,,!!

@lee-yeonwoo lee-yeonwoo merged commit 1ee5c99 into Runnect:develop May 10, 2023
@lee-yeonwoo lee-yeonwoo deleted the #125-내가그린코스삭제 branch May 10, 2023 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feat 새로운 기능 구현 연우🐰

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants