From a0be13d06b75a4eb0289d37b62bc50ab9f80219a Mon Sep 17 00:00:00 2001 From: Kyle Browning Date: Tue, 20 Aug 2024 14:39:17 -0700 Subject: [PATCH] pr feedback --- .github/workflows/swift.yml | 6 +++--- Package.swift | 18 ++---------------- Sources/APNS/APNSClient.swift | 1 - Sources/APNSCore/APNSClient.swift | 2 -- Sources/APNSExample/Program.swift | 12 ++++++++++++ 5 files changed, 17 insertions(+), 22 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 364c19a..cf02ac7 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -8,18 +8,18 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - run: swift test --enable-test-discovery + - run: swift test thread: container: image: swiftlang/swift:nightly-6.0-focal runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - run: swift test --enable-test-discovery --sanitize=thread + - run: swift test --sanitize=thread address: container: image: swiftlang/swift:nightly-6.0-focal runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - run: ASAN_OPTIONS=detect_leaks=0 swift test --enable-test-discovery --sanitize=address + - run: ASAN_OPTIONS=detect_leaks=0 swift test --sanitize=address diff --git a/Package.swift b/Package.swift index c3956c5..c09ab92 100644 --- a/Package.swift +++ b/Package.swift @@ -39,18 +39,12 @@ let package = Package( dependencies: [ .target(name: "APNSCore"), .target(name: "APNS"), - ], - swiftSettings: [ - .enableExperimentalFeature("StrictConcurrency") ] ), .target( name: "APNSCore", dependencies: [ .product(name: "Crypto", package: "swift-crypto"), - ], - swiftSettings: [ - .enableExperimentalFeature("StrictConcurrency") ] ), .target( @@ -59,9 +53,6 @@ let package = Package( .product(name: "Crypto", package: "swift-crypto"), .product(name: "AsyncHTTPClient", package: "async-http-client"), .target(name: "APNSCore"), - ], - swiftSettings: [ - .enableExperimentalFeature("StrictConcurrency") ] ), .target( @@ -74,19 +65,14 @@ let package = Package( .product(name: "NIOSSL", package: "swift-nio-ssl"), .product(name: "NIOHTTP1", package: "swift-nio"), .product(name: "NIOHTTP2", package: "swift-nio-http2"), - ], - swiftSettings: [ - .enableExperimentalFeature("StrictConcurrency") ] ), .target( name: "APNSURLSession", dependencies: [ .target(name: "APNSCore"), - ], - swiftSettings: [ - .enableExperimentalFeature("StrictConcurrency") ] ), - ] + ], + swiftLanguageVersions: [.v6] ) diff --git a/Sources/APNS/APNSClient.swift b/Sources/APNS/APNSClient.swift index 4842cdb..3f075c5 100644 --- a/Sources/APNS/APNSClient.swift +++ b/Sources/APNS/APNSClient.swift @@ -14,7 +14,6 @@ import APNSCore import AsyncHTTPClient -import Dispatch import struct Foundation.Date import struct Foundation.UUID import NIOConcurrencyHelpers diff --git a/Sources/APNSCore/APNSClient.swift b/Sources/APNSCore/APNSClient.swift index 0cf89f2..ee11f37 100644 --- a/Sources/APNSCore/APNSClient.swift +++ b/Sources/APNSCore/APNSClient.swift @@ -12,8 +12,6 @@ // //===----------------------------------------------------------------------===// -import Dispatch - public protocol APNSClientProtocol { func send(_ request: APNSRequest) async throws -> APNSResponse func shutdown() async throws diff --git a/Sources/APNSExample/Program.swift b/Sources/APNSExample/Program.swift index 1c4e753..fe4f4c7 100644 --- a/Sources/APNSExample/Program.swift +++ b/Sources/APNSExample/Program.swift @@ -17,6 +17,8 @@ import APNS import Logging import Foundation +let logger = Logger(label: "APNSwiftExample") + @available(macOS 11.0, *) @main struct Main { @@ -48,6 +50,7 @@ struct Main { responseDecoder: JSONDecoder(), requestEncoder: JSONEncoder() ) + do { try await Self.sendSimpleAlert(with: client) try await Self.sendLocalizedAlert(with: client) @@ -86,6 +89,7 @@ extension Main { ), deviceToken: self.deviceToken ) + logger.info("successfully sent simple alert notification") } static func sendLocalizedAlert(with client: some APNSClientProtocol) async throws { @@ -104,6 +108,7 @@ extension Main { ), deviceToken: self.deviceToken ) + logger.info("successfully sent alert localized notification") } static func sendThreadedAlert(with client: some APNSClientProtocol) async throws { @@ -123,6 +128,7 @@ extension Main { ), deviceToken: self.deviceToken ) + logger.info("successfully sent threaded alert") } static func sendCustomCategoryAlert(with client: some APNSClientProtocol) async throws { @@ -142,6 +148,7 @@ extension Main { ), deviceToken: self.deviceToken ) + logger.info("successfully sent custom category alert") } static func sendMutableContentAlert(with client: some APNSClientProtocol) async throws { @@ -161,6 +168,7 @@ extension Main { ), deviceToken: self.deviceToken ) + logger.info("successfully sent mutable content alert") } } @@ -177,6 +185,7 @@ extension Main { ), deviceToken: self.deviceToken ) + logger.info("successfully sent background notification") } } @@ -194,6 +203,7 @@ extension Main { ), deviceToken: self.pushKitDeviceToken ) + logger.info("successfully sent VoIP notification") } } @@ -210,6 +220,7 @@ extension Main { ), deviceToken: self.fileProviderDeviceToken ) + logger.info("successfully sent FileProvider notification") } } @@ -228,5 +239,6 @@ extension Main { ), deviceToken: self.ephemeralPushToken ) + logger.info("successfully sent Push to Talk notification") } }