Tusker/Tusker/AppDelegate.swift

48 lines
1.4 KiB
Swift
Raw Normal View History

2018-08-16 02:27:48 +00:00
//
// AppDelegate.swift
// Tusker
//
// Created by Shadowfacts on 8/15/18.
// Copyright © 2018 Shadowfacts. All rights reserved.
//
import UIKit
2020-06-21 03:11:35 +00:00
import CrashReporter
2018-08-16 02:27:48 +00:00
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
2020-06-21 03:11:35 +00:00
static private(set) var crashReporter: PLCrashReporter!
static var pendingCrashReport: PLCrashReport?
2018-08-16 02:27:48 +00:00
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
2020-06-21 03:11:35 +00:00
#if !DEBUG
setupCrashReporter()
#endif
2019-09-19 20:55:15 +00:00
AppShortcutItem.createItems(for: application)
DispatchQueue.global(qos: .userInitiated).async {
AudioSessionHelper.disable()
AudioSessionHelper.setDefault()
}
2018-08-16 02:27:48 +00:00
return true
}
2020-06-21 03:11:35 +00:00
private func setupCrashReporter() {
let config = PLCrashReporterConfig(signalHandlerType: .BSD, symbolicationStrategy: .all)
AppDelegate.crashReporter = PLCrashReporter(configuration: config)
if AppDelegate.crashReporter.hasPendingCrashReport() {
let data = try! AppDelegate.crashReporter.loadPendingCrashReportDataAndReturnError()
AppDelegate.crashReporter.purgePendingCrashReport()
let report = try! PLCrashReport(data: data)
AppDelegate.pendingCrashReport = report
}
AppDelegate.crashReporter.enable()
}
2018-08-16 02:27:48 +00:00
}