瀏覽代碼

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

j8
Daniel Ornelas 7 年之前
父節點
當前提交
4bb6e5aefd
共有 1 個檔案被更改,包括 9 行新增0 行删除
  1. 9
    0
      ios/sdk/src/picture-in-picture/PiPViewCoordinator.swift

+ 9
- 0
ios/sdk/src/picture-in-picture/PiPViewCoordinator.swift 查看文件

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

Loading…
取消
儲存