braze-inc / braze-swift-sdk

https://www.braze.com
Other
48 stars 19 forks source link

[Bug]: Can't disable in app message webview dismissal when clicking on deeplink in the webview #92

Closed evelyne96 closed 7 months ago

evelyne96 commented 8 months ago

Platform

iOS

Platform Version

iOS 16.5

Braze SDK Version

7.0.0

Xcode Version

14.3.1

Computer Processor

Apple (M1)

Repro Rate

100%

Steps To Reproduce

Migrating from an older Appboy version to the new BrazeKit SDK and missing the ability to handle a deeplink action locally without dismissing the webview. Beforehand we could do this by returning true to the following delegate method, but can't find the equivalent in the new SDK.

func onInAppMessageHTMLButtonClicked(inAppMessage: ABKInAppMessageHTML!,
                                     clickedURL: URL, buttonID: String) -> Bool

Closest I have is the following method, that is called after clicking the button (which triggers the deeplink), but this would still not the dismissal of the webview since it is strictly about action processing:

   func inAppMessage(_ ui: BrazeInAppMessageUI,
                      shouldProcess clickAction: Braze.InAppMessage.ClickAction,
                      buttonId: String?,
                      message: Braze.InAppMessage,
                      view: InAppMessageView) -> Bool

Is there some other delegate method that should be overridden to get this behaviour?

Expected Behavior

Being able to override the html in app message dismissal when links referenced in the webview.

Actual Incorrect Behavior

Webview is always dismissed when clicking on button with deeplink ref.

Verbose Logs

No response

Additional Information

No response

jerielng commented 8 months ago

Hi @evelyne96, our HTML IAM view is customizable via subclassing. You can override this processNavigationAction method if you would like to customize the dismissal behavior upon clicking.

For further details about customizing IAMs, you can refer to this guide here. Thanks!

evelyne96 commented 8 months ago

@jerielng I did encounter some issues with subclassing the brazeui in app message views when integrating with SPM, is this something you are familiar with? After using cocoapods everything went smoothly and I was able to initialize my subclasses as expected. Even when adding braze to a dummy project and not overriding anything in the subclass the crash happens instantly once I try to instantiate the subclass.

Screenshot 2023-11-16 at 14 44 15 Screenshot 2023-11-16 at 14 44 10
jerielng commented 8 months ago

Hey @evelyne96, unfortunately, I'm not able to reproduce this issue from SPM on either a fresh project or the existing sample app. Are there any other details around your custom implementation and usage that you could share with our support team at support@braze.com?

evelyne96 commented 7 months ago

Sent an email as you mentioned and a project where I'm able to reproduce it. Note for others in case they see the same issues: I am only able to reproduce this when building locally for actual devices, (in my case I have an iPhone 14 Pro with iOS 16.5) or with simulators with Rosetta. Used Macbook with Apple M1 Pro when building.

jerielng commented 7 months ago

Hey @evelyne96, we've just released version 7.4.0 of the Braze Swift SDK, which should resolve this issue. I'll go ahead and close this issue but feel free to re-open a new one if you have further questions.

Thank you!