Skip to content

Commit

Permalink
Update to APNSwift 2.0 (#17)
Browse files Browse the repository at this point in the history
* Updates to APNSwift and fixes test.

* update swift tools.

* update tests.

* Fix package deps.

* dding APNS ass pakage.

* Fix package.swift

* Use local bunk cert

* Update to use ci images.
  • Loading branch information
kylebrowning authored Mar 31, 2020
1 parent 2b6acdf commit f4a1605
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ on:
- pull_request
jobs:
xenial:
container:
image: vapor/swift:5.1-xenial
container:
image: vapor/swift:5.2-xenial-ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: swift test --enable-test-discovery --sanitize=thread
bionic:
container:
image: vapor/swift:5.1-bionic
container:
image: vapor/swift:5.2-bionic-ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Expand Down
16 changes: 11 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.1
// swift-tools-version:5.2
import PackageDescription

let package = Package(
Expand All @@ -10,11 +10,17 @@ let package = Package(
.library(name: "APNS", targets: ["APNS"]),
],
dependencies: [
.package(url: "https://github.com/kylebrowning/APNSwift.git", from: "1.7.0"),
.package(url: "https://github.com/vapor/vapor.git", from: "4.0.0-beta.4"),
.package(name: "apnswift", url: "https://github.com/kylebrowning/APNSwift.git", from: "2.0.0-rc"),
.package(name: "vapor", url: "https://github.com/vapor/vapor.git", from: "4.0.0-rc"),
],
targets: [
.target(name: "APNS", dependencies: ["APNSwift", "Vapor"]),
.testTarget(name: "APNSTests", dependencies: ["APNS", "XCTVapor"]),
.target(name: "APNS", dependencies: [
.product(name: "APNSwift", package: "apnswift"),
.product(name: "Vapor", package: "vapor"),
]),
.testTarget(name: "APNSTests", dependencies: [
.target(name: "APNS"),
.product(name: "XCTVapor", package: "vapor"),
]),
]
)
20 changes: 16 additions & 4 deletions Tests/APNSTests/APNSTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,26 @@ import APNS
import XCTVapor

class APNSTests: XCTestCase {
let appleECP8PrivateKey = """
-----BEGIN PRIVATE KEY-----
MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQg2sD+kukkA8GZUpmm
jRa4fJ9Xa/JnIG4Hpi7tNO66+OGgCgYIKoZIzj0DAQehRANCAATZp0yt0btpR9kf
ntp4oUUzTV0+eTELXxJxFvhnqmgwGAm1iVW132XLrdRG/ntlbQ1yzUuJkHtYBNve
y+77Vzsd
-----END PRIVATE KEY-----
"""

func testApplication() throws {
let app = Application(.testing)
defer { app.shutdown() }

app.apns.configuration = try .init(
keyIdentifier: "9UC9ZLQ8YW",
teamIdentifier: "ABBM6U9RM5",
signer: .init(buffer: ByteBufferAllocator().buffer(capacity: 1024)),
topic: "com.grasscove.Fern",
authenticationMethod: .jwt(
key: .private(pem: Data(appleECP8PrivateKey.utf8)),
keyIdentifier: "MY_KEY_ID",
teamIdentifier: "MY_TEAM_ID"
),
topic: "MY_TOPIC",
environment: .sandbox
)

Expand All @@ -26,3 +37,4 @@ class APNSTests: XCTestCase {
}
}
}

0 comments on commit f4a1605

Please sign in to comment.