Tusker/Packages/PushNotifications/Sources/PushNotifications/DisabledPushManager.swift

48 lines
1.1 KiB
Swift

//
// DisabledPushManager.swift
// PushNotifications
//
// Created by Shadowfacts on 4/7/24.
//
import Foundation
import UserAccounts
class DisabledPushManager: _PushManager {
var enabled: Bool {
false
}
var subscriptions: [PushSubscription] {
[]
}
func createSubscription(account: UserAccountInfo) async throws -> PushSubscription {
throw Disabled()
}
func removeSubscription(account: UserAccountInfo) {
}
func updateSubscription(account: UserAccountInfo, alerts: PushSubscription.Alerts, policy: PushSubscription.Policy) {
}
func pushSubscription(account: UserAccountInfo) -> PushSubscription? {
nil
}
func updateIfNecessary(updateSubscription: @escaping (PushSubscription) async -> Bool) async {
}
func didRegisterForRemoteNotifications(deviceToken: Data) {
}
func didFailToRegisterForRemoteNotifications(error: any Error) {
}
struct Disabled: LocalizedError {
var errorDescription: String? {
"Push notifications disabled"
}
}
}