From 7df9a6a600f714a4e502376e939dbb0b52af1b37 Mon Sep 17 00:00:00 2001 From: Simon Kempendorf Date: Thu, 21 Nov 2019 12:04:04 +0100 Subject: [PATCH] Add priority --- .gitignore | 1 + Package.swift | 2 +- Sources/Gorush/GorushNotification.swift | 9 ++++++++- Tests/GorushTests/GorushTests.swift | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7a6146f..41d1bd9 100644 --- a/.gitignore +++ b/.gitignore @@ -86,6 +86,7 @@ iOSInjectionProject/ Packages xcuserdata *.xcodeproj +.swiftpm ### Xcode ### # Xcode diff --git a/Package.swift b/Package.swift index addc212..21beaa9 100755 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:4.0 +// swift-tools-version:5.1 import PackageDescription diff --git a/Sources/Gorush/GorushNotification.swift b/Sources/Gorush/GorushNotification.swift index 334a1e2..3bd7024 100644 --- a/Sources/Gorush/GorushNotification.swift +++ b/Sources/Gorush/GorushNotification.swift @@ -31,10 +31,16 @@ public struct GorushNotification: Encodable { case background } + public enum Priority: String, Content { + case normal + case high + } + let tokens: [String] let platform: Platform let topic: String let push_type: PushType? + let priority: Priority? let message: String? let title: String? @@ -43,11 +49,12 @@ 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 = "", pushType: PushType? = nil) { + 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, priority: Priority? = nil) { self.tokens = tokens self.platform = platform self.topic = topic self.push_type = pushType + self.priority = priority self.message = message self.title = title self.alert = alert diff --git a/Tests/GorushTests/GorushTests.swift b/Tests/GorushTests/GorushTests.swift index f6675af..0f712c0 100755 --- a/Tests/GorushTests/GorushTests.swift +++ b/Tests/GorushTests/GorushTests.swift @@ -3,7 +3,7 @@ import XCTest final class GorushTests: XCTestCase { func testExample() { - XCTAssertEqual(Gorush().text, "Hello, World!") + } static var allTests = [