-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Adding dark and light theme names to the sponsor request (params to API) #3561
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
Conversation
This comment has been minimized.
This comment has been minimized.
|
We have something like: betaflight-configurator/src/js/tabs/receiver.js Lines 563 to 565 in ff4b62d
and betaflight-configurator/src/js/tabs/options.js Lines 180 to 189 in ff4b62d
|
Yes,i think is better to go with the current available function. |
|
AUTOMERGE: (FAIL)
|
| loadSponsorTile(onSuccess, onFailure) { | ||
| const url = `${this._url}/api/configurator/sponsors`; | ||
| loadSponsorTile(mode, onSuccess, onFailure) { | ||
| const url = `${this._url}/api/configurator/sponsors/${mode}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking for window.matchMedia('(prefers-color-scheme: dark)').matches would do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll test this.
|
|
||
| const DarkTheme = { | ||
| configEnabled: undefined, | ||
| enabled: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would duplicate configEnabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I'm not sure it does. It looked to me that configEnabled is not binary, so supports the option 'honour the system' so can't be relied upon for stating that dark theme was in fact enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Above statement would extract the value or [use] get ConfigStorage darkTheme value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which means configEnabled is not well named. It should be configSetting or similar. It can't be relied upon as to if it's actually applied or not... sure it'll have a value of two... but does that mean dark theme is active? I don't think it does because the test of isEnabled is not persisted...
… or not the darkTheme is currently enabled (just its setting).
|
Kudos, SonarCloud Quality Gate passed!
|
betaflight-configurator/src/js/DarkTheme.js Lines 44 to 46 in 9599c0a
I actually don't like this approach. The reason is both receiver.js and darktheme.js are coupled together. It would be better that receiver (and any others) registers its interest (observes) the enabled / disabled aspect of darktheme (and gets a callback when it happens). Then darktheme is entirely standalone... and not coupled to any tabs. |
|
Do you want to test this code? Here you have an automated build: |
|
Agree, it's part of code from 2020 to fix dark theme on Android. |
I'll clean it up. |
|
@haslinghuis @nerdCopter this is good to go as is... I will fix up the call backs separately in another PR |
…PI) (betaflight#3561) * Adding dark and light theme names to the sponsor request (params to API) * Renamed configEnabled to configSetting as it does not reflect whether or not the darkTheme is currently enabled (just its setting). * Missed the configEnabled in the optionsTab.








I couldn't see any way to identify whether or not the dark theme was enabled or not. So added the property to DarkTheme.
If anyway has a better idea please let me know.