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.
session-ios/Signal/src/UIApplication+OWS.swift

28 lines
784 B
Swift

//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
import Foundation
extension UIApplication {
var frontmostViewControllerIgnoringAlerts: UIViewController? {
return findFrontmostViewController(ignoringAlerts:true)
}
var frontmostViewController: UIViewController? {
return findFrontmostViewController(ignoringAlerts:false)
}
internal func findFrontmostViewController(ignoringAlerts: Bool) -> UIViewController? {
let window = UIApplication.shared.keyWindow
var viewController = window!.rootViewController
return viewController.findFrontmostViewController(ignoringAlerts:ignoringAlerts)
}
func openSystemSettings() {
openURL(URL(string: UIApplicationOpenSettingsURLString)!)
}
}