From df1c06394cf249782b13e9a1bb78de065eda52b2 Mon Sep 17 00:00:00 2001 From: Fabio Tacke Date: Fri, 4 Oct 2019 12:01:50 +0200 Subject: [PATCH] Add push type header field --- Sources/Gorush/GorushNotification.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Sources/Gorush/GorushNotification.swift b/Sources/Gorush/GorushNotification.swift index 3af758d..ff4ccfa 100644 --- a/Sources/Gorush/GorushNotification.swift +++ b/Sources/Gorush/GorushNotification.swift @@ -26,9 +26,15 @@ public struct GorushNotification: Encodable { case android = 2 } + public enum PushType: String, Content { + case alert + case background + } + let tokens: [String] let platform: Platform let topic: String + let push_type: PushType? let message: String let title: String? @@ -37,10 +43,11 @@ public struct GorushNotification: Encodable { let data: AnyEncodable? let content_available: Bool? - public init(tokens: [String], platform: GorushNotification.Platform, message: String, title: String? = nil, alert: GorushNotification.iosAlertPayload? = nil, data: Encodable? = nil, content_available: Bool? = nil, topic: String = "") { + public init(tokens: [String], platform: GorushNotification.Platform, message: String, title: String? = nil, alert: GorushNotification.iosAlertPayload? = nil, data: Encodable? = nil, content_available: Bool? = nil, topic: String = "", pushType: PushType? = nil) { self.tokens = tokens self.platform = platform self.topic = topic + self.push_type = pushType self.message = message self.title = title self.alert = alert