Skip to content

Commit 95d5f06

Browse files
authored
fix: disable video when user left the call - WPB-24188 (#4463)
1 parent 670a6f8 commit 95d5f06

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

wire-ios-sync-engine/Source/Calling/WireCallCenterV3.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ public extension WireCallCenterV3 {
849849
shouldRing: false,
850850
degraded: isDegraded(conversationId: conversationId)
851851
)
852-
callSnapshots[conversationId] = previousSnapshot.update(with: callState)
852+
callSnapshots[conversationId] = previousSnapshot.update(with: callState).updateVideoState(.stopped)
853853
} else {
854854
callSnapshots[conversationId] = previousSnapshot.update(with: .terminating(reason: reason))
855855
}

wire-ios-sync-engine/Tests/Source/Calling/WireCallCenterV3Tests.swift

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,6 +1887,52 @@ extension WireCallCenterV3Tests {
18871887
)
18881888
}
18891889

1890+
func testThatClosingAGroupCallResetsVideoState() {
1891+
// given
1892+
sut.handleIncomingCall(
1893+
conversationId: groupConversationID.serialized,
1894+
messageTime: Date(),
1895+
userId: otherUserID.serialized,
1896+
clientId: otherUserClientID,
1897+
isVideoCall: true,
1898+
shouldRing: true,
1899+
conversationType: .group
1900+
)
1901+
XCTAssert(waitForAllGroupsToBeEmpty(withTimeout: 0.5))
1902+
1903+
sut.setVideoState(conversationId: groupConversationID, videoState: .started)
1904+
XCTAssertEqual(sut.videoState(conversationId: groupConversationID), .started)
1905+
1906+
// when
1907+
sut.closeCall(conversationId: groupConversationID)
1908+
1909+
// then
1910+
XCTAssertEqual(sut.videoState(conversationId: groupConversationID), .stopped)
1911+
}
1912+
1913+
func testThatRejoiningGroupCallAfterEnablingVideoStartsWithVideoDisabled() {
1914+
// given
1915+
sut.handleIncomingCall(
1916+
conversationId: groupConversationID.serialized,
1917+
messageTime: Date(),
1918+
userId: otherUserID.serialized,
1919+
clientId: otherUserClientID,
1920+
isVideoCall: true,
1921+
shouldRing: true,
1922+
conversationType: .group
1923+
)
1924+
XCTAssert(waitForAllGroupsToBeEmpty(withTimeout: 0.5))
1925+
sut.setVideoState(conversationId: groupConversationID, videoState: .started)
1926+
sut.closeCall(conversationId: groupConversationID)
1927+
1928+
// when
1929+
sut.handleEstablishedCall(conversationId: groupConversationID.serialized)
1930+
XCTAssert(waitForAllGroupsToBeEmpty(withTimeout: 0.5))
1931+
1932+
// then
1933+
XCTAssertEqual(sut.videoState(conversationId: groupConversationID), .stopped)
1934+
}
1935+
18901936
func testThatItWhenClosingAOneOnOneCallItDoesNotSetTheCallStateToIncomingInactive() {
18911937
// given
18921938
sut.handleIncomingCall(

0 commit comments

Comments
 (0)