Skip to content

Commit fd35096

Browse files
committed
Change naming of some classes
1 parent 04b8565 commit fd35096

File tree

6 files changed

+28
-29
lines changed

6 files changed

+28
-29
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,3 @@ playground.xcworkspace
2121
*.xccheckout
2222
*.xcscmblueprint
2323
xcuserdata/
24-
CertificateConfig.plist

Sources/SwiftyAPNS/Notification.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ import Foundation
1010

1111
public struct APNSNotification {
1212
/// The Remote Notification Payload.
13-
public var payload: Payload
13+
public var payload: APNSPayload
1414

1515
/// Specify the hexadecimal string of the device token for the target device.
1616
public var token: String
1717

1818
/// The optional settings for the notification
19-
public var options: NotificationOptions
19+
public var options: APNSNotificationOptions
2020

21-
public init(payload: Payload, token: String, options: NotificationOptions = NotificationOptions.default) {
21+
public init(payload: APNSPayload, token: String, options: APNSNotificationOptions = APNSNotificationOptions.default) {
2222
self.payload = payload
2323
self.token = token
2424
self.options = options

Sources/SwiftyAPNS/NotificationOptions.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import Foundation
1010

1111
/// Request headers.
12-
public struct NotificationOptions {
12+
public struct APNSNotificationOptions {
1313
/// The value of this header must accurately reflect the contents of your notifications payload.
1414
public var type: APNSType?
1515

@@ -44,9 +44,9 @@ public struct NotificationOptions {
4444
}
4545
}
4646

47-
extension NotificationOptions {
48-
public static var `default`: NotificationOptions {
49-
return NotificationOptions()
47+
extension APNSNotificationOptions {
48+
public static var `default`: APNSNotificationOptions {
49+
return APNSNotificationOptions()
5050
}
5151

5252
public enum APNSType: String {

Sources/SwiftyAPNS/Payload.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import Foundation
1111
/// Each remote notification includes a payload.
1212
/// The payload contains information about how the system should alert the user as well
1313
/// as any custom data you provide.
14-
public class Payload: Encodable {
15-
public var aps: APS
14+
public class APNSPayload: Encodable {
15+
public var aps: APS?
1616

1717
public init(alert: APSAlert?, badge: Int?, sound: String?, contentAvailable: Int?, mutableContent: Int?, category: String?, threadId: String?) {
1818
var aps = APS()
@@ -34,12 +34,12 @@ public class Payload: Encodable {
3434
self.init(alert: alert, badge: badge, sound: sound, contentAvailable: nil, mutableContent: nil, category: category, threadId: nil)
3535
}
3636

37-
public static var background: Payload {
38-
return Payload(alert: nil, badge: nil, sound: nil, contentAvailable: 1, mutableContent: nil, category: nil, threadId: nil)
37+
public static var background: APNSPayload {
38+
return APNSPayload(alert: nil, badge: nil, sound: nil, contentAvailable: 1, mutableContent: nil, category: nil, threadId: nil)
3939
}
4040

41-
public static var mutable: Payload {
42-
return Payload(alert: nil, badge: nil, sound: nil, contentAvailable: 0, mutableContent: 1, category: nil, threadId: nil)
41+
public static var mutable: APNSPayload {
42+
return APNSPayload(alert: nil, badge: nil, sound: nil, contentAvailable: 0, mutableContent: 1, category: nil, threadId: nil)
4343
}
4444
}
4545

Tests/SwiftyAPNSTests/CustomPayloads.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import Foundation
77
@testable import SwiftyAPNS
88

9-
public class CustomPayload1: Payload {
9+
public class CustomPayload1: APNSPayload {
1010

1111
public let acme1: String
1212
public let acme2: Int
@@ -36,7 +36,7 @@ public class CustomPayload1: Payload {
3636
}
3737
}
3838

39-
public class CustomPayload2: Payload {
39+
public class CustomPayload2: APNSPayload {
4040

4141
public let acme1: [String]
4242

@@ -56,7 +56,7 @@ public class CustomPayload2: Payload {
5656
}
5757
}
5858

59-
public class CustomPayload3: Payload {
59+
public class CustomPayload3: APNSPayload {
6060

6161
public let encrypted: String
6262

Tests/SwiftyAPNSTests/SwiftyAPNSTests.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ final class SwiftyAPNSTests: XCTestCase {
3131
}
3232

3333
func testAlertPushExample() {
34-
let payload = Payload(alert: APSAlert.plain(plain: "Test Alert notification."))
35-
var options = NotificationOptions.default
34+
let payload = APNSPayload(alert: APSAlert.plain(plain: "Test Alert notification."))
35+
var options = APNSNotificationOptions.default
3636
options.type = .alert
3737
options.topic = topic
3838
let notification = APNSNotification.init(payload: payload, token: token, options: options)
@@ -44,8 +44,8 @@ final class SwiftyAPNSTests: XCTestCase {
4444
alert.title = "Test"
4545
alert.subtitle = "Alert notification"
4646
alert.body = "with subtitle."
47-
let payload = Payload(alert: APSAlert.localized(alert: alert))
48-
var options = NotificationOptions.default
47+
let payload = APNSPayload(alert: APSAlert.localized(alert: alert))
48+
var options = APNSNotificationOptions.default
4949
options.type = .alert
5050
options.topic = topic
5151
let notification = APNSNotification.init(payload: payload, token: token, options: options)
@@ -56,8 +56,8 @@ final class SwiftyAPNSTests: XCTestCase {
5656
var alert = APSLocalizedAlert()
5757
alert.locKey = "REQUEST_FORMAT"
5858
alert.locArgs = ["Jenna", "Frank"]
59-
let payload = Payload(alert: APSAlert.localized(alert: alert))
60-
var options = NotificationOptions.default
59+
let payload = APNSPayload(alert: APSAlert.localized(alert: alert))
60+
var options = APNSNotificationOptions.default
6161
options.type = .alert
6262
options.topic = topic
6363
let notification = APNSNotification.init(payload: payload, token: token, options: options)
@@ -67,8 +67,8 @@ final class SwiftyAPNSTests: XCTestCase {
6767
func testAlertWithCustomActionsPushExample() {
6868
var alert = APSLocalizedAlert()
6969
alert.body = "Test Alert with custom action notification."
70-
let payload = Payload(alert: APSAlert.localized(alert: alert), badge: 1, sound: "default.wav", category: "MESSAGE_CATEGORY")
71-
var options = NotificationOptions.default
70+
let payload = APNSPayload(alert: APSAlert.localized(alert: alert), badge: 1, sound: "default.wav", category: "MESSAGE_CATEGORY")
71+
var options = APNSNotificationOptions.default
7272
options.type = .alert
7373
options.topic = topic
7474
let notification = APNSNotification.init(payload: payload, token: token, options: options)
@@ -79,7 +79,7 @@ final class SwiftyAPNSTests: XCTestCase {
7979
var alert = APSLocalizedAlert()
8080
alert.body = "Test Alert with custom payload notification."
8181
let payload = CustomPayload1(alert: APSAlert.localized(alert: alert), badge: 1, sound: "default.wav", category: "MESSAGE_CATEGORY", acme1: "bar", acme2: 42)
82-
var options = NotificationOptions.default
82+
var options = APNSNotificationOptions.default
8383
options.type = .alert
8484
options.topic = topic
8585
let notification = APNSNotification.init(payload: payload, token: token, options: options)
@@ -90,7 +90,7 @@ final class SwiftyAPNSTests: XCTestCase {
9090
var alert = APSLocalizedAlert()
9191
alert.body = "Test Alert with custom payload notification."
9292
let payload = CustomPayload2(alert: APSAlert.localized(alert: alert), badge: 1, sound: "default.wav", category: "MESSAGE_CATEGORY", acme1: ["bang", "whiz"])
93-
var options = NotificationOptions.default
93+
var options = APNSNotificationOptions.default
9494
options.type = .alert
9595
options.topic = topic
9696
let notification = APNSNotification.init(payload: payload, token: token, options: options)
@@ -99,7 +99,7 @@ final class SwiftyAPNSTests: XCTestCase {
9999

100100
func testBackgroundPushExample() {
101101
let payload = CustomPayload1(acme1: "bar", acme2: 42)
102-
var options = NotificationOptions.default
102+
var options = APNSNotificationOptions.default
103103
options.type = .alert//.voip
104104
options.topic = topic
105105
//options.environment = .production
@@ -111,7 +111,7 @@ final class SwiftyAPNSTests: XCTestCase {
111111
var alert = APSLocalizedAlert()
112112
alert.body = "Test mutable conten payload notification."
113113
let payload = CustomPayload3(alert: APSAlert.localized(alert: alert), badge: 1, sound: "default.wav", category: "MESSAGE_CATEGORY", encrypted: "Ω^¬%gq∞NÿÒQùw")
114-
var options = NotificationOptions.default
114+
var options = APNSNotificationOptions.default
115115
options.type = .alert
116116
options.topic = topic
117117
let notification = APNSNotification.init(payload: payload, token: token, options: options)

0 commit comments

Comments
 (0)