48c6feaf75
* chore: check on installation type now as single module * feat(Reload notification): added support for after-install notification * feat(Reload notification): added support never show again notification
48 lines
1.9 KiB
TypeScript
48 lines
1.9 KiB
TypeScript
import {
|
|
workspace as Workspace,
|
|
commands as Commands
|
|
} from 'vscode';
|
|
|
|
import * as ThemeCommands from './commands';
|
|
import {setCustomSetting} from './helpers/settings';
|
|
import {onChangeConfiguration} from './helpers/configuration-change';
|
|
import {changelogMessage, installationMessage} from './helpers/messages';
|
|
import checkInstallation from './helpers/check-installation';
|
|
import writeChangelog from './helpers/write-changelog';
|
|
import handleAutoapply from './helpers/handle-autoapply';
|
|
|
|
export async function activate() {
|
|
const config = Workspace.getConfiguration();
|
|
const installationType = checkInstallation();
|
|
|
|
writeChangelog();
|
|
|
|
// Listen on set theme: when the theme is Material Theme, just adjust icon and accent.
|
|
Workspace.onDidChangeConfiguration(onChangeConfiguration);
|
|
|
|
// Delete old configuration, must remove with next major release
|
|
if (config.has('materialTheme.cache.workbench')) {
|
|
config.update('materialTheme.cache.workbench', undefined, true);
|
|
}
|
|
|
|
if (installationType.isFirstInstall) {
|
|
const enableAutoApply = await installationMessage();
|
|
await setCustomSetting('autoApplyIcons', enableAutoApply);
|
|
// Set true always on new installation
|
|
await setCustomSetting('showReloadNotification', true);
|
|
}
|
|
|
|
const shouldShowChangelog = (installationType.isFirstInstall || installationType.isUpdate) && await changelogMessage();
|
|
if (shouldShowChangelog) {
|
|
ThemeCommands.showChangelog();
|
|
}
|
|
|
|
// Registering commands
|
|
Commands.registerCommand('materialTheme.setAccent', async () => {
|
|
const wasSet = await ThemeCommands.accentsSetter();
|
|
handleAutoapply(wasSet);
|
|
});
|
|
Commands.registerCommand('materialTheme.fixIcons', () => ThemeCommands.fixIcons());
|
|
Commands.registerCommand('materialTheme.toggleApplyIcons', () => ThemeCommands.toggleApplyIcons());
|
|
Commands.registerCommand('materialTheme.showChangelog', () => ThemeCommands.showChangelog());
|
|
}
|