Skip to content

Commit 9423f68

Browse files
committed
Remove dead code, unused dependencies, and stale docs
1 parent 1f9d864 commit 9423f68

18 files changed

Lines changed: 58 additions & 680 deletions

Package.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ let package = Package(
2323
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
2424
.package(url: "https://github.com/apple/swift-nio.git", from: "2.42.0"),
2525
.package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.6.0"),
26-
.package(url: "https://github.com/apple/swift-nio-http2.git", from: "1.9.0"),
2726
],
2827
targets: [
2928
.executableTarget(
@@ -67,13 +66,9 @@ let package = Package(
6766
.target(
6867
name: "APNSTestServer",
6968
dependencies: [
70-
.product(name: "Logging", package: "swift-log"),
71-
.product(name: "Crypto", package: "swift-crypto"),
7269
.product(name: "NIOCore", package: "swift-nio"),
7370
.product(name: "NIOPosix", package: "swift-nio"),
74-
.product(name: "NIOSSL", package: "swift-nio-ssl"),
7571
.product(name: "NIOHTTP1", package: "swift-nio"),
76-
.product(name: "NIOHTTP2", package: "swift-nio-http2"),
7772
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
7873
]
7974
),

Package@swift-5.10.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ let package = Package(
2323
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
2424
.package(url: "https://github.com/apple/swift-nio.git", from: "2.42.0"),
2525
.package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.6.0"),
26-
.package(url: "https://github.com/apple/swift-nio-http2.git", from: "1.9.0"),
2726
],
2827
targets: [
2928
.executableTarget(
@@ -67,13 +66,9 @@ let package = Package(
6766
.target(
6867
name: "APNSTestServer",
6968
dependencies: [
70-
.product(name: "Logging", package: "swift-log"),
71-
.product(name: "Crypto", package: "swift-crypto"),
7269
.product(name: "NIOCore", package: "swift-nio"),
7370
.product(name: "NIOPosix", package: "swift-nio"),
74-
.product(name: "NIOSSL", package: "swift-nio-ssl"),
7571
.product(name: "NIOHTTP1", package: "swift-nio"),
76-
.product(name: "NIOHTTP2", package: "swift-nio-http2"),
7772
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
7873
]
7974
),

Sources/APNS/APNS.docc/APNSwift.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,8 @@ These can be configured when created your `APNSClientConfiguration`
6868
openssl pkcs8 -nocrypt -in /path/to/my/key.p8 -out ~/Downloads/key.pem
6969
```
7070

71-
## Logging
72-
By default APNSwift has a no-op logger which will not log anything. However if you pass a logger in, you will see logs.
73-
74-
There are currently two kinds of loggers.
75-
#### **Background Activity Logger**
76-
This logger can be passed into the `APNSClient` and will log background things like connection pooling, auth token refreshes, etc.
77-
78-
#### **Notification Send Logger**
79-
This logger can be passed into any of the `send:` methods and will log everything related to a single send request.
80-
8171
## Server Example
82-
Take a look at [Program.swift](https://github.com/swift-server-community/APNSwift/blob/main/Sources/APNSwiftExample/Program.swift)
72+
Take a look at [Program.swift](https://github.com/swift-server-community/APNSwift/blob/main/Sources/APNSExample/Program.swift)
8373

8474
## iOS Examples
8575

Sources/APNS/APNSBroadcastClient.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@ import struct FoundationEssentials.UUID
2121
import struct Foundation.Date
2222
import struct Foundation.UUID
2323
#endif
24-
import NIOConcurrencyHelpers
2524
import NIOCore
2625
import NIOHTTP1
2726
import NIOSSL
28-
import NIOTLS
29-
import NIOPosix
3027

3128
/// A client for managing Apple Push Notification broadcast channels.
3229
public final class APNSBroadcastClient<Decoder: APNSJSONDecoder & Sendable, Encoder: APNSJSONEncoder & Sendable>: APNSBroadcastClientProtocol {

Sources/APNS/APNSClient.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@ import struct FoundationEssentials.UUID
2121
import struct Foundation.Date
2222
import struct Foundation.UUID
2323
#endif
24-
import NIOConcurrencyHelpers
2524
import NIOCore
2625
import NIOHTTP1
2726
import NIOSSL
28-
import NIOTLS
29-
import NIOPosix
3027

3128
/// A client to talk with the Apple Push Notification services.
3229
public final class APNSClient<Decoder: APNSJSONDecoder, Encoder: APNSJSONEncoder>: APNSClientProtocol {

Sources/APNS/APNSConfiguration.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import APNSCore
1616
@preconcurrency import Crypto
1717
import NIOSSL
18-
import NIOTLS
1918
import AsyncHTTPClient
2019

2120
/// The configuration of an ``APNSClient``.

Sources/APNSCore/APNSClient.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
public protocol APNSClientProtocol {
15+
public protocol APNSClientProtocol: Sendable {
1616
func send(_ request: APNSRequest<some APNSMessage>) async throws -> APNSResponse
1717
func shutdown() async throws
1818
}

Sources/APNSCore/APNSErrorResponse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
/// A struct for the error response of APNs.
1616
///
17-
/// This is just used to decode the JSON and should not be exposed.
17+
/// This decodes the JSON body APNs returns alongside a non-success status code.
1818
public struct APNSErrorResponse: Codable, Sendable {
1919
/// The error code indicating the reason for the failure.
2020
public var reason: String

Sources/APNSCore/APNSRequest.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ import struct Foundation.UUID
1919
#endif
2020

2121
public struct APNSRequest<Message: APNSMessage> {
22-
fileprivate final class _Storage {
22+
// `_Storage` is a private copy-on-write backing store: `APNSRequest`'s mutating accessors
23+
// always check `isKnownUniquelyReferenced` before mutating in place, copying first if the
24+
// storage might be shared. That discipline guarantees exclusive access to any given
25+
// instance's mutable state, so sharing it across concurrency domains is safe even though
26+
// its properties are `var`.
27+
fileprivate final class _Storage: @unchecked Sendable {
2328
var message: Message
2429
var deviceToken: String
2530
var pushType: APNSPushType
@@ -108,6 +113,8 @@ public struct APNSRequest<Message: APNSMessage> {
108113
}
109114
}
110115

116+
extension APNSRequest: Sendable where Message: Sendable {}
117+
111118
extension APNSRequest._Storage {
112119
func copy() -> APNSRequest._Storage {
113120
APNSRequest._Storage(

0 commit comments

Comments
 (0)