Don't use Sentry in PushNotifications package

This commit is contained in:
Shadowfacts 2024-04-09 11:56:22 -04:00
parent e150856e91
commit 840b83012a
3 changed files with 5 additions and 9 deletions

View File

@ -7,9 +7,6 @@
import Foundation
import OSLog
#if canImport(Sentry)
import Sentry
#endif
import Pachyderm
import UserAccounts
@ -18,6 +15,9 @@ public struct PushManager {
public static let shared = createPushManager()
public static let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "PushManager")
@MainActor
public static var captureError: ((any Error) -> Void)?
private init() {}

View File

@ -7,9 +7,6 @@
import UIKit
import UserAccounts
#if canImport(Sentry)
import Sentry
#endif
import CryptoKit
class PushManagerImpl: _PushManager {
@ -150,9 +147,7 @@ class PushManagerImpl: _PushManager {
}
} catch {
PushManager.logger.error("Failed to update push registration: \(String(describing: error), privacy: .public)")
#if canImport(Sentry)
SentrySDK.capture(error: error)
#endif
PushManager.captureError?(error)
}
}

View File

@ -85,6 +85,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
BackgroundManager.shared.registerHandlers()
Task {
PushManager.captureError = { SentrySDK.capture(error: $0) }
await PushManager.shared.updateIfNecessary()
}