From 2df3943c0a00939480f8cd71b1cb448ec0621a16 Mon Sep 17 00:00:00 2001 From: Kyle Browning Date: Tue, 20 Aug 2024 08:58:49 -0700 Subject: [PATCH] Privateize APNSPushType --- Sources/APNS/APNSClient.swift | 2 +- Sources/APNSCore/APNSPushType.swift | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Sources/APNS/APNSClient.swift b/Sources/APNS/APNSClient.swift index 2e648ede..f6c8c2bc 100644 --- a/Sources/APNS/APNSClient.swift +++ b/Sources/APNS/APNSClient.swift @@ -145,7 +145,7 @@ extension APNSClient { var headers = self.defaultRequestHeaders // Push type - headers.add(name: "apns-push-type", value: request.pushType.configuration.rawValue) + headers.add(name: "apns-push-type", value: request.pushType.description) // APNS ID if let apnsID = request.apnsID { diff --git a/Sources/APNSCore/APNSPushType.swift b/Sources/APNSCore/APNSPushType.swift index 8850453d..e6152aee 100644 --- a/Sources/APNSCore/APNSPushType.swift +++ b/Sources/APNSCore/APNSPushType.swift @@ -13,8 +13,9 @@ //===----------------------------------------------------------------------===// /// A struct which represents the different supported APNs push types. -public struct APNSPushType: Hashable, Sendable { - public enum Configuration: String, Hashable, Sendable { +public struct APNSPushType: Hashable, Sendable, CustomStringConvertible { + + internal enum Configuration: String, Hashable, Sendable { case alert case background case location @@ -24,9 +25,13 @@ public struct APNSPushType: Hashable, Sendable { case mdm case liveactivity } + + public var description: String { + configuration.rawValue + } /// The underlying raw value that is send to APNs. - public var configuration: Configuration + internal var configuration: Configuration /// Use the alert push type for notifications that trigger a user interaction—for example, an alert, badge, or sound. ///