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

pull/2592/head jitsi-meet_2875
Daniel Ornelas 7 years ago committed by Lyubo Marinov
parent 5858859838
commit de0a7bfcd3
  1. 22
      ios/sdk/src/picture-in-picture/JitsiMeetPresentationCoordinator.swift
  2. 6
      ios/sdk/src/picture-in-picture/JitsiMeetViewController.swift
  3. 24
      ios/sdk/src/picture-in-picture/PiPWindow.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

@ -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]!) {

@ -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)
}
}

Loading…
Cancel
Save