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

Add FXIOS-6238 - ShareTo Extension Changes To Light or Dark Theme When iOS Appearance Is Changed #20290

Conversation

tisumi99
Copy link
Contributor

📜 Tickets

Jira ticket
Github issue

💡 Description

ShareTo extension updated so that it now responds to the light/dark mode appearance setting in iOS. LightTheme() or DarkTheme() from Firefox theme is applied to the corresponding appearance settting.

InstructionsView

  • Added import Common to get access to Firefox themes.
  • Added @Environment(\.colorScheme) var colorScheme property to track changes to iOS appearance setting.
  • Added useSystemLightDarkMode property to enable or disable view responding to iOS appearance setting. Property is set to false by default to allow for backwards compatibility to other parts of the app that also use this view.
  • Moved code for the main view into mainView property to allow for re-use.
  • Added branching to body property so toolbar background is modified if iOS16 or greater.
  • Added helper functions in InstructionsView extension. Helper functions will apply the appropriate theme colors if useSystemLightDarkMode is true, else the view property colors as set when the view was created are applied.

DevicePickerViewController

  • Moved tabTitleLabel property and code for setting the nav bar title into setNavBarTitle() so it is re-usable.
  • Added setNavBarAppearance() to configure the nav bar backgound colors.
  • Added subclass SendToDevicePickerViewController: DevicePickerViewController. Subclass has delegate traitCollectionDidChange() that responds to iOS appearance changes.

SendToDeviceHelper

  • Moved InstructionsView() call into getInstructionsView() so subclass can override.
  • Moved DevicePickerViewController() call into getDevicePickerViewController() so subclass can override.
  • Added subclass SendToExtensionHelper: SendToDeviceHelper to pass useSystemLightDarkMode flag to InstructionsView and call subclass SendToDevicePickerViewController instead of DevicePickerViewController

SendToDevice

  • Updated code to use subclass SendToExtensionHelper instead of SendToDeviceHelper and pass useSystemLightDarkMode: true flag.

ShareViewController

  • Changed currentTheme() to use traitCollection.userInterfaceStyle to set the appropriate theme in response to changes in appearance setting.
  • Added delegate traitCollectionDidChange() that responds to iOS appearance changes.

📝 Checklist

You have to check all boxes before merging

  • Filled in the above information (tickets numbers and description of your work)
  • Updated the PR name to follow our PR naming guidelines
  • Wrote unit tests and/or ensured the tests suite is passing
  • When working on UI, I checked and implemented accessibility (minimum Dynamic Text and VoiceOver)
  • If needed, I updated documentation / comments for complex code and public methods
  • If needed, added a backport comment (example @Mergifyio backport release/v120)

@tisumi99 tisumi99 requested a review from a team as a code owner May 16, 2024 18:44
@tisumi99 tisumi99 requested a review from nbhasin2 May 16, 2024 18:44
@tisumi99
Copy link
Contributor Author

Before - ShareTo Doesn't Change Theme

Screen.Recording.2024-05-16.at.12.00.38.PM.mp4

After - ShareTo Updates Theme

Screen.Recording.2024-05-16.at.12.06.11.PM.mp4

Copy link
Contributor

This PR has been automatically marked as stale. Please leave any comment to keep this PR opened. It will be closed automatically if no further update occurs in the next 7 days. Thank you for your contributions!

@github-actions github-actions bot added the stale Stalebot use this label to stale issues and PRs label May 31, 2024
@github-actions github-actions bot closed this Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Stalebot use this label to stale issues and PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant