Swiftpack.co - Package - vapor/apns

APNS

Helpful extensions and abstractions for using APNSwift

Github

link
Stars: 16

Releases

Fix APNSwiftConnection.isClosed - 2020-01-19 05:42:04

APNSwiftConnection.isClosed now correctly returns false if the channel is still active. Fixes #11.

Make Application.APNS an APNSwiftClient - 2020-01-09 21:34:44

In addition to req.apns, app.apns can now be used to send push notifications.

APNS 1.0.0 Beta 2.2 - 2019-12-11 02:49:29

  • app.apns.configuration is now a settable property (#6)

This allows for configuration to be accessed or modified by other code after it is set.

app.apns.configuration = try .init(keyIdentifier: ..., ...)
// later
print(app.apns.configuration?.teamIdentifier)
  • Updated to latest Vapor 4.0.0 beta (#6)

APNS 1.0.0 Beta 2.1 - 2019-12-09 22:29:05

This package provides an easy to use API for sending push notifications to Apple's APNS powered by APNSwift.

Use app.apns to configure your application:

import APNS

try app.apns.configure(.init(
    keyIdentifier: "...",
    teamIdentifier: "...",
    signer: .init(file: ...),
    topic: "codes.vapor.example",
    environment: .sandbox
))

Then use the req.apns to send pushes from a route handler:

app.get("send-push") { req -> EventLoopFuture<HTTPStatus> in
    req.apns.send(
        .init(title: "Hello", subtitle: "This is a test from vapor/apns"),
        to: "..."
    ).map { .ok }
}