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 a SystemThemeObserver implementation for wasmJs #998

Merged
merged 2 commits into from Feb 6, 2024

Conversation

eygraber
Copy link

Proposed Changes

  • Implement SystemThemeObserver for wasmJs

Testing

Test: Built locally and used with a wasmJs compose app, and observed that dark mode was set correctly

Google CLA

Done

@eygraber
Copy link
Author

eygraber commented Feb 5, 2024

@igordmn any chance this gets into 1.6?

Copy link
Collaborator

@eymar eymar left a comment

Choose a reason for hiding this comment

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

LGTM! thanks!

@eymar
Copy link
Collaborator

eymar commented Feb 6, 2024

any chance this gets into 1.6?

yes, it will get into 1.6

@eymar
Copy link
Collaborator

eymar commented Feb 6, 2024

this change doesn't affect iOS, so Failing iOS unit tests is not a blocker here.

@eymar eymar merged commit ce31125 into JetBrains:jb-main Feb 6, 2024
1 of 2 checks passed
@eygraber eygraber deleted the wasm-system-theme-observer branch February 6, 2024 13:15
// supported by all browsers since 2015
// https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia
@JsFun("() => window.matchMedia != undefined")
Copy link

Choose a reason for hiding this comment

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

Question out of curiosity: why was this JsFun hack used instead of accessing the window global directly?

Copy link
Author

Choose a reason for hiding this comment

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

I believe I did that because the window global's matchMedia isn't nullable, and this check is to see if it exists, which I think wouldn't go well with using the global if it actually didn't exist (although I didn't actually test to see if it would crash).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants