Remove topic

This commit is contained in:
Christoph Hagen 2022-06-05 23:05:36 +02:00
parent 03426ab3ac
commit 91d5bd1ea5

View File

@ -49,13 +49,6 @@ public struct PushMessage: Codable {
*/
public let collapseIdentifier: String?
/**
The topic for the notification.
In general, the topic is your apps bundle ID/app ID. It can have a suffix based on the type of push notification. If youre using a certificate that supports PushKit VoIP or watchOS complication notifications, you must include this header with bundle ID of you app and if applicable, the proper suffix. If youre using token-based authentication with APNs, you must include this header with the correct bundle ID and suffix combination. To learn more about app ID, see [Register an App ID](https://help.apple.com/developer-account/#/dev1b35d6f83).
*/
public let topic: String?
/**
Create a new push message.
@ -70,14 +63,12 @@ public struct PushMessage: Codable {
public init(recipients: [PushToken],
payload: APNSwiftPayload,
pushType: APNSwiftConnection.PushType,
topic: String,
expiration: Date? = nil,
lowPriority: Bool = false,
collapseIdentifier: String? = nil) {
self.recipients = recipients
self.payload = payload
self.pushType = pushType
self.topic = topic
self.expiration = expiration
self.lowPriority = lowPriority
self.collapseIdentifier = collapseIdentifier
@ -87,3 +78,24 @@ public struct PushMessage: Codable {
extension APNSwiftConnection.PushType: Codable {
}
extension APNSwiftConnection.PushType {
/// The extension to add to the push topic depending on the notification type
var topicExtension: String {
switch self {
case .alert, .background:
return ""
case .mdm:
return ""
case .voip:
return ".voip"
case .fileprovider:
return ".pushkit.fileprovider"
//case .location:
// return ".location-query"
//case .complication:
// return ".complication"
}
}
}