Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: navigation bar colors #232

Merged

Conversation

rnr
Copy link
Contributor

@rnr rnr commented Jan 12, 2024

This PR fixes bug with Navigation Bar background and title colors in dark mode.
295306543-aa89d0b1-3501-43a3-a317-d6f82b2fe70f

By some reason calculated UIColor doesn't work for navigation bar (like Theme.Colors.textPrimary.uiColor()) and I added UIColors struct into Theme.

After fix Navigation Bar looks like this:
37253/6793dc56-1831-44c6-af30-11fc26d28cd2

forgotvas
forgotvas previously approved these changes Jan 12, 2024
@rnr rnr linked an issue Jan 12, 2024 that may be closed by this pull request
Comment on lines 94 to 109
public struct UIColors {
public private(set) static var textPrimary = ThemeAssets.textPrimary.color
public private(set) static var accentColor = ThemeAssets.accentColor.color
public private(set) static var background = ThemeAssets.background.color

public static func update(
textPrimary: UIColor = ThemeAssets.textPrimary.color,
accentColor: UIColor = ThemeAssets.accentColor.color,
background: UIColor = ThemeAssets.background.color
) {
self.textPrimary = textPrimary
self.accentColor = accentColor
self.background = background
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rnr Why it's needed to create a new struct UIColors when we already have uiColor() extension written on Colors?

Even if we want to define categorical UIColors, I guess it would be nice to have all the values that Colors have and also it would be nice if you can remove uiColor() extension so we will have a single source. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saeedbashir
I'm not sure we need to add the whole bunch of colors to the UIColors structure - it seems like unnecessary duplication.
I experimented again and found that only 'accentColor' and 'textPrimary' in this structure is sufficient. Calculated UIColors get broken when we use these in UIApplicationExtension.swift for override func viewWillLayoutSubviews(). For all other places (like CCSInjection or Discussions) it looks working.
So uiColor() is helpful extension and I don't think we need to delete this.
I commit small changes (got rid unnecessary navigation background modifier) . Please review.

@saeedbashir
Copy link
Contributor

@rnr I'm only able to replicate the issue when I revert the changes of CourseContainerView i.e., when I remove the background color.

Could you please check it again to see if you are able to reproduce the issue by using uiColor() in UINavigationController viewWillLayoutSubviews.

@rnr
Copy link
Contributor Author

rnr commented Jan 16, 2024

@rnr I'm only able to replicate the issue when I revert the changes of CourseContainerView i.e., when I remove the background color.

Could you please check it again to see if you are able to reproduce the issue by using uiColor() in UINavigationController viewWillLayoutSubviews.

@saeedbashir
yes I'm able
For navigationBar.titleTextAttributes = [.foregroundColor: Theme.Colors.textPrimary.uiColor()] - no title as you see:
Screenshot 2024-01-16 at 08 57 47
To see problem with navigationBar.backIndicatorImage you need to change accentColor to non-blue color (because it gets default color when error):
Screenshot 2024-01-16 at 09 03 07

@volodymyr-chekyrta volodymyr-chekyrta merged commit 6f3a985 into openedx:develop Jan 16, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[iOS] Course title and course menu items are not visible in Dark mode
4 participants