@@ -76,6 +76,7 @@ public final class APNSwiftConnection {
7676 /**
7777 APNSwiftConnection send method. Sends a notification to the desired deviceToken.
7878 - Parameter notification: the notification meta data and alert to send.
79+ - Parameter bearerToken: the bearer token to authenitcate our request
7980 - Parameter deviceToken: device token to send alert to.
8081 - Parameter encoder: customer JSON encoder if needed.
8182 - Parameter expiration: a date that the notificaiton expires.
@@ -89,16 +90,17 @@ public final class APNSwiftConnection {
8990 ```
9091 let apns = APNSwiftConnection.connect()
9192 let expiry = Date().addingTimeInterval(5)
92- try apns.send(notification, to: "b27a07be2092c7fbb02ab5f62f3135c615e18acc0ddf39a30ffde34d41665276", with: JSONEncoder(), expiration: expiry, priority: 10, collapseIdentifier: "huro2").wait()
93+ let bearerToken = APNSwiftBearerToken(configuration: apnsConfig, timeout: 50.0)
94+ try apns.send(notification, bearerToken: bearerToken,to: "b27a07be2092c7fbb02ab5f62f3135c615e18acc0ddf39a30ffde34d41665276", with: JSONEncoder(), expiration: expiry, priority: 10, collapseIdentifier: "huro2").wait()
9395 ```
9496 */
95- public func send< Notification> ( _ notification: Notification , to deviceToken: String , with encoder: JSONEncoder = JSONEncoder ( ) , expiration: Date ? = nil , priority: Int ? = nil , collapseIdentifier: String ? = nil , topic: String ? = nil ) -> EventLoopFuture < Void >
97+ public func send< Notification> ( _ notification: Notification , bearerToken : APNSwiftBearerToken , to deviceToken: String , with encoder: JSONEncoder = JSONEncoder ( ) , expiration: Date ? = nil , priority: Int ? = nil , collapseIdentifier: String ? = nil , topic: String ? = nil ) -> EventLoopFuture < Void >
9698 where Notification: APNSwiftNotification {
9799 let streamPromise = channel. eventLoop. makePromise ( of: Channel . self)
98100 multiplexer. createStreamChannel ( promise: streamPromise) { channel, streamID in
99101 let handlers : [ ChannelHandler ] = [
100102 HTTP2ToHTTP1ClientCodec ( streamID: streamID, httpProtocol: . https) ,
101- APNSwiftRequestEncoder < Notification > ( deviceToken: deviceToken, configuration: self . configuration, expiration: expiration, priority: priority, collapseIdentifier: collapseIdentifier) ,
103+ APNSwiftRequestEncoder < Notification > ( deviceToken: deviceToken, configuration: self . configuration, bearerToken : bearerToken , expiration: expiration, priority: priority, collapseIdentifier: collapseIdentifier) ,
102104 APNSwiftResponseDecoder ( ) ,
103105 APNSwiftStreamHandler ( ) ,
104106 ]
0 commit comments