Skip to content

Conversation

@youn9k
Copy link
Member

@youn9k youn9k commented Nov 29, 2024

🤔 배경

기존 ViewModel 구조는 단방향 데이터 흐름은 잘 지켜지지만 Action만 Input으로 처리되어 사이드 이펙트에 의해 발생하는 이벤트들을 Input으로 넣기 어렵다는 문제점이 있었습니다.

📃 작업 내역

사이드 이펙트 처리가 유용한 구조로 변경해 개발 속도를 높이고자 했습니다.
Input과 Output을 Enum으로 관리하고, Subject타입의 Input을 뷰컨트롤러에 두어 Action들을 쉽게 전달할 수 있는 구조로 변경했습니다.

✅ 리뷰 노트

기존에 다른 ViewModel 들에서 사용 중이던 구조로 변경했습니다.
더 읽기 수월하실 거에요!

@youn9k youn9k added the ⚙️ refactor 코드 정상화 label Nov 29, 2024
@youn9k youn9k self-assigned this Nov 29, 2024
@youn9k youn9k linked an issue Nov 29, 2024 that may be closed by this pull request
@youn9k youn9k marked this pull request as draft November 29, 2024 11:33
@youn9k youn9k changed the base branch from develop to feat/#110-join-room-server November 29, 2024 11:33
@youn9k youn9k marked this pull request as ready for review November 29, 2024 11:34
Co-Authored-By: Kiyoung <121777185+Kiyoung-Kim-57@users.noreply.github.com>
@youn9k youn9k changed the title [FEAT/#79] :: WaitingRoomViewController/ViewModel을 리팩토링합니다. [FEAT/#79] :: 1. WaitingRoomViewController/ViewModel을 리팩토링합니다. Nov 29, 2024
@youn9k youn9k marked this pull request as draft November 29, 2024 11:50
@youn9k youn9k changed the title [FEAT/#79] :: 1. WaitingRoomViewController/ViewModel을 리팩토링합니다. [FEAT/#79] 1. WaitingRoomViewController/ViewModel을 리팩토링합니다. Nov 29, 2024
Kiyoung-Kim-57 and others added 11 commits November 29, 2024 21:04
Co-Authored-By: Youngkyu Song <ace_lephant@naver.com>
- Offer 보낼 때 SessionDescription에 answerID 정보를 같이 담아서 보낼 수 있도록 모델 수정
- Offer 보낼 때 answerID 정보 포함해서 보냄

Co-Authored-By: Youngkyu Song <ace_lephant@naver.com>
answerID는 Answer를 보내는 사람의 ID입니다.
Offer를 보내고 Answer가 왔을 때 특정 Client에만 remoteSDP를 저장해야합니다.
Co-Authored-By: Kiyoung <121777185+Kiyoung-Kim-57@users.noreply.github.com>
Co-Authored-By: Kiyoung <121777185+Kiyoung-Kim-57@users.noreply.github.com>
Co-Authored-By: Kiyoung <121777185+Kiyoung-Kim-57@users.noreply.github.com>
Co-Authored-By: Kiyoung <121777185+Kiyoung-Kim-57@users.noreply.github.com>
- OfferSdpPublisher, AnswerSdpPublisher 의 로직을 수정했습니다.

Co-Authored-By: Youngkyu Song <ace_lephant@naver.com>
Co-Authored-By: Youngkyu Song <ace_lephant@naver.com>
Co-Authored-By: Youngkyu Song <ace_lephant@naver.com>
Co-Authored-By: Youngkyu Song <ace_lephant@naver.com>
UI변경을 메인스레드에서 하기 위해 receive RunLoop.main을 달아두었습니다.
Co-Authored-By: Kiyoung <121777185+Kiyoung-Kim-57@users.noreply.github.com>
@youn9k youn9k marked this pull request as ready for review November 29, 2024 15:38
Copy link
Collaborator

@hsw1920 hsw1920 left a comment

Choose a reason for hiding this comment

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

훨씬 깔끔해졌네요. 궁금한 부분들 몇 가지 코멘트 남겼습니다.

Copy link
Collaborator

@0Hooni 0Hooni left a comment

Choose a reason for hiding this comment

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

LGTM 👍

- isGuest -> isHost 변경
- output 을 메인스레드에서 받도록 변경
Comment on lines +80 to +84
waitingRoomView.linkButton.tapPublisher
.sink { [weak self] _ in
self?.input.send(.linkButtonDidTap)
}.store(in: &cancellables)

Copy link
Collaborator

@hsw1920 hsw1920 Nov 30, 2024

Choose a reason for hiding this comment

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

이부분이 방생성요청과 이어지는 부분인데 백그라운드 스레드에서 이뤄지도록 해야하지 않을까요? 실제 shareSheet를 present하는 부분만 메인으로 해야 버벅이지 않을 것 같은데 고민이군요

Copy link
Member Author

Choose a reason for hiding this comment

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

해줘 승완에몽

@Kiyoung-Kim-57
Copy link
Member

lgtm!!

…signaling

[FIX/#130] 2. 여러 사용자가 연결되지 않는 문제를 수정합니다.
@Kiyoung-Kim-57 Kiyoung-Kim-57 merged commit 4abaa2d into feat/#110-join-room-server Nov 30, 2024
@Kiyoung-Kim-57 Kiyoung-Kim-57 deleted the feat/#79-refactor-waiting-viewmodel branch November 30, 2024 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚙️ refactor 코드 정상화

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WaitingViewModel 리팩토링

5 participants