浏览代码

Some improvements for handling completion of transitions. Fixed a wrong conferenceEnded value when user left the conversation.

j8
Daniel Ornelas 7 年前
父节点
当前提交
de0a7bfcd3

+ 11
- 11
ios/sdk/src/picture-in-picture/JitsiMeetPresentationCoordinator.swift 查看文件

38
         return meetViewController.jitsiMeetView
38
         return meetViewController.jitsiMeetView
39
     }
39
     }
40
     
40
     
41
-    public func show() {
42
-        meetWindow.show()
41
+    open func show(completion: CompletionAction? = nil) {
42
+        meetWindow.show(completion: completion)
43
     }
43
     }
44
     
44
     
45
-    public func hide() {
46
-        meetWindow.hide()
45
+    open func hide(completion: CompletionAction? = nil) {
46
+        meetWindow.hide(completion: completion)
47
     }
47
     }
48
     
48
     
49
-    deinit {
50
-        cleanUp()
51
-    }
52
-    
53
-    // MARK: - helpers
54
-    
55
-    fileprivate func cleanUp() {
49
+    open func cleanUp() {
56
         // TODO: more clean up work on this
50
         // TODO: more clean up work on this
57
         
51
         
58
         meetWindow.isHidden = true
52
         meetWindow.isHidden = true
59
         meetWindow.stopDragGesture()
53
         meetWindow.stopDragGesture()
60
     }
54
     }
61
     
55
     
56
+    deinit {
57
+        cleanUp()
58
+    }
59
+    
60
+    // MARK: - helpers
61
+    
62
     private func configureMeetViewController() {
62
     private func configureMeetViewController() {
63
         meetViewController.jitsiMeetView.pictureInPictureEnabled = true
63
         meetViewController.jitsiMeetView.pictureInPictureEnabled = true
64
         meetViewController.delegate = self
64
         meetViewController.delegate = self

+ 4
- 2
ios/sdk/src/picture-in-picture/JitsiMeetViewController.swift 查看文件

83
     
83
     
84
     open func conferenceLeft(_ data: [AnyHashable : Any]!) {
84
     open func conferenceLeft(_ data: [AnyHashable : Any]!) {
85
         DispatchQueue.main.async {
85
         DispatchQueue.main.async {
86
-            self.delegate?.conferenceEnded(didFail: true)
86
+            self.delegate?.conferenceEnded(didFail: false)
87
         }
87
         }
88
     }
88
     }
89
     
89
     
94
     }
94
     }
95
     
95
     
96
     open func loadConfigError(_ data: [AnyHashable : Any]!) {
96
     open func loadConfigError(_ data: [AnyHashable : Any]!) {
97
-        // do something
97
+        DispatchQueue.main.async {
98
+            self.delegate?.conferenceEnded(didFail: true)
99
+        }
98
     }
100
     }
99
     
101
     
100
     open func enterPicture(inPicture data: [AnyHashable : Any]!) {
102
     open func enterPicture(inPicture data: [AnyHashable : Any]!) {

+ 14
- 10
ios/sdk/src/picture-in-picture/PiPWindow.swift 查看文件

14
  * limitations under the License.
14
  * limitations under the License.
15
  */
15
  */
16
 
16
 
17
+/// Alias defining a completion closure that returns a Bool
18
+public typealias CompletionAction = (Bool) -> Void
19
+
17
 /// A window that allows its root view controller to be presented
20
 /// A window that allows its root view controller to be presented
18
 /// in full screen or in a custom Picture in Picture mode
21
 /// in full screen or in a custom Picture in Picture mode
19
 open class PiPWindow: UIWindow {
22
 open class PiPWindow: UIWindow {
50
     }
53
     }
51
     
54
     
52
     /// animate in the window
55
     /// animate in the window
53
-    open func show() {
56
+    open func show(completion: CompletionAction? = nil) {
54
         if self.isHidden || self.alpha < 1 {
57
         if self.isHidden || self.alpha < 1 {
55
             self.isHidden = false
58
             self.isHidden = false
56
             self.alpha = 0
59
             self.alpha = 0
57
-            animateTransition {
60
+            
61
+            animateTransition(animations: {
58
                 self.alpha = 1
62
                 self.alpha = 1
59
-            }
63
+            }, completion: completion)
60
         }
64
         }
61
     }
65
     }
62
     
66
     
63
     /// animate out the window
67
     /// animate out the window
64
-    open func hide() {
68
+    open func hide(completion: CompletionAction? = nil) {
65
         if !self.isHidden || self.alpha > 0 {
69
         if !self.isHidden || self.alpha > 0 {
66
-            animateTransition {
67
-                self.alpha = 0
68
-                self.isHidden = true
69
-            }
70
+            animateTransition(animations: {
71
+                self.alpha = 1
72
+            }, completion: completion)
70
         }
73
         }
71
     }
74
     }
72
     
75
     
175
     
178
     
176
     // MARK: - Animation transition
179
     // MARK: - Animation transition
177
     
180
     
178
-    private func animateTransition(animations: @escaping () -> Void) {
181
+    private func animateTransition(animations: @escaping () -> Void,
182
+                                   completion: CompletionAction?) {
179
         UIView.animate(withDuration: 0.1,
183
         UIView.animate(withDuration: 0.1,
180
                        delay: 0,
184
                        delay: 0,
181
                        options: .beginFromCurrentState,
185
                        options: .beginFromCurrentState,
182
                        animations: animations,
186
                        animations: animations,
183
-                       completion: nil)
187
+                       completion: completion)
184
     }
188
     }
185
 }
189
 }

正在加载...
取消
保存