Skip to content

Commit 433f2b0

Browse files
committed
Fix tests
1 parent b098bf5 commit 433f2b0

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Sources/StreamVideoSwiftUI/Utils/PictureInPicture/StreamPictureInPictureAdapter.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ import UIKit
1313
public final class StreamPictureInPictureAdapter: @unchecked Sendable {
1414

1515
/// The active call instance.
16-
public var call: Call? { willSet { store?.dispatch(.setCall(call)) } }
16+
public var call: Call? {
17+
willSet { store?.dispatch(.setCall(newValue)) }
18+
}
1719

1820
/// The view used as an anchor for Picture-in-Picture display.
1921
public var sourceView: UIView? { willSet { store?.dispatch(.setSourceView(newValue)) } }
@@ -37,6 +39,12 @@ public final class StreamPictureInPictureAdapter: @unchecked Sendable {
3739
return
3840
}
3941

42+
/// If the call was updated before we create our store internally, make sure that we will
43+
/// set the Call correctly.
44+
if store.state.call?.cId != call?.cId {
45+
store.dispatch(.setCall(call))
46+
}
47+
4048
self.store = store
4149
self.pictureInPictureController = PictureInPictureController(store: store)
4250

@@ -69,12 +77,6 @@ public final class StreamPictureInPictureAdapter: @unchecked Sendable {
6977
.log(.debug, subsystems: .pictureInPicture) { "SourceView updated: \($0?.description ?? "-")." }
7078
.sink { _ in }
7179
.store(in: disposableBag)
72-
73-
/// If the call was updated before we create our store internally, make sure that we will
74-
/// set the Call correctly.
75-
if store.state.call == nil, let call {
76-
store.dispatch(.setCall(call))
77-
}
7880
}
7981
}
8082
}

0 commit comments

Comments
 (0)