Abstract electron settings properly to avoid boilerplate-hell (#8798)

* Remove unused method `BasePlatform::screenCaptureErrorString`

* Improve platform typescripting

* Remove redundant awaits

* Abstract electron settings properly to avoid boilerplate-hell

* i18n

* Fix stray semi-colons

* Fix setting level order for Platform settings
This commit is contained in:
Michael Telatynski 2022-06-10 22:38:50 +01:00 committed by GitHub
parent 9b8b1d193e
commit ba2ce5ecba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 122 additions and 220 deletions

View file

@ -33,6 +33,7 @@ interface IProps {
// XXX: once design replaces all toggles make this the default
useCheckbox?: boolean;
disabled?: boolean;
hideIfCannotSet?: boolean;
onChange?(checked: boolean): void;
}
@ -76,6 +77,8 @@ export default class SettingsFlag extends React.Component<IProps, IState> {
public render() {
const canChange = SettingsStore.canSetValue(this.props.name, this.props.roomId, this.props.level);
if (!canChange && this.props.hideIfCannotSet) return null;
const label = this.props.label
? _t(this.props.label)
: SettingsStore.getDisplayName(this.props.name, this.props.level);