Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
1.4 kB · 39 lines
Swift
at main
12345678910111213141516171819202122232425262728293031323334353637383940import Dependenciesimport DependenciesMacros
/// The app-side transport seam used by ``NotificationsFeature``.////// Authentication, stable installation identity, and provider-specific transport are installed by/// the host. This client registers the current device token, replaces the mounted feature tree's/// desired subscriptions, and exposes incoming signals for that installation.@DependencyClientpublic struct NotificationsClient: Sendable { public var registerDestination: @Sendable ( _ destination: Push.Destination ) async throws -> Void public var replaceSubscriptions: @Sendable ( _ subscriptions: Set<NotificationSubscription> ) async throws -> Void public var synchronize: @Sendable () async throws -> Void public var signals: @Sendable () async -> AsyncStream<NotificationSignal> = { AsyncStream { $0.finish() } }}
extension NotificationsClient: TestDependencyKey { public static var testValue: Self { Self( registerDestination: { _ in }, replaceSubscriptions: { _ in }, synchronize: {}, signals: { AsyncStream { $0.finish() } } ) }}
extension DependencyValues { public var notificationsClient: NotificationsClient { get { self[NotificationsClient.self] } set { self[NotificationsClient.self] = newValue } }}