Skip to content

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebrowning committed Aug 20, 2024
1 parent 7e51a0d commit a0be13d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 22 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 2 additions & 16 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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]
)
1 change: 0 additions & 1 deletion Sources/APNS/APNSClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import APNSCore
import AsyncHTTPClient
import Dispatch
import struct Foundation.Date
import struct Foundation.UUID
import NIOConcurrencyHelpers
Expand Down
2 changes: 0 additions & 2 deletions Sources/APNSCore/APNSClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
//
//===----------------------------------------------------------------------===//

import Dispatch

public protocol APNSClientProtocol {
func send(_ request: APNSRequest<some APNSMessage>) async throws -> APNSResponse
func shutdown() async throws
Expand Down
12 changes: 12 additions & 0 deletions Sources/APNSExample/Program.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import APNS
import Logging
import Foundation

let logger = Logger(label: "APNSwiftExample")

@available(macOS 11.0, *)
@main
struct Main {
Expand Down Expand Up @@ -48,6 +50,7 @@ struct Main {
responseDecoder: JSONDecoder(),
requestEncoder: JSONEncoder()
)

do {
try await Self.sendSimpleAlert(with: client)
try await Self.sendLocalizedAlert(with: client)
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -123,6 +128,7 @@ extension Main {
),
deviceToken: self.deviceToken
)
logger.info("successfully sent threaded alert")
}

static func sendCustomCategoryAlert(with client: some APNSClientProtocol) async throws {
Expand All @@ -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 {
Expand All @@ -161,6 +168,7 @@ extension Main {
),
deviceToken: self.deviceToken
)
logger.info("successfully sent mutable content alert")
}
}

Expand All @@ -177,6 +185,7 @@ extension Main {
),
deviceToken: self.deviceToken
)
logger.info("successfully sent background notification")
}
}

Expand All @@ -194,6 +203,7 @@ extension Main {
),
deviceToken: self.pushKitDeviceToken
)
logger.info("successfully sent VoIP notification")
}
}

Expand All @@ -210,6 +220,7 @@ extension Main {
),
deviceToken: self.fileProviderDeviceToken
)
logger.info("successfully sent FileProvider notification")
}
}

Expand All @@ -228,5 +239,6 @@ extension Main {
),
deviceToken: self.ephemeralPushToken
)
logger.info("successfully sent Push to Talk notification")
}
}

0 comments on commit a0be13d

Please sign in to comment.