Skip to content

Commit

Permalink
Fix ignored parameters in send function (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
florianreinhart authored and kylebrowning committed Dec 5, 2019
1 parent 88cc62b commit fa54364
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Sources/APNSwift/APNSwiftConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public final class APNSwiftConnection {
/**
APNSwiftConnection send method. Sends a notification to the desired deviceToken.
- Parameter notification: the notification meta data and alert to send.
- Parameter bearerToken: the bearer token to authenitcate our request
- Parameter pushType: push type of the notification.
- Parameter deviceToken: device token to send alert to.
- Parameter encoder: customer JSON encoder if needed.
- Parameter expiration: a date that the notificaiton expires.
Expand All @@ -158,15 +158,14 @@ public final class APNSwiftConnection {
```
let apns = APNSwiftConnection.connect()
let expiry = Date().addingTimeInterval(5)
let bearerToken = APNSwiftBearerToken(configuration: apnsConfig, timeout: 50.0)
try apns.send(notification, bearerToken: bearerToken,to: "b27a07be2092c7fbb02ab5f62f3135c615e18acc0ddf39a30ffde34d41665276", with: JSONEncoder(), expiration: expiry, priority: 10, collapseIdentifier: "huro2").wait()
try apns.send(notification, pushType: .alert, to: "b27a07be2092c7fbb02ab5f62f3135c615e18acc0ddf39a30ffde34d41665276", with: JSONEncoder(), expiration: expiry, priority: 10, collapseIdentifier: "huro2").wait()
```
*/
public func send<Notification: APNSwiftNotification>(_ notification: Notification, pushType: APNSwiftConnection.PushType, to deviceToken: String, with encoder: JSONEncoder = JSONEncoder(), expiration: Date? = nil, priority: Int? = nil, collapseIdentifier: String? = nil, topic: String? = nil) -> EventLoopFuture<Void> {
let data: Data = try! encoder.encode(notification)
var buffer = ByteBufferAllocator().buffer(capacity: data.count)
buffer.writeBytes(data)
return send(rawBytes: buffer, pushType: pushType, to: deviceToken)
return send(rawBytes: buffer, pushType: pushType, to: deviceToken, expiration: expiration, priority: priority, collapseIdentifier: collapseIdentifier, topic: topic)
}

/// This is to be used with caution. APNSwift cannot gurantee delivery if you do not have the correct payload.
Expand Down

0 comments on commit fa54364

Please sign in to comment.