Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ let package = Package(
.tvOS(.v16),
],
products: [
.executable(name: "APNSExample", targets: ["APNSExample"]),
.library(name: "APNS", targets: ["APNS"]),
.library(name: "APNSCore", targets: ["APNSCore"]),
.library(name: "APNSURLSession", targets: ["APNSURLSession"]),
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ let client = APNSClient(
),
environment: .development
),
eventLoopGroupProvider: .createNew,
responseDecoder: JSONDecoder(),
requestEncoder: JSONEncoder()
)
Expand Down
1 change: 0 additions & 1 deletion Sources/APNS/APNS.docc/APNSwift.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ let client = APNSClient(
),
environment: .development
),
eventLoopGroupProvider: .createNew,
responseDecoder: JSONDecoder(),
requestEncoder: JSONEncoder()
)
Expand Down
3 changes: 2 additions & 1 deletion Sources/APNS/APNSBroadcastClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import struct Foundation.UUID
#endif
import NIOCore
import NIOHTTP1
import NIOPosix
import NIOSSL

/// A client for managing Apple Push Notification broadcast channels.
Expand Down Expand Up @@ -77,7 +78,7 @@ public final class APNSBroadcastClient<Decoder: APNSJSONDecoder & Sendable, Enco
authenticationMethod: APNSClientConfiguration.AuthenticationMethod,
environment: APNSBroadcastEnvironment,
bundleID: String,
eventLoopGroupProvider: NIOEventLoopGroupProvider,
eventLoopGroupProvider: NIOEventLoopGroupProvider = .shared(MultiThreadedEventLoopGroup.singleton),
responseDecoder: Decoder,
requestEncoder: Encoder,
byteBufferAllocator: ByteBufferAllocator = .init(),
Expand Down
3 changes: 2 additions & 1 deletion Sources/APNS/APNSClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import struct Foundation.UUID
#endif
import NIOCore
import NIOHTTP1
import NIOPosix
import NIOSSL

/// A client to talk with the Apple Push Notification services.
Expand Down Expand Up @@ -72,7 +73,7 @@ public final class APNSClient<Decoder: APNSJSONDecoder, Encoder: APNSJSONEncoder
/// - byteBufferAllocator: The `ByteBufferAllocator`.
public init(
configuration: APNSClientConfiguration,
eventLoopGroupProvider: NIOEventLoopGroupProvider,
eventLoopGroupProvider: NIOEventLoopGroupProvider = .shared(MultiThreadedEventLoopGroup.singleton),
responseDecoder: Decoder,
requestEncoder: Encoder,
byteBufferAllocator: ByteBufferAllocator = .init()
Expand Down
4 changes: 0 additions & 4 deletions Sources/APNSCore/APNSEnvironment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ public struct APNSEnvironment: Sendable {
/// The production APNs environment.
public static let production = Self(url: "https://api.push.apple.com", port: 443)

/// The sandbox APNs environment.
@available(*, deprecated, renamed: "development")
public static let sandbox = development

/// The development APNs environment.
public static let development = Self(url: "https://api.sandbox.push.apple.com", port: 443)

Expand Down
12 changes: 0 additions & 12 deletions Sources/APNSCore/APNSError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public struct APNSError: Error {
case internalServerError
case serviceUnavailable
case shutdown
case badEnvironmentKeyInToken
case featureNotEnabled
case missingChannelId
case badChannelId
Expand Down Expand Up @@ -140,8 +139,6 @@ public struct APNSError: Error {
self = .serviceUnavailable
case "Shutdown":
self = .shutdown
case "BadEnvironmentKeyInToken":
self = .badEnvironmentKeyInToken
case "FeatureNotEnabled":
self = .featureNotEnabled
case "MissingChannelId":
Expand Down Expand Up @@ -231,8 +228,6 @@ public struct APNSError: Error {
return "ServiceUnavailable"
case .shutdown:
return "Shutdown"
case .badEnvironmentKeyInToken:
return "BadEnvironmentKeyInToken"
case .featureNotEnabled:
return "FeatureNotEnabled"
case .missingChannelId:
Expand Down Expand Up @@ -322,8 +317,6 @@ public struct APNSError: Error {
return "The service is unavailable"
case .shutdown:
return "The server is shutting down"
case .badEnvironmentKeyInToken:
return "Environment mismatch between key and APNs endpoint"
case .featureNotEnabled:
return "The broadcast push feature isn't enabled for this topic"
case .missingChannelId:
Expand Down Expand Up @@ -488,11 +481,6 @@ public struct APNSError: Error {
return .init(_reason: .shutdown)
}

@available(*, deprecated, message: "Not a documented APNs error reason; see badEnvironmentKeyIdInToken.")
public static var badEnvironmentKeyInToken: Self {
return .init(_reason: .badEnvironmentKeyInToken)
}

public static var featureNotEnabled: Self {
return .init(_reason: .featureNotEnabled)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extension APNSClientProtocol {
///
@discardableResult
@inlinable
public func sendLiveActivityNotification<ContentState: Encodable>(
public func sendLiveActivityNotification<ContentState: Encodable & Sendable>(
_ notification: APNSLiveActivityNotification<ContentState>,
deviceToken: String
) async throws -> APNSResponse {
Expand Down
22 changes: 0 additions & 22 deletions Sources/APNSCore/P256.Signing.PrivateKey+PrivateFilePath.swift

This file was deleted.

18 changes: 0 additions & 18 deletions Sources/APNSCore/Widgets/APNSClient+Widgets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,4 @@ extension APNSClientProtocol {
)
return try await send(request)
}

/// Sends a widgets update notification to APNs.
///
/// - Parameters:
/// - notification: The notification to send.
///
/// - deviceToken: The hexadecimal bytes that identify the user’s device. Your app receives the bytes for this device token
/// when registering for remote notifications.
///
@discardableResult
@inlinable
@available(*, deprecated, renamed: "sendWidgetsNotification(_:deviceToken:)")
public func sendWidgetsNotification(
notification: APNSWidgetsNotification,
deviceToken: String
) async throws -> APNSResponse {
try await self.sendWidgetsNotification(notification, deviceToken: deviceToken)
}
}
2 changes: 1 addition & 1 deletion Tests/APNSTests/APNSClientIntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ struct APNSClientIntegrationTests {
let notification = APNSWidgetsNotification(appID: "com.example.app")

_ = try await client.sendWidgetsNotification(
notification: notification,
notification,
deviceToken: "aaaa1111aaaa1111aaaa1111aaaa1111aaaa1111aaaa1111aaaa1111aaaa1111"
)

Expand Down
9 changes: 0 additions & 9 deletions Tests/APNSTests/APNSEnvironmentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ struct APNSEnvironmentTests {
#expect(APNSEnvironment.development.absoluteURL == "https://api.sandbox.push.apple.com:443/3/device")
}

@available(*, deprecated, message: "Intentionally exercising the deprecated `.sandbox` alias.")
@Test func `Sandbox is alias for development`() {
// `.sandbox` is deprecated in favor of `.development`, but must remain behaviorally identical.
let sandbox = APNSEnvironment.sandbox
#expect(sandbox.url == APNSEnvironment.development.url)
#expect(sandbox.port == APNSEnvironment.development.port)
#expect(sandbox.absoluteURL == APNSEnvironment.development.absoluteURL)
}

@Test func `Custom composes URL and port`() {
let custom = APNSEnvironment.custom(url: "http://127.0.0.1", port: 8080)
#expect(custom.url == "http://127.0.0.1")
Expand Down
7 changes: 1 addition & 6 deletions Tests/APNSTests/APNSErrorReasonTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ struct APNSErrorReasonTests {
(.internalServerError, "InternalServerError"),
(.serviceUnavailable, "ServiceUnavailable"),
(.shutdown, "Shutdown"),
(.badEnvironmentKeyInToken, "BadEnvironmentKeyInToken"),
(.featureNotEnabled, "FeatureNotEnabled"),
(.missingChannelId, "MissingChannelId"),
(.badChannelId, "BadChannelId"),
Expand Down Expand Up @@ -84,11 +83,7 @@ struct APNSErrorReasonTests {
/// guard against the two being conflated.
@Test func `Similar environment reasons are distinct`() {
#expect(
APNSError.ErrorReason.Reason.badEnvironmentKeyInToken
!= APNSError.ErrorReason.Reason.badEnvironmentKeyIdInToken
)
#expect(
APNSError.ErrorReason.Reason(rawValue: "BadEnvironmentKeyInToken") == .badEnvironmentKeyInToken
APNSError.ErrorReason.Reason(rawValue: "BadEnvironmentKeyInToken") == .unknown("BadEnvironmentKeyInToken")
)
#expect(
APNSError.ErrorReason.Reason(rawValue: "BadEnvironmentKeyIdInToken") == .badEnvironmentKeyIdInToken
Expand Down
Loading