Skip to content

Commit fa54364

Browse files
florianreinhartkylebrowning
authored andcommitted
Fix ignored parameters in send function (#70)
1 parent 88cc62b commit fa54364

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Sources/APNSwift/APNSwiftConnection.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public final class APNSwiftConnection {
144144
/**
145145
APNSwiftConnection send method. Sends a notification to the desired deviceToken.
146146
- Parameter notification: the notification meta data and alert to send.
147-
- Parameter bearerToken: the bearer token to authenitcate our request
147+
- Parameter pushType: push type of the notification.
148148
- Parameter deviceToken: device token to send alert to.
149149
- Parameter encoder: customer JSON encoder if needed.
150150
- Parameter expiration: a date that the notificaiton expires.
@@ -158,15 +158,14 @@ public final class APNSwiftConnection {
158158
```
159159
let apns = APNSwiftConnection.connect()
160160
let expiry = Date().addingTimeInterval(5)
161-
let bearerToken = APNSwiftBearerToken(configuration: apnsConfig, timeout: 50.0)
162-
try apns.send(notification, bearerToken: bearerToken,to: "b27a07be2092c7fbb02ab5f62f3135c615e18acc0ddf39a30ffde34d41665276", with: JSONEncoder(), expiration: expiry, priority: 10, collapseIdentifier: "huro2").wait()
161+
try apns.send(notification, pushType: .alert, to: "b27a07be2092c7fbb02ab5f62f3135c615e18acc0ddf39a30ffde34d41665276", with: JSONEncoder(), expiration: expiry, priority: 10, collapseIdentifier: "huro2").wait()
163162
```
164163
*/
165164
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> {
166165
let data: Data = try! encoder.encode(notification)
167166
var buffer = ByteBufferAllocator().buffer(capacity: data.count)
168167
buffer.writeBytes(data)
169-
return send(rawBytes: buffer, pushType: pushType, to: deviceToken)
168+
return send(rawBytes: buffer, pushType: pushType, to: deviceToken, expiration: expiration, priority: priority, collapseIdentifier: collapseIdentifier, topic: topic)
170169
}
171170

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

0 commit comments

Comments
 (0)