//
//  PushPayload.swift
//  Ello
//
//  Created by Gordon Fontenot on 5/20/15.
//  Copyright (c) 2015 Ello. All rights reserved.
//

public struct PushPayload {
    let info: [String: AnyObject]
}

public extension PushPayload {
    var applicationTarget: String {
        return info["application_target"] as? String ?? ""
    }

    var message: String {
        let aps = info["aps"] as? [String: AnyObject]
        let alert = aps?["alert"] as? [String: String]
        return alert?["body"] ?? "New Notification"
    }
}

//
//  PushPayload.swift
//  Ello
//
//  Created by Gordon Fontenot on 5/20/15.
//  Copyright (c) 2015 Ello. All rights reserved.
//

public struct PushPayload {
    let info: [String: AnyObject]
}

public extension PushPayload {
    var applicationTarget: String {
        return info["application_target"] as? String ?? ""
    }

    var message: String {
        let aps = info["aps"] as? [String: AnyObject]
        return aps?["alert"] as? String ?? "New Notification"
    }
}

--- 
+++ 
@@ -17,6 +17,7 @@
 
     var message: String {
         let aps = info["aps"] as? [String: AnyObject]
-        return aps?["alert"] as? String ?? "New Notification"
+        let alert = aps?["alert"] as? [String: String]
+        return alert?["body"] ?? "New Notification"
     }
 }
Fix parsing of push payloads

I made the (incorrect) assumption that we were using the string version
of the 'alert' key for the push payload. Turns out, we're using the
dictionary version. This fixes the dictionary lookup so that we get the
right information to display to the user.
