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.
		
		
		
		
		
			
		
			
	
	
		
			34 lines
		
	
	
		
			1018 B
		
	
	
	
		
			Swift
		
	
		
		
			
		
	
	
			34 lines
		
	
	
		
			1018 B
		
	
	
	
		
			Swift
		
	
| 
								 
											9 years ago
										 
									 | 
							
								//
							 | 
						||
| 
								 
											7 years ago
										 
									 | 
							
								//  Copyright (c) 2019 Open Whisper Systems. All rights reserved.
							 | 
						||
| 
								 
											9 years ago
										 
									 | 
							
								//
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import Foundation
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 
											8 years ago
										 
									 | 
							
								@objc public extension UIApplication {
							 | 
						||
| 
								 
											9 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 
											7 years ago
										 
									 | 
							
								    public var frontmostViewControllerIgnoringAlerts: UIViewController? {
							 | 
						||
| 
								 
											8 years ago
										 
									 | 
							
								        return findFrontmostViewController(ignoringAlerts: true)
							 | 
						||
| 
								 
											8 years ago
										 
									 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 
											7 years ago
										 
									 | 
							
								    public var frontmostViewController: UIViewController? {
							 | 
						||
| 
								 
											8 years ago
										 
									 | 
							
								        return findFrontmostViewController(ignoringAlerts: false)
							 | 
						||
| 
								 
											8 years ago
										 
									 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    internal func findFrontmostViewController(ignoringAlerts: Bool) -> UIViewController? {
							 | 
						||
| 
								 
											8 years ago
										 
									 | 
							
								        guard let window = CurrentAppContext().mainWindow else {
							 | 
						||
| 
								 | 
							
								            return nil
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        Logger.error("findFrontmostViewController: \(window)")
							 | 
						||
| 
								 | 
							
								        guard let viewController = window.rootViewController else {
							 | 
						||
| 
								 
											7 years ago
										 
									 | 
							
								            owsFailDebug("Missing root view controller.")
							 | 
						||
| 
								 
											8 years ago
										 
									 | 
							
								            return nil
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        return viewController.findFrontmostViewController(ignoringAlerts)
							 | 
						||
| 
								 
											9 years ago
										 
									 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 
											7 years ago
										 
									 | 
							
								    public func openSystemSettings() {
							 | 
						||
| 
								 
											7 years ago
										 
									 | 
							
								        openURL(URL(string: UIApplication.openSettingsURLString)!)
							 | 
						||
| 
								 
											9 years ago
										 
									 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 
											9 years ago
										 
									 | 
							
								}
							 |