Commit 360d54af authored by Carola Nitz's avatar Carola Nitz

VLCPlaybackController+VLCDialogProvider: Fix LoginController not displayed when miniplayer is used

The presentedViewController in that case is nil and therefore nothing is displayed
parent 7ec01229
......@@ -51,8 +51,12 @@ extension VLCPlaybackController: VLCCustomDialogRendererProtocol {
self?.dialogProvider.postUsername(username, andPassword: password, forDialogReference: reference, store: true)
}))
}
if let rootViewController = UIApplication.shared.delegate?.window??.rootViewController {
let presentingController = rootViewController.presentedViewController ?? rootViewController
presentingController.present(alertController, animated: true, completion: nil)
}
UIApplication.shared.delegate?.window??.rootViewController?.presentedViewController?.present(alertController, animated: true, completion: nil)
}
public func showQuestion(withTitle title: String, message: String, type questionType: VLCDialogQuestionType, cancel cancelString: String?, action1String: String?, action2String: String?, withReference reference: NSValue) {
......@@ -76,7 +80,10 @@ extension VLCPlaybackController: VLCCustomDialogRendererProtocol {
self?.dialogProvider.postAction(2, forDialogReference: reference)
}))
}
UIApplication.shared.delegate?.window??.rootViewController?.presentedViewController?.present(alertController, animated: true, completion: nil)
if let rootViewController = UIApplication.shared.delegate?.window??.rootViewController {
let presentingController = rootViewController.presentedViewController ?? rootViewController
presentingController.present(alertController, animated: true, completion: nil)
}
}
public func showProgress(withTitle title: String, message: String, isIndeterminate: Bool, position: Float, cancel cancelString: String?, withReference reference: NSValue) {
......@@ -88,6 +95,9 @@ extension VLCPlaybackController: VLCCustomDialogRendererProtocol {
}
public func cancelDialog(withReference reference: NSValue) {
UIApplication.shared.delegate?.window??.rootViewController?.presentedViewController?.dismiss(animated: true, completion: nil)
if let rootViewController = UIApplication.shared.delegate?.window??.rootViewController {
let presentingController = rootViewController.presentedViewController ?? rootViewController
presentingController.dismiss(animated: true, completion: nil)
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment