Skip to content

Commit

Permalink
Added multiple sending notifications (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrWoWander authored May 18, 2021
1 parent 1a74041 commit a880646
Showing 1 changed file with 46 additions and 1 deletion.
47 changes: 46 additions & 1 deletion Sources/APNS/Application+APNS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ extension Application {
}
}


struct PoolKey: StorageKey, LockKey {
typealias Value = EventLoopGroupConnectionPool<APNSConnectionSource>
}
Expand Down Expand Up @@ -60,6 +59,52 @@ extension Application.APNS: APNSwiftClient {
self.application.eventLoopGroup.next()
}

public func batchSend(
rawBytes payload: ByteBuffer,
pushType: APNSwiftConnection.PushType,
to deviceToken: String...,
expiration: Date?,
priority: Int?,
collapseIdentifier: String?,
topic: String?,
logger: Logger?,
apnsID: UUID? = nil)
-> EventLoopFuture<Void> {
batchSend(rawBytes: payload,
pushType: pushType,
to: deviceToken,
expiration: expiration,
priority: priority,
collapseIdentifier: collapseIdentifier,
topic: topic,
logger: logger,
apnsID: apnsID)
}

public func batchSend(
rawBytes payload: ByteBuffer,
pushType: APNSwiftConnection.PushType,
to deviceToken: [String],
expiration: Date?,
priority: Int?,
collapseIdentifier: String?,
topic: String?,
logger: Logger?,
apnsID: UUID? = nil)
-> EventLoopFuture<Void> {
deviceToken.map {
send(rawBytes: payload,
pushType: pushType,
to: $0,
expiration: expiration,
priority: priority,
collapseIdentifier: collapseIdentifier,
topic: topic,
logger: logger,
apnsID: apnsID)
}.flatten(on: self.eventLoop)
}

public func send(
rawBytes payload: ByteBuffer,
pushType: APNSwiftConnection.PushType,
Expand Down

0 comments on commit a880646

Please sign in to comment.