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

Use trait collection to control theme changes #2672

Merged
merged 21 commits into from
Apr 5, 2024
Merged

Conversation

dus7
Copy link
Contributor

@dus7 dus7 commented Apr 4, 2024

Task/Issue URL: https://app.asana.com/0/72649045549333/1206042861558085/f
Tech Design URL:
CC:

Description:

Changes here remove custom dark/light theme propagation and uses native traitCollection and possibility to override this setting for Window to apply user’s selection.

Approach:

  • Merge Dark and Light themes into a single theme using dynamicProvider for colors.
  • Make all decorate functions private and apply colors locally in respective View or ViewController.
  • Call decorate functions during initialization, dropping applyTheme calls.
  • Use traitCollectionDidChange in places using CGColors, animations and other places not using dynamic assets.
  • Remove Themable protocol.
  • Combine separate light/dark images in assets into a single image collection.

Steps to test this PR:

  1. Go through various places in the app, while changing dark/light mode using system and app appearance settings
  2. Make sure changes are consistent

See https://app.asana.com/0/0/1206918196231425/f for specific testing details.

OS Testing:

  • iOS 14
  • iOS 15
  • iOS 16

Theme Testing:

  • Light theme
  • Dark theme

Internal references:

Software Engineering Expectations
Technical Design Template

@github-actions github-actions bot added the bot: not in app board Added by automation for pull requests with tasks not added to iOS App Board Asana project label Apr 4, 2024
Copy link

github-actions bot commented Apr 4, 2024

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS against 0e1791a

@dus7 dus7 removed the bot: not in app board Added by automation for pull requests with tasks not added to iOS App Board Asana project label Apr 5, 2024
@dus7 dus7 force-pushed the mariusz/dynamic-colors branch from c914cbd to c3ab446 Compare April 5, 2024 11:28
@dus7 dus7 marked this pull request as ready for review April 5, 2024 12:07
Copy link
Contributor

@brindy brindy left a comment

Choose a reason for hiding this comment

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

I bashed on this for a bit and nothing jumps out in the code. Great work! Let's get it merged and tested in the alpha/internal release. :)

@dus7 dus7 merged commit 1504f88 into main Apr 5, 2024
29 checks passed
@dus7 dus7 deleted the mariusz/dynamic-colors branch April 5, 2024 20:09
samsymons added a commit that referenced this pull request Apr 7, 2024
# By Christopher Brind (2) and others
# Via GitHub
* main:
  Use trait collection to control theme changes (#2672)
  Expand maestro tests (#2691)
  scroll to selected item after opening new tab, etc (#2689)
  Update autoconsent to v10.5.0 (#2671)
  Fix history debug view controller causing crash on tap (#2681)

# Conflicts:
#	DuckDuckGo/HomeCollectionView.swift
#	DuckDuckGo/HomeViewController.swift
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.

2 participants