Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Privatize APNSPushType #206

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/APNS/APNSClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 8 additions & 3 deletions Sources/APNSCore/APNSPushType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
///
Expand Down