mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			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.
		
		
		
		
		
			
		
			
				
	
	
		
			32 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Swift
		
	
			
		
		
	
	
			32 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Swift
		
	
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
 | 
						|
 | 
						|
import Foundation
 | 
						|
import SessionUtilitiesKit
 | 
						|
import UIKit
 | 
						|
import SignalCoreKit
 | 
						|
 | 
						|
@objc public extension UIApplication {
 | 
						|
 | 
						|
    var frontmostViewControllerIgnoringAlerts: UIViewController? {
 | 
						|
        return findFrontmostViewController(ignoringAlerts: true)
 | 
						|
    }
 | 
						|
 | 
						|
    var frontmostViewController: UIViewController? {
 | 
						|
        return findFrontmostViewController(ignoringAlerts: false)
 | 
						|
    }
 | 
						|
 | 
						|
    internal func findFrontmostViewController(ignoringAlerts: Bool) -> UIViewController? {
 | 
						|
        guard let window: UIWindow = CurrentAppContext().mainWindow else { return nil }
 | 
						|
        
 | 
						|
        guard let viewController: UIViewController = window.rootViewController else {
 | 
						|
            owsFailDebug("Missing root view controller.")
 | 
						|
            return nil
 | 
						|
        }
 | 
						|
        return viewController.findFrontmostViewController(ignoringAlerts: ignoringAlerts)
 | 
						|
    }
 | 
						|
 | 
						|
    func openSystemSettings() {
 | 
						|
        open(URL(string: UIApplication.openSettingsURLString)!, options: [:], completionHandler: nil)
 | 
						|
    }
 | 
						|
}
 |