Sfoglia il codice sorgente

Implement a delegate of PiPViewCoordinator to notify when user exits Picture in Picture mode

master
Daniel Ornelas 7 anni fa
parent
commit
4bb6e5aefd
1 ha cambiato i file con 9 aggiunte e 0 eliminazioni
  1. 9
    0
      ios/sdk/src/picture-in-picture/PiPViewCoordinator.swift

+ 9
- 0
ios/sdk/src/picture-in-picture/PiPViewCoordinator.swift Vedi File

@@ -16,6 +16,11 @@
16 16
 
17 17
 public typealias AnimationCompletion = (Bool) -> Void
18 18
 
19
+public protocol PiPViewCoordinatorDelegate: class {
20
+    
21
+    func exitPictureInPicture()
22
+}
23
+
19 24
 /// Coordinates the view state of a specified view to allow
20 25
 /// to be presented in full screen or in a custom Picture in Picture mode.
21 26
 /// This object will also provide the drag and tap interactions of the view
@@ -44,6 +49,8 @@ public class PiPViewCoordinator {
44 49
             return 0.25
45 50
         }
46 51
     }()
52
+    
53
+    public weak var delegate: PiPViewCoordinatorDelegate?
47 54
 
48 55
     private(set) var isInPiP: Bool = false // true if view is in PiP mode
49 56
 
@@ -127,6 +134,8 @@ public class PiPViewCoordinator {
127 134
         let exitSelector = #selector(toggleExitPiP)
128 135
         tapGestureRecognizer?.removeTarget(self, action: exitSelector)
129 136
         tapGestureRecognizer = nil
137
+        
138
+        delegate?.exitPictureInPicture()
130 139
     }
131 140
 
132 141
     /// Reset view to provide bounds, use this method on rotation or

Loading…
Annulla
Salva