Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

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

Daniel Ornelasde0a7bfcd358
diff --git a/ios/sdk/src/picture-in-picture/JitsiMeetPresentationCoordinator.swift b/ios/sdk/src/picture-in-picture/JitsiMeetPresentationCoordinator.swift
index 404bf4c01b..adc7ddd62d 100644
--- a/ios/sdk/src/picture-in-picture/JitsiMeetPresentationCoordinator.swift
+++ b/ios/sdk/src/picture-in-picture/JitsiMeetPresentationCoordinator.swift
@@ -38,27 +38,27 @@ open class JitsiMeetPresentationCoordinator: NSObject {
return meetViewController.jitsiMeetView
}
- public func show() {
- meetWindow.show()
+ open func show(completion: CompletionAction? = nil) {
+ meetWindow.show(completion: completion)
}
- public func hide() {
- meetWindow.hide()
+ open func hide(completion: CompletionAction? = nil) {
+ meetWindow.hide(completion: completion)
}
- deinit {
- cleanUp()
- }
-
- // MARK: - helpers
-
- fileprivate func cleanUp() {
+ open func cleanUp() {
// TODO: more clean up work on this
meetWindow.isHidden = true
meetWindow.stopDragGesture()
}
+ deinit {
+ cleanUp()
+ }
+
+ // MARK: - helpers
+
private func configureMeetViewController() {
meetViewController.jitsiMeetView.pictureInPictureEnabled = true
meetViewController.delegate = self
diff --git a/ios/sdk/src/picture-in-picture/JitsiMeetViewController.swift b/ios/sdk/src/picture-in-picture/JitsiMeetViewController.swift
index c9232e4284..112f4a902d 100644
--- a/ios/sdk/src/picture-in-picture/JitsiMeetViewController.swift
+++ b/ios/sdk/src/picture-in-picture/JitsiMeetViewController.swift
@@ -83,7 +83,7 @@ extension JitsiMeetViewController: JitsiMeetViewDelegate {
open func conferenceLeft(_ data: [AnyHashable : Any]!) {
DispatchQueue.main.async {
- self.delegate?.conferenceEnded(didFail: true)
+ self.delegate?.conferenceEnded(didFail: false)
}
}
@@ -94,7 +94,9 @@ extension JitsiMeetViewController: JitsiMeetViewDelegate {
}
open func loadConfigError(_ data: [AnyHashable : Any]!) {
- // do something
+ DispatchQueue.main.async {
+ self.delegate?.conferenceEnded(didFail: true)
+ }
}
open func enterPicture(inPicture data: [AnyHashable : Any]!) {
diff --git a/ios/sdk/src/picture-in-picture/PiPWindow.swift b/ios/sdk/src/picture-in-picture/PiPWindow.swift
index 1d9f8a02ef..9dd4130c33 100644
--- a/ios/sdk/src/picture-in-picture/PiPWindow.swift
+++ b/ios/sdk/src/picture-in-picture/PiPWindow.swift
@@ -14,6 +14,9 @@
* limitations under the License.
*/
+/// Alias defining a completion closure that returns a Bool
+public typealias CompletionAction = (Bool) -> Void
+
/// A window that allows its root view controller to be presented
/// in full screen or in a custom Picture in Picture mode
open class PiPWindow: UIWindow {
@@ -50,23 +53,23 @@ open class PiPWindow: UIWindow {
}
/// animate in the window
- open func show() {
+ open func show(completion: CompletionAction? = nil) {
if self.isHidden || self.alpha < 1 {
self.isHidden = false
self.alpha = 0
- animateTransition {
+
+ animateTransition(animations: {
self.alpha = 1
- }
+ }, completion: completion)
}
}
/// animate out the window
- open func hide() {
+ open func hide(completion: CompletionAction? = nil) {
if !self.isHidden || self.alpha > 0 {
- animateTransition {
- self.alpha = 0
- self.isHidden = true
- }
+ animateTransition(animations: {
+ self.alpha = 1
+ }, completion: completion)
}
}
@@ -175,11 +178,12 @@ open class PiPWindow: UIWindow {
// MARK: - Animation transition
- private func animateTransition(animations: @escaping () -> Void) {
+ private func animateTransition(animations: @escaping () -> Void,
+ completion: CompletionAction?) {
UIView.animate(withDuration: 0.1,
delay: 0,
options: .beginFromCurrentState,
animations: animations,
- completion: nil)
+ completion: completion)
}
}