Skip to content

Conversation

@thingineeer
Copy link
Collaborator

@thingineeer thingineeer commented Dec 26, 2023

🌱 작업한 내용

  • 1번 코스 상세 스크랩 수 변경으로 인한 수정 작업
  • 2번 코스 발견 마라톤 Cell 부분 코스 상세 -> 코스 발견 으로 이동하면서, 스크랩 수가 실시간으로 적용 되는 작업

🌱 PR Point

  • 1번 부분은 기존 toggle로 +1 , -1 하는 작업이었는데, 서버 통신이 바뀌어 간단하게 구현 하였습니다.
  • 2번 부분에서 요번에도 델리게이트 패턴으로 이벤트를 넘겨주는 작업을 하였습니다. (추천 코스 와 비슷한 작업)
    • 마라톤에 있는 Cell 자체가 코스 발견 안에 선언되어 있어서 코스 발견에 구현을 해야 하나, 마라톤 Cell에 구현을 해야 고민하다가 Cell 내부에 기능 구현을 하였는데, 이 부분 한번 보시길 바랍니다. ‼️
  • 커밋 내역 중에 cocoaPods 작업이 있었는데, 이 부분은 GA 브랜치에서 작업을 하고 있어서 지금은 무시해 주시면 됩니다. ‼️

📸 스크린샷

영상에 마우스 포인터와 함께 변경된 점을 UI로 녹화하였으니 참고 바랍니다.

📮 관련 이슈

API에서 스크랩 카운트를 주는 과정해서, UI 업데이트가 필요하였는데 그 부분을 변경하였습니다.
코스 상세 -> 코스 발견으로 나올때 마라톤 Cell도 추천 코스처럼 수정되게 기능을 구현 하였습니다.
@thingineeer thingineeer added Feat 새로운 기능 구현 명진😼 labels Dec 26, 2023
@thingineeer thingineeer requested a review from 513sojin December 26, 2023 11:49
@thingineeer thingineeer self-assigned this Dec 26, 2023
Comment on lines 168 to 169
delegate?.didUpdateScrapState(publicCourseId: publicCourseId, isScrapped: !sender.isSelected) /// 코스 발견 UI Update 부분
marathonDelegate?.didMarathonUpdateScrapState(publicCourseId: publicCourseId, isScrapped: !sender.isSelected) // 마라톤 코스 UI Update 부분
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.

아무래도, 코스 상세에서 이벤트 전달을 해주는 것이

  1. 추천 코스
  2. 마라톤 코스

인데, 어차피 서로 독립적인 부분이라 저렇게 선언해도 괜찮을 것 같다고 판단하였습니다.

여기서 "서로 독립적이다" 라는 말은
마라톤 Cell에 있는 코스와, 추천 코스에 있는 코스들은 겹치지 않는다 라고 기획 측에서 말을 해주었기에 독립적이라고 하였습니다.

Comment on lines +576 to +578
self.likeButton.isSelected.toggle()
self.scrapCount = data.scrapCount
self.scrapCountLabel.text = "\(self.scrapCount)"
Copy link
Collaborator

Choose a reason for hiding this comment

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

서버 통신에서 조금 바뀌었다고 했는데
원래는 scrap 개수가 response로 안넘어왔는데 지금은 넘어오고 그걸 사용하는 건가요?!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

맞아요
원래 +1 , -1 이런 식으로 그냥 단순한 방법으로 해결했었는데, 서버에서 scrapCount를 넘겨주니까 쉽게 해결할 수 있었어요!

Comment on lines 167 to 177
extension MarathonMapCollectionViewCell: MarathonCourseDelegate {
func didMarathonUpdateScrapState(publicCourseId: Int, isScrapped: Bool) {
print("✅ 1. 마라톤 델리게이트 들어오는가 🫶🏻")
if let index = marathonCourseList.firstIndex(where: { $0.id == publicCourseId }) {
marathonCourseList[index].scrap = isScrapped
marathonReloadCellForCourse(publicCourseId: publicCourseId)
print("✅ 4. ‼️MarathonMapCollectionViewCell에서 작업 완료")
}
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

이 부분이 코스 발견쪽에 구현되면 marathonCourseList에 대한 접근이
cell.marathonCourseList 이런식으로 접근해야해서 cell 안에 구현해준건가요?

어떤 포인트에서 코스 발견에 구현을 해야 하나, 마라톤 Cell에 구현을 해야 고민 했는지 궁금합니다 ~

Copy link
Collaborator Author

@thingineeer thingineeer Dec 26, 2023

Choose a reason for hiding this comment

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

맞아요! private 한 marathonCourseList을 public으로 바꿔야 할뿐더러, cell.marathonCourseList 이런 식으로 접근하는 게 좋은 코드가 아닌 것 같아서 Cell 내부에서 delegate 처리해 주었습니다~

따라서 delegate를 채택을 아래처럼 하였습니다.

courseDetailVC.marathonDelegate = marathonCell

Copy link
Collaborator

@513sojin 513sojin left a comment

Choose a reason for hiding this comment

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

답글 달아둔 부분 전부 확인했습니다 ~ 고생하셨어용

@thingineeer thingineeer merged commit 68dedad into Runnect:develop Dec 27, 2023
@thingineeer thingineeer deleted the #229--코스발견-서버-API-부분-수정 branch December 27, 2023 06:01
@thingineeer thingineeer added the UX label Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feat 새로운 기능 구현 UX 명진😼

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fix] #229 -코스발견 서버 API 부분 수정

2 participants