Skip to content

4.0.0-alpha.2

Pre-release
Pre-release
Compare
Choose a tag to compare
@kylebrowning kylebrowning released this 16 Jun 14:14
· 17 commits to main since this release

What's Changed

  • Use HTTP Client from vapor and update APNS library, add multiple configs by @kylebrowning in #46

This is a breaking change and requires new configuration when starting up vapor.

let authenticationConfig: APNSConfiguration.Authentication = .init(
    privateKey: try .loadFrom(string: appleECP8PrivateKey),
    teamIdentifier: "ABBM6U9RM5",
    keyIdentifier: "9UC9ZLQ8YW"
)

let apnsConfig: APNSConfiguration = .init(
    authenticationConfig: authenticationConfig,
    topic: "MY_TOPIC",
    environment: .sandbox,
    eventLoopGroupProvider: .shared(app.eventLoopGroup),
    logger: app.logger
)
app.apns.containers.use(apnsConfig, as: .default)

if you're loading your p8 file from disk, use loadFrom(filePath:)

let authenticationConfig: APNSConfiguration.Authentication = .init(
        privateKey: try .loadFrom(filePath: "/Users/kylebrowning/Documents/AuthKey_9UC9ZLQ8YW.p8"),
        teamIdentifier: "ABBM6U9RM5",
        keyIdentifier: "9UC9ZLQ8YW"
    )

You can also choose to send sandbox/prod environment on the notification send function

try await apns.client.send(aps, to: deviceToken, on: .sandbox)

Full Changelog: 3.0.0...4.0.0-alpha.2