You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
//
|
|
|
|
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
|
|
|
|
|
extension UIApplication {
|
|
|
|
|
|
|
|
|
|
var frontmostViewController: UIViewController? {
|
|
|
|
|
let window = UIApplication.shared.keyWindow
|
|
|
|
|
var viewController = window!.rootViewController
|
|
|
|
|
|
|
|
|
|
while true {
|
|
|
|
|
if let nextViewController = viewController?.presentedViewController {
|
|
|
|
|
viewController = nextViewController
|
|
|
|
|
} else if viewController is UINavigationController {
|
|
|
|
|
let navigationController = viewController as? UINavigationController
|
|
|
|
|
if let nextViewController = navigationController?.topViewController {
|
|
|
|
|
viewController = nextViewController
|
|
|
|
|
} else {
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return viewController
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func openSystemSettings() {
|
|
|
|
|
openURL(URL(string: UIApplicationOpenSettingsURLString)!)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|