Skip to content

Commit 31f648f

Browse files
authored
Merge branch 'develop' into release/#70-week4-demo
2 parents 3315bd6 + 696cd9c commit 31f648f

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

PhotoGether/PresentationLayer/WaitingRoomFeature/WaitingRoomFeature/Source/ViewController/WaitingRoomViewController.swift

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,42 @@ public final class WaitingRoomViewController: BaseViewController, ViewController
126126
output.shouldShowToast.sink { [weak self] message in
127127
print(message)
128128
}.store(in: &cancellables)
129+
130+
output.localVideo.sink { [weak self] localVideoView in
131+
guard let self else { return }
132+
var snapshot = self.participantsCollectionViewController.dataSource.snapshot()
133+
var items = snapshot.itemIdentifiers
134+
135+
var newItem = SectionItem(position: .host, nickname: "나는 호스트", videoView: localVideoView)
136+
137+
guard let hostIndex = items.firstIndex(where: { $0.position == .host }) else { return }
138+
items.remove(at: hostIndex)
139+
items.insert(newItem, at: hostIndex)
140+
141+
snapshot.appendItems(items, toSection: 0)
142+
self.participantsCollectionViewController.dataSource.apply(snapshot, animatingDifferences: true)
143+
}.store(in: &cancellables)
144+
145+
output.remoteVideos.sink { [weak self] remoteVideoViews in
146+
guard let self else { return }
147+
guard let remoteVideoView = remoteVideoViews.first else { return }
148+
149+
var snapshot = self.participantsCollectionViewController.dataSource.snapshot()
150+
var items = snapshot.itemIdentifiers
151+
152+
var newItem = SectionItem(position: .guest3, nickname: "나는 게스트", videoView: remoteVideoView)
153+
154+
guard let guestIndex = items.firstIndex(where: { $0.position == .guest3 }) else { return }
155+
items.remove(at: guestIndex)
156+
items.insert(newItem, at: guestIndex)
157+
158+
snapshot.appendItems(items, toSection: 0)
159+
self.participantsCollectionViewController.dataSource.apply(snapshot, animatingDifferences: true)
160+
}.store(in: &cancellables)
161+
162+
output.shouldShowToast.sink { [weak self] message in
163+
print(message)
164+
}.store(in: &cancellables)
129165
}
130166

131167
private func setPlaceHolder() {

PhotoGether/PresentationLayer/WaitingRoomFeature/WaitingRoomFeatureDemo/App/SceneDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
5151
let sendOfferUseCase: SendOfferUseCase = SendOfferUseCaseImpl(
5252
repository: connectionRepository
5353
)
54-
54+
5555
let getLocalVideoUseCase: GetLocalVideoUseCase = GetLocalVideoUseCaseImpl(
5656
connectionRepository: connectionRepository
5757
)

0 commit comments

Comments
 (0)