Skip to content

Commit

Permalink
[Fix]Ringing call screen closing immediately (#511)
Browse files Browse the repository at this point in the history
  • Loading branch information
ipavlidakis committed Sep 24, 2024
1 parent 7aa9b61 commit 174350d
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions Sources/StreamVideoSwiftUI/CallViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,15 @@ open class CallViewModel: ObservableObject {
self?.recordingState = newState
})
reconnectionUpdates = call?.state.$reconnectionStatus
.dropFirst()
.receive(on: RunLoop.main)
.sink(receiveValue: { [weak self] reconnectionStatus in
if reconnectionStatus == .reconnecting {
if self?.callingState != .reconnecting {
self?.callingState = .reconnecting
}
} else if reconnectionStatus == .disconnected {
self?.leaveCall()
} else {
if self?.callingState != .inCall && self?.callingState != .outgoing {
self?.callingState = .inCall
guard let self else { return }
switch reconnectionStatus {
case .reconnecting where callingState != .reconnecting:
callingState = .reconnecting
default:
if callingState != .inCall, callingState != .outgoing {
callingState = .inCall
}
}
})
Expand Down

0 comments on commit 174350d

Please sign in to comment.