diff --git a/Package.swift b/Package.swift index 9648287..a461623 100644 --- a/Package.swift +++ b/Package.swift @@ -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"]), diff --git a/README.md b/README.md index 1dc613a..38ac4d2 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,6 @@ let client = APNSClient( ), environment: .development ), - eventLoopGroupProvider: .createNew, responseDecoder: JSONDecoder(), requestEncoder: JSONEncoder() ) diff --git a/Sources/APNS/APNS.docc/APNSwift.md b/Sources/APNS/APNS.docc/APNSwift.md index 966f4cb..e99d21e 100644 --- a/Sources/APNS/APNS.docc/APNSwift.md +++ b/Sources/APNS/APNS.docc/APNSwift.md @@ -25,7 +25,6 @@ let client = APNSClient( ), environment: .development ), - eventLoopGroupProvider: .createNew, responseDecoder: JSONDecoder(), requestEncoder: JSONEncoder() ) diff --git a/Sources/APNS/APNSBroadcastClient.swift b/Sources/APNS/APNSBroadcastClient.swift index 5c1dd94..452ca41 100644 --- a/Sources/APNS/APNSBroadcastClient.swift +++ b/Sources/APNS/APNSBroadcastClient.swift @@ -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. @@ -77,7 +78,7 @@ public final class APNSBroadcastClient( + public func sendLiveActivityNotification( _ notification: APNSLiveActivityNotification, deviceToken: String ) async throws -> APNSResponse { diff --git a/Sources/APNSCore/P256.Signing.PrivateKey+PrivateFilePath.swift b/Sources/APNSCore/P256.Signing.PrivateKey+PrivateFilePath.swift deleted file mode 100644 index e85f226..0000000 --- a/Sources/APNSCore/P256.Signing.PrivateKey+PrivateFilePath.swift +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the APNSwift open source project -// -// Copyright (c) 2022 the APNSwift project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of APNSwift project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -import Crypto - -extension P256.Signing.PrivateKey { - @available(*, deprecated, message: "Use P256.Signing.PrivateKey(pemRepresentation:) instead.") - public static func loadFrom(string: String) throws -> P256.Signing.PrivateKey { - try .init(pemRepresentation: string) - } -} diff --git a/Sources/APNSCore/Widgets/APNSClient+Widgets.swift b/Sources/APNSCore/Widgets/APNSClient+Widgets.swift index 576c481..8e23919 100644 --- a/Sources/APNSCore/Widgets/APNSClient+Widgets.swift +++ b/Sources/APNSCore/Widgets/APNSClient+Widgets.swift @@ -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) - } } diff --git a/Tests/APNSTests/APNSClientIntegrationTests.swift b/Tests/APNSTests/APNSClientIntegrationTests.swift index f503294..52b696c 100644 --- a/Tests/APNSTests/APNSClientIntegrationTests.swift +++ b/Tests/APNSTests/APNSClientIntegrationTests.swift @@ -311,7 +311,7 @@ struct APNSClientIntegrationTests { let notification = APNSWidgetsNotification(appID: "com.example.app") _ = try await client.sendWidgetsNotification( - notification: notification, + notification, deviceToken: "aaaa1111aaaa1111aaaa1111aaaa1111aaaa1111aaaa1111aaaa1111aaaa1111" ) diff --git a/Tests/APNSTests/APNSEnvironmentTests.swift b/Tests/APNSTests/APNSEnvironmentTests.swift index fcdb028..dc70650 100644 --- a/Tests/APNSTests/APNSEnvironmentTests.swift +++ b/Tests/APNSTests/APNSEnvironmentTests.swift @@ -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") diff --git a/Tests/APNSTests/APNSErrorReasonTests.swift b/Tests/APNSTests/APNSErrorReasonTests.swift index dec4b8a..85d545b 100644 --- a/Tests/APNSTests/APNSErrorReasonTests.swift +++ b/Tests/APNSTests/APNSErrorReasonTests.swift @@ -51,7 +51,6 @@ struct APNSErrorReasonTests { (.internalServerError, "InternalServerError"), (.serviceUnavailable, "ServiceUnavailable"), (.shutdown, "Shutdown"), - (.badEnvironmentKeyInToken, "BadEnvironmentKeyInToken"), (.featureNotEnabled, "FeatureNotEnabled"), (.missingChannelId, "MissingChannelId"), (.badChannelId, "BadChannelId"), @@ -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