Remove unused code left from extracting ThemeChoicePanel (#7002)
This commit is contained in:
parent
7ab075fdfd
commit
c73127c35c
1 changed files with 1 additions and 49 deletions
|
@ -35,19 +35,7 @@ import ThemeChoicePanel from '../../ThemeChoicePanel';
|
||||||
interface IProps {
|
interface IProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IThemeState {
|
interface IState {
|
||||||
theme: string;
|
|
||||||
useSystemTheme: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CustomThemeMessage {
|
|
||||||
isError: boolean;
|
|
||||||
text: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IState extends IThemeState {
|
|
||||||
customThemeUrl: string;
|
|
||||||
customThemeMessage: CustomThemeMessage;
|
|
||||||
useSystemFont: boolean;
|
useSystemFont: boolean;
|
||||||
systemFont: string;
|
systemFont: string;
|
||||||
showAdvanced: boolean;
|
showAdvanced: boolean;
|
||||||
|
@ -68,9 +56,6 @@ export default class AppearanceUserSettingsTab extends React.Component<IProps, I
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
...this.calculateThemeState(),
|
|
||||||
customThemeUrl: "",
|
|
||||||
customThemeMessage: { isError: false, text: "" },
|
|
||||||
useSystemFont: SettingsStore.getValue("useSystemFont"),
|
useSystemFont: SettingsStore.getValue("useSystemFont"),
|
||||||
systemFont: SettingsStore.getValue("systemFont"),
|
systemFont: SettingsStore.getValue("systemFont"),
|
||||||
showAdvanced: false,
|
showAdvanced: false,
|
||||||
|
@ -99,39 +84,6 @@ export default class AppearanceUserSettingsTab extends React.Component<IProps, I
|
||||||
this.unmounted = true;
|
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 => {
|
private onLayoutChanged = (layout: Layout): void => {
|
||||||
this.setState({ layout: layout });
|
this.setState({ layout: layout });
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue