Skip to content

Commit 9263002

Browse files
stevetreaseSteve Trease
authored andcommitted
Differentiate between push and alert message types
1 parent df1b540 commit 9263002

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

Swift Push 4/AppDelegate.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3232
// display initial startup message
3333
var item = NotificationData()
3434
item.alert = "Swift Push (\(versionNumber!)) starting on " + UIDevice.currentDevice().name
35+
item.message = item.alert
3536
notifications.insert(item, atIndex: 0)
3637

3738
// display an additional set of test notifications
@@ -41,6 +42,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
4142
for i in 1...10 {
4243
item = NotificationData()
4344
item.alert = "test data " + formatter.stringFromNumber(i)!
45+
item.message = item.alert
4446
notifications.insert(item, atIndex: 0)
4547
}
4648
*/
@@ -60,6 +62,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
6062
print("screenshot taken")
6163
item = NotificationData()
6264
item.alert = "screenshot taken"
65+
item.message = item.alert
6366
item.timeStampSent = NSDate ()
6467
notifications.insert(item, atIndex: 0)
6568
}
@@ -114,14 +117,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
114117
if let aps = userInfo["aps"] as? NSDictionary {
115118
if let alert = aps["alert"] as? String {
116119
item.alert = alert
117-
item.message = alert
118120
print ("alert: \(alert)")
119121
}
120122
}
121123
if let messageID = userInfo["messageID"] as? Int {
122124
item.messageID = messageID
123125
print ("messageID: \(messageID)")
124126
}
127+
if let message = userInfo["payload"] as? String {
128+
item.message = message
129+
print ("message: \(message)")
130+
}
131+
125132
if let timeStamp = userInfo["timestamp"] as? NSTimeInterval {
126133
item.timeStampSent = NSDate (timeIntervalSince1970: timeStamp)
127134
print ("timestamp: \(timeStamp)")

Swift Push 4/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>590</string>
22+
<string>593</string>
2323
<key>LSRequiresIPhoneOS</key>
2424
<true/>
2525
<key>UIBackgroundModes</key>

Swift Push 4/Settings.bundle/Root.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<array>
77
<dict>
88
<key>DefaultValue</key>
9-
<string>590</string>
9+
<string>593</string>
1010
<key>Key</key>
1111
<string>CurrentBuildNumber</string>
1212
<key>Title</key>

0 commit comments

Comments
 (0)