braze-inc / braze-swift-sdk

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

[Bug]: logClick opens webbrowser when URL is set #49

Closed RutgerVleuten closed 1 year ago

RutgerVleuten commented 1 year ago

Platform

iOS

Platform Version

iOS 15

Braze SDK Version

3.1.0

Xcode Version

14.2

Computer Processor

Intel

Repro Rate

100

Steps To Reproduce

Calling logClick using the below code.

        let jsonString = "{\"ar\":1.7789473684210526,\"ca\":1677583114,\"cl\":true,\"db\":true,\"dm\":\"Check\",\"ds\":\"Use Halloween pathway lights\\nOnly the bravest trick-or-treaters will dare to approach your door when you use smart light to illuminate the path. Outdoor lightstrips are a favorite for Halloween, as you can snake them along winding paths and set them to any color — try orange, purple, or green — to creep out your Halloween visitors.\\n\\nHighlight your spookiest decor\\nCreate a cemetery in your front yard with DIY gravestones, and then place Lily spotlights in between them. With their powerful beams of light, Lily spotlights can create interesting shadows — making your outdoor Halloween decorations that much more dynamic.\",\"e\":{\"contentCardType\":\"whatsnew\",\"launchDate\":\"2022-03-28\",\"overline\":\"Feature\"},\"ea\":1677583414,\"i\":\"https://braze-images.com/appboy/communication/marketing/content_cards_message_variations/images/61a0f4f87313607c08c22cb9/1eebefe4d98810de74837cff0ff0accec778e002/original.jpeg?1637938572\",\"id\":\"NjFhMGY0Zjg3MzEzNjA3YzA4YzIyY2M5XyRfY2M9OTI0ZmE4ZWUtZTM5MC1hNTMyLWI1ZTctNWMxYTBiNmUzM2U1Jm12PTYxYTBmNGY4NzMxMzYwN2MwOGMyMmNiOSZwaT1jbXA=\",\"p\":false,\"r\":false,\"t\":false,\"tp\":\"captioned_image\",\"tt\":\"Outdoor Halloween lighting ideas\",\"u\":\"https://www.philips-hue.com/en-us/explore-hue/blog/halloween-lighting-ideas\",\"uw\":false,\"v\":false}";

        if let rawContentCard = Braze.ContentCardRaw.from(json: Data(jsonString.utf8)) {
            do {
                let contentCard = try Braze.ContentCard.init(rawContentCard)
                contentCard.logClick(using: braze)
            } catch {
                print("Error parsing Content Card from jsonString: \(jsonString), error: \(error)")
            }
        }

Expected Behavior

No URL is opened, only click is logged.

Actual Incorrect Behavior

Opens URL in web view or browser.

Verbose Logs

No response

Additional Information

linked ticket https://github.com/braze-inc/braze-flutter-sdk/issues/45

hokstuff commented 1 year ago

To keep the conversation in a single thread, I am closing out this issue in favor of conversing on the linked Flutter issue.