-
-
Notifications
You must be signed in to change notification settings - Fork 116
api: jsonrpc api get_all_ui_config_keys to get all "ui.*" config keys
#7579
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
base: main
Are you sure you want to change the base?
Conversation
| } | ||
|
|
||
| /// Returns all `ui.*` config keys that were set by the UI. | ||
| pub async fn get_all_ui_config_keys(context: &Context) -> Result<Vec<String>> { |
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.
| pub async fn get_all_ui_config_keys(context: &Context) -> Result<Vec<String>> { | |
| pub async fn get_ui_config_keys(context: &Context) -> Result<Vec<String>> { |
I think that "all" isn't necessary, it's assumed. SysConfigKeys also doesn't have "All"
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.
wanted to put something there to differentiate it from SysConfigKeys`, because it does not return all possible keys, just the ones that were set by the ui.
(its impossible to know which ones exist, because they are not strictly defined and the UIs can save whatever they want there, for example I use it often in my bots to save state.)
link2xt
left a comment
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.
We have api: prefix that goes into API changes section.
Otherwise fine to merge assuming it's going to be used in desktop.
get_all_ui_config_keys to get all "ui.*" config keysget_all_ui_config_keys to get all "ui.*" config keys
|
desktop pr exists now: deltachat/deltachat-desktop#5871 |
Co-authored-by: iequidoo <117991069+iequidoo@users.noreply.github.com>
Adds an api to get all ui config keys. There already is an option to get all normal config keys (
"sys.config_keys"), but before this pr there was no way to get allui.*config keys.Why is this api needed?
For webxdc cleanup on desktop, which stores window position in a ui config key (such as
ui.desktop.webxdcBounds.676464) as soon as a webxdc is opened since many versions now. So listing all ui keys is a good way for us to find out which webxdc may have web data stored. unfortunately electron does not (yet?) have a way to list all origins that have web-data like android does, so this is the next best thing we can do before itterating all possible ids, see also deltachat/deltachat-desktop#5758.Why is this only a jsonrpc api and not another special/virtual config key like
"sys.config_keys"?r10s indicated that
ui.*-config keys are barely used (deltachat/deltachat-desktop#5790 (comment)), so I thought it makes more sense to add it as dedicated api which's existentence is checked by the typechecker, so it will be easier to not miss it when we should remove the api again in the future.But we could also do a dedicated special/virtual config key for it, if you think that is better, this is easy to change.