Finish iOS 9 Quick Reply

This commit is contained in:
kevinzhow
2015-09-23 20:13:57 +08:00
parent 4f3ab7828f
commit 1695dcaa86
+26 -3
View File
@@ -155,17 +155,40 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
if identifier == YepNotificationCommentAction,
let response = responseInfo[UIUserNotificationActionResponseTypedTextKey],
responseText = response as? String {
print(responseText)
sendMessageWithUserInfo(userInfo, responseText: responseText)
} else if identifier == YepNotificationOKAction {
sendMessageWithUserInfo(userInfo, responseText: "OK")
}
} else {
// Fallback on earlier versions
}
completionHandler()
}
func sendMessageWithUserInfo(userInfo: [NSObject: AnyObject], responseText: String) {
if let type = userInfo["recipient_type"] as? String,
recipient_id = userInfo["recipient_id"] as? String {
if type == "User" {
print("Send Message \(responseText) to \(recipient_id)")
sendText(responseText, toRecipient: recipient_id, recipientType: "User", afterCreatedMessage: { message in
}, failureHandler: { reason, errorMessage in
defaultFailureHandler(reason, errorMessage: errorMessage)
}, completion: { success in
println("sendText to friend: \(success)")
})
}
}
}
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {