mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-11 05:45:56 +10:00
Finish iOS 9 Quick Reply
This commit is contained in:
+26
-3
@@ -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) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user