Remove unused code left from extracting ThemeChoicePanel (#7002)

pull/21833/head
Andy Balaam 2021-10-21 09:59:34 +01:00 committed by GitHub
parent 7ab075fdfd
commit c73127c35c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 49 deletions

View File

@ -35,19 +35,7 @@ import ThemeChoicePanel from '../../ThemeChoicePanel';
interface IProps {
}
interface IThemeState {
theme: string;
useSystemTheme: boolean;
}
export interface CustomThemeMessage {
isError: boolean;
text: string;
}
interface IState extends IThemeState {
customThemeUrl: string;
customThemeMessage: CustomThemeMessage;
interface IState {
useSystemFont: boolean;
systemFont: string;
showAdvanced: boolean;
@ -68,9 +56,6 @@ export default class AppearanceUserSettingsTab extends React.Component<IProps, I
super(props);
this.state = {
...this.calculateThemeState(),
customThemeUrl: "",
customThemeMessage: { isError: false, text: "" },
useSystemFont: SettingsStore.getValue("useSystemFont"),
systemFont: SettingsStore.getValue("systemFont"),
showAdvanced: false,
@ -99,39 +84,6 @@ export default class AppearanceUserSettingsTab extends React.Component<IProps, I
this.unmounted = true;
}
private calculateThemeState(): IThemeState {
// We have to mirror the logic from ThemeWatcher.getEffectiveTheme so we
// show the right values for things.
const themeChoice: string = SettingsStore.getValue("theme");
const systemThemeExplicit: boolean = SettingsStore.getValueAt(
SettingLevel.DEVICE, "use_system_theme", null, false, true);
const themeExplicit: string = SettingsStore.getValueAt(
SettingLevel.DEVICE, "theme", null, false, true);
// If the user has enabled system theme matching, use that.
if (systemThemeExplicit) {
return {
theme: themeChoice,
useSystemTheme: true,
};
}
// If the user has set a theme explicitly, use that (no system theme matching)
if (themeExplicit) {
return {
theme: themeChoice,
useSystemTheme: false,
};
}
// Otherwise assume the defaults for the settings
return {
theme: themeChoice,
useSystemTheme: SettingsStore.getValueAt(SettingLevel.DEVICE, "use_system_theme"),
};
}
private onLayoutChanged = (layout: Layout): void => {
this.setState({ layout: layout });
};