Skip to content

Commit df1b540

Browse files
stevetreaseSteve Trease
authored andcommitted
Added .alert and .message attributes to notification data type and changed view controller to display the message text
1 parent e23e1ae commit df1b540

File tree

6 files changed

+6
-4
lines changed

6 files changed

+6
-4
lines changed

Swift Push 4/AppDelegate.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
114114
if let aps = userInfo["aps"] as? NSDictionary {
115115
if let alert = aps["alert"] as? String {
116116
item.alert = alert
117+
item.message = alert
117118
print ("alert: \(alert)")
118119
}
119120
}

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>589</string>
22+
<string>590</string>
2323
<key>LSRequiresIPhoneOS</key>
2424
<true/>
2525
<key>UIBackgroundModes</key>

Swift Push 4/MasterViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class MasterViewController: UITableViewController, UISearchResultsUpdating {
9494
cell.textLabel?.numberOfLines = 0
9595
cell.detailTextLabel?.numberOfLines = 0
9696

97-
cell.textLabel?.text = notification.alert as String
97+
cell.textLabel?.text = notification.message as String
9898
cell.detailTextLabel?.text = NSDateFormatter.localizedStringFromDate(notification.timeStampSent, dateStyle: .MediumStyle, timeStyle: .ShortStyle) as String
9999

100100
if (notification.messageID != 0) {
@@ -122,7 +122,7 @@ class MasterViewController: UITableViewController, UISearchResultsUpdating {
122122
} else {
123123
self.filteredNotifications = notifications.filter({( notification: NotificationData) -> Bool in
124124
// let categoryMatch = (scope == "All") || (notification.alert == scope)
125-
let stringMatch = notification.alert.rangeOfString(searchController.searchBar.text!, options: .CaseInsensitiveSearch)
125+
let stringMatch = notification.message.rangeOfString(searchController.searchBar.text!, options: .CaseInsensitiveSearch)
126126
return (stringMatch != nil)
127127
})
128128
}

Swift Push 4/NotificationData.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ let maxNotifications = 128
1313

1414
class NotificationData {
1515
var alert: String = ""
16+
var message: String = ""
1617
// var payload: String = ""
1718
var timeStampSent = NSDate()
1819
var timeStampReceived = NSDate()

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>589</string>
9+
<string>590</string>
1010
<key>Key</key>
1111
<string>CurrentBuildNumber</string>
1212
<key>Title</key>

0 commit comments

Comments
 (0)