Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix]ringing call issue #511

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading