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

UI does not change theme while in Settings when system theme changes #9801

Closed
junbio opened this issue Jan 18, 2022 · 10 comments
Closed

UI does not change theme while in Settings when system theme changes #9801

junbio opened this issue Jan 18, 2022 · 10 comments
Labels
Bug 🐞 This is a bug with existing functionality not behaving as expected Contributor OK This is a good issue for contributors interested in helping the project P3 Issues that would be nice to have for the current release

Comments

@junbio
Copy link
Contributor

junbio commented Jan 18, 2022

Steps to reproduce

  1. Open settings
  2. Open Control Center
  3. Hold on brightness control
  4. Enable dark mode

Expected behavior

UI switches to dark mode

Actual behavior

UI remains light

Device & build information

  • Device: iPhone X (iOS 15.2.1)
  • Build version: Firefox Daylight 96.0 (7403)
    1. Notes
      Attachments:

┆Issue is synchronized with this Jira Task

@junbio junbio added the Bug 🐞 This is a bug with existing functionality not behaving as expected label Jan 18, 2022
@junbio
Copy link
Contributor Author

junbio commented Jan 18, 2022

Since BrowserViewController is in charge of handling system theme changes, and view controllers being presented in full screen delays underlying view controllers from changing their interface style, the UI does not switch. Changing the presentation style to form sheet does allow underlying view controllers to change their trait collections immediately, but this is not ideal. Doing this also fixes #9788.

@dnarcese dnarcese added the Contributor OK This is a good issue for contributors interested in helping the project label Jan 20, 2022
@data-sync-user data-sync-user added the P3 Issues that would be nice to have for the current release label Jan 20, 2022
@junbio
Copy link
Contributor Author

junbio commented Jan 25, 2022

Upon further examination, this bug occurs because some views are being presented with .fullScreen instead of .overFullScreen. There's a particular comment that explains this decision:

// On iPhone iOS13 the WKWebview crashes while presenting file picker if its not full screen. Ref #6232
if UIDevice.current.userInterfaceIdiom == .phone {
controller.modalPresentationStyle = .fullScreen
}

Do you know if this is still necessary? @lmarceau

@lmarceau
Copy link
Contributor

lmarceau commented Jan 25, 2022

@junbio This was brought in PR #6484 to fix issue #6232. It looks like something that still applies today, maybe worth checking to confirm? It can be tested by having a sync account to add an account picture.

@junbio
Copy link
Contributor Author

junbio commented Jan 25, 2022

If you open Settings by tapping the "Customize Homescreen" button, it is presented using .overFullScreen and not .fullScreen. If you navigate to the account picker in the current version of Firefox, I can confirm it doesn't crash when uploading an image.

@lmarceau
Copy link
Contributor

Interesting! And that was on iOS 13?

And what about if you remove the lines:

// On iPhone iOS13 the WKWebview crashes while presenting file picker if its not full screen. Ref #6232
if UIDevice.current.userInterfaceIdiom == .phone {
controller.modalPresentationStyle = .fullScreen
}

Does it work as well by opening the settings from the bottom toolbar (and not from the "Customize Homescreen" button) - has something changed?

If it crashes in that case still, then we would need to find the answer as to why opening from "Customize Homescreen" button with .overFullScreen works and not from the bottom toolbar 🤔

@junbio
Copy link
Contributor Author

junbio commented Jan 25, 2022

Interesting! And that was on iOS 13?

No, the current version of iOS 15.2.1 and the current App Store version of Firefox. But since all devices that run iOS 13 can be updated to iOS 15, I was wondering if this workaround was still necessary. You can guard it so the code only runs on iOS 14 or earlier.

If it crashes in that case still, then we would need to find the answer as to why opening from "Customize Homescreen" button with .overFullScreen works and not from the bottom toolbar 🤔

I also tried changing the modal presentation style from .fullScreen to .overFullScreen in the action sheet and it doesn't crash when uploading a photo or file. This is on the iOS 15 Simulator though.

@lmarceau
Copy link
Contributor

@junbio Ok well like you say we can maybe enclose this code in a version check with #available. We should keep the check to avoid that crash on iOS 13.0 devices only. Although devices can be updated, we still have some users on those OS and we're still supporting it. With that check, I would verify on iOS 14 and 15 that the crash isn't happening, on simulator and real device. I can test the part on the real device if you open a PR :)

@junbio
Copy link
Contributor Author

junbio commented Feb 8, 2022

I tested the current App Store version of Firefox on iOS 14.8.1 and it doesn't crash when selecting a new profile picture from Settings. Do you think iOS 14.0 is a good cutoff version?

@lmarceau
Copy link
Contributor

lmarceau commented Feb 9, 2022

@junbio Yeah, like in your PR I think it's ok! I'll test later this week. Thanks a lot!

@lmarceau
Copy link
Contributor

This bug is fixed as part of #11825. I'll close it here and ask for this to be tested as part of that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐞 This is a bug with existing functionality not behaving as expected Contributor OK This is a good issue for contributors interested in helping the project P3 Issues that would be nice to have for the current release
Projects
None yet
Development

No branches or pull requests

4 participants