Ver código fonte

Fix iPad rotation related issue when in PiP

master
Daniel Ornelas 7 anos atrás
pai
commit
7822155e5e

+ 2
- 2
ios/example-pip-app/src/ViewController.swift Ver arquivo

@@ -32,8 +32,8 @@ class ViewController: UIViewController {
32 32
     @IBAction func openJitsiMeet(sender: Any?) {
33 33
         let jitsiMeetCoordinator = JitsiMeetPresentationCoordinator()
34 34
         self.jitsiMeetCoordinator = jitsiMeetCoordinator
35
-        jitsiMeetCoordinator.jitsiMeetView().welcomePageEnabled = true
36
-        jitsiMeetCoordinator.jitsiMeetView().load(nil)
35
+        jitsiMeetCoordinator.jitsiMeetView.welcomePageEnabled = true
36
+        jitsiMeetCoordinator.jitsiMeetView.load(nil)
37 37
         jitsiMeetCoordinator.show()
38 38
     }
39 39
 }

+ 17
- 7
ios/sdk/src/picture-in-picture/JitsiMeetPresentationCoordinator.swift Ver arquivo

@@ -20,8 +20,20 @@ import Foundation
20 20
 /// an external window that can be resized and dragged with custom PiP mode
21 21
 open class JitsiMeetPresentationCoordinator: NSObject {
22 22
     
23
-    fileprivate let meetViewController: JitsiMeetViewController
24
-    fileprivate let meetWindow: PiPWindow
23
+    public let meetViewController: JitsiMeetViewController
24
+    public let meetWindow: PiPWindow
25
+    
26
+    public var isInPiP: Bool {
27
+        get {
28
+            return meetWindow.isInPiP
29
+        }
30
+    }
31
+    
32
+    public var jitsiMeetView: JitsiMeetView {
33
+        get {
34
+            return meetViewController.jitsiMeetView
35
+        }
36
+    }
25 37
     
26 38
     public init(meetViewController: JitsiMeetViewController? = nil,
27 39
                 meetWindow: PiPWindow? = nil) {
@@ -34,14 +46,12 @@ open class JitsiMeetPresentationCoordinator: NSObject {
34 46
         configureMeetViewController()
35 47
     }
36 48
     
37
-    public func jitsiMeetView() -> JitsiMeetView {
38
-        return meetViewController.jitsiMeetView
39
-    }
40
-    
49
+    /// Show window with jitsi meet and perform a completion closure
41 50
     open func show(completion: CompletionAction? = nil) {
42 51
         meetWindow.show(completion: completion)
43 52
     }
44 53
     
54
+    /// Hide window with jitsi meet and perform a completion closure
45 55
     open func hide(completion: CompletionAction? = nil) {
46 56
         meetWindow.hide(completion: completion)
47 57
     }
@@ -77,7 +87,7 @@ extension JitsiMeetPresentationCoordinator: JitsiMeetViewControllerDelegate {
77 87
         switch to {
78 88
         case .enterPictureInPicture:
79 89
             meetWindow.enterPictureInPicture()
80
-        case .traitChange:
90
+        case .sizeChange:
81 91
             // resize to full screen if rotation happens
82 92
             if meetWindow.isInPiP {
83 93
                 meetWindow.exitPictureInPicture()

+ 6
- 5
ios/sdk/src/picture-in-picture/JitsiMeetViewController.swift Ver arquivo

@@ -19,8 +19,8 @@ public enum JitsiMeetPresentationUpdate {
19 19
     /// The conference wants to enter Picture-in-Picture
20 20
     case enterPictureInPicture
21 21
     
22
-    /// A system traitCollectionChange (usually screen rotation)
23
-    case traitChange
22
+    /// A screen size change (usually screen rotation)
23
+    case sizeChange
24 24
 }
25 25
 
26 26
 public protocol JitsiMeetViewControllerDelegate: class {
@@ -59,9 +59,10 @@ open class JitsiMeetViewController: UIViewController {
59 59
         
60 60
         jitsiMeetView.delegate = self
61 61
     }
62
-    
63
-    open override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
64
-        delegate?.performPresentationUpdate(to: .traitChange)
62
+ 
63
+    open override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
64
+        super.viewWillTransition(to: size, with: coordinator)
65
+        delegate?.performPresentationUpdate(to: .sizeChange)
65 66
     }
66 67
 }
67 68
 

+ 11
- 1
ios/sdk/src/picture-in-picture/PiPWindow.swift Ver arquivo

@@ -32,7 +32,17 @@ open class PiPWindow: UIWindow {
32 32
     }
33 33
     
34 34
     /// The size ratio for root view controller view when in PiP mode
35
-    public var pipSizeRatio: CGFloat = 0.333
35
+    public var pipSizeRatio: CGFloat = {
36
+        let deviceIdiom = UIScreen.main.traitCollection.userInterfaceIdiom
37
+        switch (deviceIdiom) {
38
+        case .pad:
39
+            return 0.25
40
+        case .phone:
41
+            return 0.33
42
+        default:
43
+            return 0.25
44
+        }
45
+    }()
36 46
     
37 47
     /// The PiP state of this contents of the window
38 48
     private(set) var isInPiP: Bool = false

+ 9
- 1
react/features/base/responsive-ui/actions.js Ver arquivo

@@ -7,8 +7,16 @@ import type { Dispatch } from 'redux';
7 7
 
8 8
 /**
9 9
  * Size threshold for determining if we are in reduced UI mode or not.
10
+ *
11
+ * FIXME The logic to base {@code reducedUI} on a hardcoded width or height is
12
+ * very brittle because it's completely disconnected from the UI which wants to
13
+ * be rendered and, naturally, it broke on iPad where even the secondary Toolbar
14
+ * didn't fit in the height. We do need to measure the actual UI at runtime and
15
+ * determine whether and how to render it. I'm bumping from 240 to 300 because I
16
+ * don't have the time now to refactor {@code ReducedUIDetector} or rip it out
17
+ * completely.
10 18
  */
11
-const REDUCED_UI_THRESHOLD = 240;
19
+const REDUCED_UI_THRESHOLD = 300;
12 20
 
13 21
 /**
14 22
  * Sets the aspect ratio of the app's user interface based on specific width and

Carregando…
Cancelar
Salvar