Report caught NSExceptions to Sentry

This commit is contained in:
Shadowfacts 2023-02-19 14:19:39 -05:00
parent 2a892fa6ec
commit 762d298c06
2 changed files with 8 additions and 1 deletions

View File

@ -151,6 +151,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
original(self, selector, sender)
}
}
if let exception {
SentrySDK.capture(exception: exception)
}
} as @convention(block) (UIStatusBarManager, AnyObject) -> Void)
originalIMP = class_replaceMethod(UIStatusBarManager.self, selector, imp, "v@:@")
if originalIMP == nil {

View File

@ -7,6 +7,7 @@
//
import UIKit
import Sentry
protocol TuskerSceneDelegate: UISceneDelegate {
var window: UIWindow? { get }
@ -31,11 +32,14 @@ extension TuskerSceneDelegate {
guard let window else { return }
window.overrideUserInterfaceStyle = Preferences.shared.theme
window.tintColor = Preferences.shared.accentColor.color
_ = catchNSException {
let exception = catchNSException {
let key = ["Controller", "Presentation", "root", "_"].reversed().joined()
if let rootPresentationController = window.value(forKey: key) as? UIPresentationController {
rootPresentationController.overrideTraitCollection = UITraitCollection(pureBlackDarkMode: Preferences.shared.pureBlackDarkMode)
}
}
if let exception {
SentrySDK.capture(exception: exception)
}
}
}