braze-inc / braze-swift-sdk

Braze SDK for the Apple ecosystem, including: iOS, macOS, iPadOS, visionOS, tvOS
https://www.braze.com
Other
52 stars 19 forks source link

[Bug]: inAppMessage(_ ui: BrazeInAppMessageUI, willPresent message: Braze.InAppMessage, view: InAppMessageView) not called #116

Closed iOHS closed 6 months ago

iOHS commented 8 months ago

Platform

iOS

Platform Version

iOS 16.2

Braze SDK Version

5.14.0

Xcode Version

Xcode 14.3

Computer Processor

Apple (M1)

Repro Rate

100%

Steps To Reproduce

  1. inappmessage exposure
  2. check willPresent call

Expected Behavior

willPresent is called.

Actual Incorrect Behavior

willPresent is not called.

Verbose Logs

No response

Additional Information

Hello. BrazeInAppMessageUIDelegate is set correctly, but willPresent is not called. displayChoiceForMessage and prepareWith are called normally

let inAppMessageUI = BrazeInAppMessageUI()
inAppMessageUI.delegate = self
self.braze?.inAppMessagePresenter = inAppMessageUI as? BrazeInAppMessagePresenter

Is this due to the difference between calling delegate?.inAppMessage(self, prepareWith: &context) and calling ui.delegate?.inAppMessage(ui, willPresent: controller.message, view: self) Please check how we can handle it.

extension BrazeTracker: BrazeInAppMessageUIDelegate {

    func inAppMessage(_ ui: BrazeInAppMessageUI, willPresent message: Braze.InAppMessage, view: InAppMessageView) {
        print("not called")
    }

    func inAppMessage(_ ui: BrazeInAppMessageUI, displayChoiceForMessage message: Braze.InAppMessage) -> BrazeInAppMessageUI.DisplayChoice {
        self.isTopViewControllerExcluded() ? .later : .now
    }

    func inAppMessage(_ ui: BrazeInAppMessageUI, prepareWith context: inout BrazeInAppMessageUI.PresentationContext) {
        print("called")
    }
}

Only BrazeInAppMessageUIDelegate declared in the SDK is being called.


extension BrazeInAppMessageUIDelegate {

  public func inAppMessage(
    _ ui: BrazeInAppMessageUI, willPresent message: Braze.InAppMessage,
    view: InAppMessageView
  ) {}
}
lowip commented 8 months ago

Hi @iOHS,

Thank you for reporting this issue. Unfortunately, we haven't been able to reproduce it yet. Could you send the link to the campaign for which you're experiencing the problem to support@braze.com, please also reference this GitHub issue thread in your email.

We'll be able to take a better look once we have those information.

Best,

iOHS commented 7 months ago

@lowip I sent you an email. thank you

hokstuff commented 6 months ago

I'm closing out this thread due to inactivity and because we are conversing directly through our Support channels, which will be easier for back-and-forth. Thanks!