You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/WebPush/WebPushManager.swift
+38-4
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,9 @@ public actor WebPushManager: Sendable {
48
48
/// An internal flag indicating if a manager was shutdown already.
49
49
vardidShutdown=false
50
50
51
+
/// An internal flag indicating if a manager should skipShutting down its client.
52
+
varskipClientShutdown=false
53
+
51
54
/// An internal lookup of keys as provided by the VAPID configuration.
52
55
letvapidKeyLookup:[VAPID.Key.ID:VAPID.Key]
53
56
@@ -103,6 +106,34 @@ public actor WebPushManager: Sendable {
103
106
)
104
107
}
105
108
109
+
/// Initialize a manager with an unsafe HTTP Client.
110
+
///
111
+
/// - Note: You should generally not need to share an HTTP client — in fact, it is heavily discouraged, but provided as an override point should it be necessary. Instead, opt to customize a ``NetworkConfiguration-swift.struct`` and pass it to ``init(vapidConfiguration:networkConfiguration:backgroundActivityLogger:eventLoopGroupProvider:)``, or use `WebPushTesting`'s ``WebPushManager/makeMockedManager(vapidConfiguration:backgroundActivityLogger:messageHandlers:)`` if you intended to mock a ``WebPushManager`` in your tests. If these integration points are not enough, please [create an issue](https://github.com/mochidev/swift-webpush/issues) so we can support it directly.
112
+
///
113
+
/// - Important: You are responsible for shutting down the client, and there is no direct benefit to using a ``WebPushManager`` as a service if you opt for this initializer.
114
+
///
115
+
/// - Parameters:
116
+
/// - vapidConfiguration: The VAPID configuration to use when identifying the application server.
117
+
/// - networkConfiguration: The network configuration used when configuring the manager.
118
+
/// - backgroundActivityLogger: The logger to use for misconfiguration and background activity. By default, a print logger will be used, and if set to `nil`, a no-op logger will be used in release builds. When running in a server environment, your shared logger should be used instead giving you full control of logging and metadata.
119
+
/// - unsafeHTTPClient: A custom HTTP client to use.
Copy file name to clipboardExpand all lines: Sources/WebPushTesting/WebPushManager+Testing.swift
+2
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,8 @@ extension WebPushManager {
27
27
///
28
28
/// The mocked manager will forward all messages as is to its message handler so that you may either verify that a push was sent, or inspect the contents of the message that was sent.
0 commit comments