@@ -13,7 +13,9 @@ import UIKit
13
13
public final class StreamPictureInPictureAdapter : @unchecked Sendable {
14
14
15
15
/// 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
+ }
17
19
18
20
/// The view used as an anchor for Picture-in-Picture display.
19
21
public var sourceView : UIView ? { willSet { store? . dispatch ( . setSourceView( newValue) ) } }
@@ -37,6 +39,12 @@ public final class StreamPictureInPictureAdapter: @unchecked Sendable {
37
39
return
38
40
}
39
41
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
+
40
48
self . store = store
41
49
self . pictureInPictureController = PictureInPictureController ( store: store)
42
50
@@ -69,12 +77,6 @@ public final class StreamPictureInPictureAdapter: @unchecked Sendable {
69
77
. log ( . debug, subsystems: . pictureInPicture) { " SourceView updated: \( $0? . description ?? " - " ) . " }
70
78
. sink { _ in }
71
79
. 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
- }
78
80
}
79
81
}
80
82
}
0 commit comments