Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Fix #3632: Refactor theme logic to use iOS 13 APIs #3606

Merged
merged 46 commits into from
May 6, 2021

Conversation

kylehickinson
Copy link
Collaborator

@kylehickinson kylehickinson commented Apr 29, 2021

Summary of Changes

Fixes #3632

Theme related bugs affected:

Submitter Checklist:

  • Unit Tests are updated to cover new or changed functionality
  • User-facing strings use NSLocalizableString()

Test Plan:

  • Change dark mode on all parts of the UI to ensure things switch back and forth properly
  • Verify you can still force a specific theme via settings and that all UI only shows colors for that theme
  • Verify private mode toolbars are purple instead of the regular dark/light colors

Known Issue: The toolbar that appears above the keyboard when you focus a text box in a web page does not theme correctly. This is true even in the live version of the app, and seems to be an iOS specific bug. Haven't tested to determine which versions of iOS are affected.

Screenshots:

There are many screenshots so they've been zipped into separate folders:

Reviewer Checklist:

  • Issues include necessary QA labels:
    • QA/(Yes|No)
    • release-notes/(include|exclude)
    • bug / enhancement
  • Necessary security reviews have taken place.
  • Adequate unit test coverage exists to prevent regressions.
  • Adequate test plan exists for QA to validate (if applicable).
  • Issue is assigned to a milestone (should happen at merge time).

Copy link
Contributor

@iccub iccub left a comment

Choose a reason for hiding this comment

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

Love to see these changes.

Leaving random comments about using certain colors in certain places.

One thing we can consider to clean this up further is to replace UIColor.xxx with just .xxx in places that allow it.

I assume you did find/replace on BraveUX -> UIColor that's why some of it left

@@ -75,7 +75,7 @@ class FeedSourceListViewController: UITableViewController {
tableView.estimatedRowHeight = UITableView.automaticDimension
tableView.delegate = self
tableView.dataSource = self
tableView.sectionIndexColor = BraveUX.braveOrange
tableView.sectionIndexColor = UIColor.braveOrange
Copy link
Contributor

Choose a reason for hiding this comment

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

UIColor not needed here?

if previous == nil || newTheme != Theme.of(previous) {
applyTheme(newTheme)
}
// FIXME: Theme - Private Mode
Copy link
Contributor

Choose a reason for hiding this comment

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

comment

@@ -57,7 +57,7 @@ class ButtonToast: Toast {

if let imageName = imageName {
let icon = UIImageView(image: UIImage(imageLiteralResourceName: imageName).template)
icon.tintColor = UIColor.Photon.white100
icon.tintColor = UIColor.white
Copy link
Contributor

Choose a reason for hiding this comment

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

UIColor can be removed

@@ -13,7 +13,6 @@ class SyncCameraView: UIView, AVCaptureMetadataOutputObjectsDelegate {
let button = self.createCameraButton()
button.setTitle(Strings.grantCameraAccess, for: .normal)
button.tintColor = .white
button.appearanceTextColor = .white
Copy link
Contributor

Choose a reason for hiding this comment

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

We do not set title color here?

textView.textColor = BraveUX.greyJ
textView.backgroundColor = .white
textView.textColor = .braveLabel
textView.backgroundColor = .braveBackground
Copy link
Contributor

Choose a reason for hiding this comment

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

This has to be checked as well, white -> dynamic change

init(title: String, accessibilityIdentifier: String, callback: @escaping SnackBarCallback) {
self.callback = callback

super.init(frame: .zero)

setTitle(title, for: .normal)
titleLabel?.font = DynamicFontHelper.defaultHelper.DefaultMediumFont
setTitleColor(SnackBarUX.highlightText, for: .highlighted)
setTitleColor(SettingsUX.tableViewRowTextColor, for: .normal)
setTitleColor(.braveOrange, for: .highlighted)
Copy link
Contributor

Choose a reason for hiding this comment

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

highlightText = UIColor.Photon.blue60 seems to be blue not orange, unless we want to update it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Decided to update it to reflect Brave highlight/tint colors

textLabel.textColor = TwoLineCellUX.textColor
detailTextLabel.textColor = TwoLineCellUX.detailTextColor
textLabel.textColor = .braveLabel
detailTextLabel.textColor = .secondaryBraveLabel
setupDynamicFonts()

imageView.contentMode = .scaleAspectFill
imageView.layer.cornerRadius = 6 // hmm
Copy link
Contributor

Choose a reason for hiding this comment

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

🤔

@kylehickinson kylehickinson linked an issue May 4, 2021 that may be closed by this pull request
@kylehickinson kylehickinson added this to the 1.26 milestone May 4, 2021
@kylehickinson kylehickinson changed the title No Bug: Refactor theme logic to use iOS 13 APIs Fix #3632: Refactor theme logic to use iOS 13 APIs May 5, 2021
@kylehickinson kylehickinson mentioned this pull request May 5, 2021
7 tasks
@iccub iccub mentioned this pull request May 6, 2021
6 tasks
# for free to subscribe to this conversation on GitHub. Already have an account? #.