Log Sentry installation ID

So when the user taps Get Support and logs are sent we can cross-ref
with recent crashes
This commit is contained in:
Shadowfacts 2023-04-18 10:10:15 -04:00
parent 849882287f
commit 4931665b45
1 changed files with 8 additions and 0 deletions

View File

@ -14,6 +14,7 @@ import UserAccounts
import ComposeUI import ComposeUI
let stateRestorationLogger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "StateRestoration") let stateRestorationLogger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "StateRestoration")
private let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "AppDelegate")
@UIApplicationMain @UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate { class AppDelegate: UIResponder, UIApplicationDelegate {
@ -94,6 +95,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return Preferences.shared.reportErrorsAutomatically ? event : nil return Preferences.shared.reportErrorsAutomatically ? event : nil
} }
} }
if let clazz = NSClassFromString("SentryInstallation"),
let objClazz = clazz as AnyObject as? NSObjectProtocol,
objClazz.responds(to: Selector(("id"))),
let id = objClazz.perform(Selector(("id"))).takeRetainedValue() as? String {
logger.info("Initialized Sentry with installation/user ID: \(id)")
}
} }
override func buildMenu(with builder: UIMenuBuilder) { override func buildMenu(with builder: UIMenuBuilder) {