Appboy / appboy-ios-sdk

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

[Bug]: in-app message color theme does not respect overridden appearance of window (eg dark mode) #334

Closed gsbernstein closed 2 years ago

gsbernstein commented 2 years ago

Platform

iOS

Platform Version

iOS 15.1 (but likely iOS 13+)

Braze SDK Version

4.1.0

Xcode Version

13.1 and 13.2.1

Integration Method

Cocoapods

Computer Processor

Intel

Repro Rate

100%

Steps To Reproduce

Example:

  1. Add pod 'Appboy-iOS-SDK' to the Podspec file.
  2. Add [Appboy startWithApiKey:inApplication:withLaunchOptions:]; method in application:didFinishLaunchingWithOptions: method in AppDelegate.m and all the other in-app message integrations
  3. Set overrideUserInterfaceStyle on the window, in our case window.overrideUserInterfaceStyle = DarkModeSettings().current but without our settings manager it would just be .light or .dark
  4. Run the app.
  5. Send yourself an in-app message with different light mode and dark mode themes

Expected Behavior

In-app message modal appearance should be based on window's appearance, which may be overridden from system setting.

Actual Incorrect Behavior

In-app message modal appearance is based on system setting.

https://user-images.githubusercontent.com/6655924/151599313-6287f362-0a3f-4358-862b-7d380474a61c.MP4

Verbose Logs

No response

Additional Information

We let users choose between "always dark", "always light", and "system setting"

hokstuff commented 2 years ago

Hi @gsbernstein,

Thanks for filing this issue. You should be able to customize when to listen to the "dark mode" system setting and when you wish to override it on a per-in-app-message-basis by using the enableDarkTheme property. You can set a class to conform to the ABKInAppMessageControllerDelegate, and then within your beforeInAppMessageDisplayed method, you can decide whether or not to manually override the "dark mode" system setting. You can find an example of this here.

Please let us know if you run into any further issues with this customization, or feel free to contact us at support@braze.com with more specific details.

Thanks!

gsbernstein commented 2 years ago

Thanks! I'll try that out. I realized when working on a different issue that you actually present everything in a different window, so this behavior makes sense.

gsbernstein commented 2 years ago

It looks like the example is using both overrideUserInterfaceStyle and enableDarkTheme. Should I set both?

gsbernstein commented 2 years ago

Seems to work well with just overrideUserInterfaceStyle, I'll stick to that