Some improvements for handling completion of transitions. Fixed a wrong conferenceEnded value when user left the conversation.
This commit is contained in:
parent
5858859838
commit
de0a7bfcd3
|
@ -38,12 +38,19 @@ 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)
|
||||
}
|
||||
|
||||
open func cleanUp() {
|
||||
// TODO: more clean up work on this
|
||||
|
||||
meetWindow.isHidden = true
|
||||
meetWindow.stopDragGesture()
|
||||
}
|
||||
|
||||
deinit {
|
||||
|
@ -52,13 +59,6 @@ open class JitsiMeetPresentationCoordinator: NSObject {
|
|||
|
||||
// MARK: - helpers
|
||||
|
||||
fileprivate func cleanUp() {
|
||||
// TODO: more clean up work on this
|
||||
|
||||
meetWindow.isHidden = true
|
||||
meetWindow.stopDragGesture()
|
||||
}
|
||||
|
||||
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…
Reference in New Issue