Skip to content

Commit 104f4cc

Browse files
committed
Remove expiration and priority from widgets
1 parent f76f607 commit 104f4cc

File tree

3 files changed

+4
-35
lines changed

3 files changed

+4
-35
lines changed

Sources/APNSCore/Widgets/APNSClient+Widgets.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ extension APNSClientProtocol {
3232
message: notification,
3333
deviceToken: deviceToken,
3434
pushType: .widgets,
35-
expiration: notification.expiration,
36-
priority: notification.priority,
35+
expiration: nil,
36+
priority: nil,
3737
apnsID: notification.apnsID,
3838
topic: notification.topic,
3939
collapseID: nil

Sources/APNSCore/Widgets/APNSWidgetsNotification.swift

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,33 +45,17 @@ public struct APNSWidgetsNotification: APNSMessage {
4545
/// The topic for the notification. In general, the topic is your app’s bundle ID/app ID suffixed with `.push-type.widgets`.
4646
public var topic: String
4747

48-
/// The date when the notification is no longer valid and can be discarded. If this value is not `none`,
49-
/// APNs stores the notification and tries to deliver it at least once,
50-
/// repeating the attempt as needed if it is unable to deliver the notification the first time.
51-
/// If the value is `immediately`, APNs treats the notification as if it expires immediately
52-
/// and does not store the notification or attempt to redeliver it.
53-
public var expiration: APNSNotificationExpiration
54-
55-
/// The priority of the notification.
56-
public var priority: APNSPriority
57-
5848
/// Initializes a new ``APNSWidgetsNotification``.
5949
///
6050
/// - Parameters:
61-
/// - expiration: The date when the notification is no longer valid and can be discarded.
62-
/// - priority: The priority of the notification.
6351
/// - appID: Your app’s bundle ID/app ID. This will be suffixed with `.push-type.widgets`.
6452
/// - apnsID: A canonical UUID that identifies the notification.
6553
@inlinable
6654
public init(
67-
expiration: APNSNotificationExpiration,
68-
priority: APNSPriority,
6955
appID: String,
7056
apnsID: UUID? = nil
7157
) {
7258
self.init(
73-
expiration: expiration,
74-
priority: priority,
7559
topic: appID + ".push-type.widgets",
7660
apnsID: apnsID
7761
)
@@ -80,19 +64,13 @@ public struct APNSWidgetsNotification: APNSMessage {
8064
/// Initializes a new ``APNSWidgetsNotification``.
8165
///
8266
/// - Parameters:
83-
/// - expiration: The date when the notification is no longer valid and can be discarded.
84-
/// - priority: The priority of the notification.
8567
/// - topic: The topic for the notification. In general, the topic is your app’s bundle ID/app ID suffixed with `.push-type.widgets`.
8668
/// - apnsID: A canonical UUID that identifies the notification.
8769
@inlinable
8870
public init(
89-
expiration: APNSNotificationExpiration,
90-
priority: APNSPriority,
9171
topic: String,
9272
apnsID: UUID? = nil
9373
) {
94-
self.expiration = expiration
95-
self.priority = priority
9674
self.topic = topic
9775
self.apnsID = apnsID
9876
}

Tests/APNSTests/Widgets/APNSWidgetsNotificationTests.swift

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,12 @@ import XCTest
1717

1818
final class APNSWidgetsNotificationTests: XCTestCase {
1919
func testAppID() {
20-
let widgetsNotification = APNSWidgetsNotification(
21-
expiration: .none,
22-
priority: .immediately,
23-
appID: "com.example.app"
24-
)
25-
20+
let widgetsNotification = APNSWidgetsNotification(appID: "com.example.app")
2621
XCTAssertEqual(widgetsNotification.topic, "com.example.app.push-type.widgets")
2722
}
2823

2924
func testEncode() throws {
30-
let widgetsNotification = APNSWidgetsNotification(
31-
expiration: .none,
32-
priority: .immediately,
33-
appID: "com.example.app"
34-
)
25+
let widgetsNotification = APNSWidgetsNotification(appID: "com.example.app")
3526

3627
let encoder = JSONEncoder()
3728
let data = try encoder.encode(widgetsNotification)

0 commit comments

Comments
 (0)