mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Merge branch 'charlesmchen/callsVsPermissionsCrashes'
This commit is contained in:
commit
f3fa107e47
3 changed files with 20 additions and 5 deletions
|
@ -6,12 +6,25 @@ 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
|
||||
|
||||
|
||||
while true {
|
||||
if let nextViewController = viewController?.presentedViewController {
|
||||
if ignoringAlerts {
|
||||
if nextViewController as? UIAlertController != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
viewController = nextViewController
|
||||
} else if let navigationController = viewController as? UINavigationController {
|
||||
if let nextViewController = navigationController.topViewController {
|
||||
|
|
|
@ -79,7 +79,7 @@ enum CallError: Error {
|
|||
}
|
||||
|
||||
// Should be roughly synced with Android client for consistency
|
||||
fileprivate let connectingTimeoutSeconds = 120
|
||||
private let connectingTimeoutSeconds = 120
|
||||
|
||||
// All Observer methods will be invoked from the main thread.
|
||||
protocol CallServiceObserver: class {
|
||||
|
@ -1621,9 +1621,11 @@ protocol CallServiceObserver: class {
|
|||
return
|
||||
}
|
||||
|
||||
guard nil != UIApplication.shared.frontmostViewController as? CallViewController else {
|
||||
let frontmostViewController = UIApplication.shared.frontmostViewControllerIgnoringAlerts
|
||||
|
||||
guard nil != frontmostViewController as? CallViewController else {
|
||||
OWSProdError(OWSAnalyticsEvents.callServiceCallViewCouldNotPresent(), file:#file, function:#function, line:#line)
|
||||
owsFail("\(TAG) in \(#function) Call terminated due to call view presentation delay.")
|
||||
owsFail("\(TAG) in \(#function) Call terminated due to call view presentation delay: \(frontmostViewController.debugDescription).")
|
||||
self.terminateCall()
|
||||
return
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ class PeerConnectionClient: NSObject, RTCPeerConnectionDelegate, RTCDataChannelD
|
|||
return
|
||||
}
|
||||
guard let videoCaptureSession = self.videoCaptureSession else {
|
||||
owsFail("\(self.TAG) videoCaptureSession was unexpectedly nil")
|
||||
Logger.debug("\(self.TAG) videoCaptureSession was unexpectedly nil")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue