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

View File

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

View File

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