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

53 lines
1.1 KiB
Swift
Raw Normal View History

//
// DisabledPushManager.swift
// PushNotifications
//
// Created by Shadowfacts on 4/7/24.
//
import Foundation
import UserAccounts
class DisabledPushManager: _PushManager {
var enabled: Bool {
false
}
2024-04-09 16:35:51 +00:00
var proxyRegistration: PushProxyRegistration? {
nil
}
func createSubscription(account: UserAccountInfo) throws -> PushSubscription {
throw Disabled()
}
func removeSubscription(account: UserAccountInfo) {
}
func pushSubscription(account: UserAccountInfo) -> PushSubscription? {
nil
}
func register(transactionID: UInt64) async throws -> PushProxyRegistration {
throw Disabled()
}
func unregister() async throws {
throw Disabled()
}
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"
}
}
}