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 6, 2024
1 parent 6224a22 commit 210e99b
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions Sources/StreamVideoSwiftUI/CallViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,17 @@ 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
case .disconnected where callingState == .inCall:
leaveCall()
default:
if callingState != .inCall, callingState != .outgoing {
callingState = .inCall
}
}
})
Expand Down

0 comments on commit 210e99b

Please sign in to comment.