Appboy / appboy-ios-sdk

Public repo for the Braze iOS SDK
https://www.braze.com
Other
168 stars 140 forks source link

Deeplinking not working when rich notification is expanded #168

Closed rishabdutta closed 5 years ago

rishabdutta commented 5 years ago

I have set Notification Type to Push Stories.

The notification appears and expands on 3D touch. Now when I tap on the image or tap on a custom button It just opens the app. It doesn't go to the particular page.

If I do not long press the notification and just tap it, it goes to the particular page.

The action of the custom button is handled in didReceive(response: completionHandler:) like so:

func didReceive(_ response: UNNotificationResponse, completionHandler completion: @escaping (UNNotificationContentExtensionResponseOption) -> Void) {
        guard let option = dataSource?.didReceive(response) else {
            return
        }
        switch response.actionIdentifier {
        case "GO TO APP":
            completion(option)
    }

Upon setting breakpoints I see that when I directly tap the notification the Appboys's function userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler is getting called which eventually leads to a call to handleAppboyURL:from:withExtras: where deep linking is handled.

However, if I expand the notification and tap on either the button or image userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler is not getting called at all.

What could be the possible problem?

EDIT I am seeing the payload and it doesn't have the the key value pair of [category: ab_cat_push_story]. Maybe that is something worth looking into.

EDIT 2: I put Appboy's userNotificationCenter function inside DispatchQueue with a delay in. In this case upon expansion when I tap the image it goes to the deep linked page but custom button is still not working.

DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
     Appboy.sharedInstance()?.userNotificationCenter(center, didReceive: response, withCompletionHandler: completionHandler)
     completionHandler()
}
chshapiro commented 5 years ago

Hey @rishabdutta,

Sorry for the late response here!

What you're seeing in regards to the button opening the app is expected behavior. When the notification is expanded, clicking on an image should perform the click action set for that button, but clicking on the "Go To App" button simply opens the app.

We also cannot repro the image not performing the click action button. Can you give us more information about how you're integrating?

Thanks, Chava

chshapiro commented 5 years ago

Hey @rishabdutta,

We just released version 3.13.0 of our SDK where we updated our Push Story feature. Can you see if you're still running into issues when using this version?

Thanks, Chava

Bucimis commented 5 years ago

@rishabdutta, closing for now - feel free to re-open if you continue to experience this after upgrading to 3.13.0. For more information on how to do that, see https://github.com/Appboy/appboy-ios-sdk/blob/master/CHANGELOG.md#3130 (note that you will need to update your UNNotificationExtensionCategory from ab_cat_push_story_v2 to ab_cat_push_story)