Skip to content

Commit ba48609

Browse files
committed
feat/#175 :: 방은 한번만 생성할 수 있도록 처리
1 parent 017de5b commit ba48609

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

PhotoGether/PresentationLayer/WaitingRoomFeature/WaitingRoomFeature/Source/ViewModel/WaitingRoomViewModel.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public final class WaitingRoomViewModel {
2929
private let toggleLocalMicStateUseCase: ToggleLocalMicStateUseCase
3030

3131
private var isHost: Bool
32+
private var inviteLinkMessage: String?
3233
private var cancellables = Set<AnyCancellable>()
3334
private let output = PassthroughSubject<Output, Never>()
3435

@@ -131,15 +132,20 @@ public final class WaitingRoomViewModel {
131132
}
132133

133134
private func handleLinkButtonDidTap() {
135+
if let inviteLinkMessage {
136+
self.output.send(.shouldShowShareSheet(inviteLinkMessage))
137+
return
138+
}
134139
createRoomUseCase.execute()
135140
.receive(on: RunLoop.main)
136141
.sink(receiveCompletion: { [weak self] completion in
137142
if case let .failure(error) = completion {
138143
debugPrint(error.localizedDescription)
139144
self?.output.send(.shouldShowToast("Failed to create room"))
140145
}
141-
}, receiveValue: { [weak self] roomLink in
142-
self?.output.send(.shouldShowShareSheet(roomLink))
146+
}, receiveValue: { [weak self] inviteLinkMessage in
147+
self?.inviteLinkMessage = inviteLinkMessage
148+
self?.output.send(.shouldShowShareSheet(inviteLinkMessage))
143149
self?.output.send(.readyToStart)
144150
})
145151
.store(in: &cancellables)

0 commit comments

Comments
 (0)