Skip to content

Commit

Permalink
Add send method with eventLoop argument
Browse files Browse the repository at this point in the history
to avoid manual `hop(to:)` call
  • Loading branch information
MihaelIsaev committed Feb 23, 2020
1 parent 21e25cc commit 82c950e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Sources/FCM/Helpers/FCM+SendMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import Vapor

extension FCM {
public func send(_ message: FCMMessageDefault) -> EventLoopFuture<String> {
_send(message)
}

public func send(_ message: FCMMessageDefault, on eventLoop: EventLoop) -> EventLoopFuture<String> {
_send(message).hop(to: eventLoop)
}

private func _send(_ message: FCMMessageDefault) -> EventLoopFuture<String> {
guard let configuration = self.configuration else {
fatalError("FCM not configured. Use app.fcm.configuration = ...")
}
Expand Down

0 comments on commit 82c950e

Please sign in to comment.