urbanairship / ios-library

Urban Airship iOS SDK
http://urbanairship.com
Apache License 2.0
478 stars 265 forks source link

Tint color not applied to MessageCenter navigation button items #369

Closed garyjyochum closed 1 year ago

garyjyochum commented 1 year ago

Preliminary Info

What Airship dependencies are you using?

pod 'Airship' //16.11.3 pod 'AirshipExtensions/NotificationService' //v14.6.1

What are the versions of any relevant development tools you are using?

Xcode 14.3.1 iPhone XR with iOS 16.3.1

Report

What unexpected behavior are you seeing?

When rendering the MessageCenter component in our iOS app, setting the MessageCenterStyle 'tintColor' property does not get applied to the navigation button items. We are setting the tintColor to a dark blue, but when rendering the MessageCenter, we see

IMG_991E167E0BFA-1

The buttons are there but the color for both buttons is white, thus not visible.

let messageCenter = MessageCenter.shared
let s = MessageCenterStyle()

        s.titleFont = UIFont(name: "HelveticaNeue", size: 20)
        s.tintColor = UIColor.blue
        s.titleColor = UIColor.blue
        s.navigationBarColor = UIColor.white
        s.navigationBarOpaque = true
        s.listColor = UIColor.white
        s.refreshTintColor = UIColor.blue
        s.iconsEnabled = false
        s.cellSeparatorColor = UIColor.lightGray
messageCenter.defaultUI.messageCenterStyle = s
messageCenter.display(false)

What is the expected behavior?

When using the code above, we are expecting the navigation button items to match what we set for the tintColor.

What are the steps to reproduce the unexpected behavior?

When the user taps a CTA in the app, we create a MessageCenter instance, set the style, and render it

Do you have logging for the issue?

No, but we have fixed(?) the issue by doing the following in our local development environment:

  1. Open the UADefaultMessageCenterSplitViewController.m class
  2. navigate to the applyStyle() method
  3. in the if statement checking to see if tintColor has been set, we added this line self.listNavigationController.navigationBar.tintColor = self.messageCenterStyle.tintColor;
if (self.messageCenterStyle.tintColor) {
        self.view.tintColor = self.messageCenterStyle.tintColor;
        self.listNavigationController.navigationBar.tintColor = self.messageCenterStyle.tintColor;
        self.messageNavigationController.navigationBar.tintColor = self.messageCenterStyle.tintColor;
    }

IMG_55AE83436EF6-1

Note: I checked to see if the latest 16.* version of the SDK addressed this (16.12.2) before creating this issue.

rlepinski commented 1 year ago

Thanks for the report, ill see if i can get this fixed for the next patch release this week

rlepinski commented 1 year ago

This seems to be working for me, I used your code but set the tint color to purple:

simulator_screenshot_086BE022-DE81-4755-AE29-0F060DDD012C

Trying to figure out how to reproduce it

rlepinski commented 1 year ago

This was on a simulator running 16.4 not 16.3.1. Could you try it on 16.4 to see if the issue still exists? If not, are you setting an message center display delegate? Also I am not sure how you are getting no buttons (maybe invisible?)

garyjyochum commented 1 year ago

@rlepinski Interesting, I just ran our app on a 16.4 simulator and still see the issue. I updated the version UA to 16.12.2 as well just to make sure I have the latest 16.* version. We do not set a message center display delegate - should we? I thought that delegate was for rendering something custom - we just want to render the default message list/details. As you can see in the screenshot, the buttons are definitely there, just match the white background color.

If you cannot reproduce, I am working to update the project to use the new 17.* version of the SDK in a separate branch. Hopefully that will resolve the issue.

image
rlepinski commented 1 year ago

No on the display delegate, just checking to see what could be causing this. Are you setting the appearance at the top level in your app somewhere? I was able to get similar results with this:

UINavigationBar.appearance().tintColor = .white
rlepinski commented 1 year ago

Doing a 16.12.3 release that should fix your current issue. I am going to bet that 17.x message center is might cause some issues with you since we switched to swiftui and have less control over how the navigation bar is styled. If you run into any issues with that please let me know asap and we will get it sorted out.

garyjyochum commented 1 year ago

@rlepinski Thank you for looking at this so quickly!

rlepinski commented 1 year ago

16.12.3 should be out