feat(Reload notification): added support for after-install notification

This commit is contained in:
LasaleFamine 2018-08-12 11:52:58 +02:00
parent 0ecb7ff066
commit a42b3a0f86
3 changed files with 33 additions and 5 deletions

View file

@ -12,14 +12,30 @@ const MESSAGES = {
CHANGELOG: {
message: 'Material Theme was updated. Check the release notes for more details.',
options: {ok: 'Show me', cancel: 'Maybe later'}
},
INSTALLATION: {
message: 'Thank you for installing Material Theme! Would you like to enable the auto-application (with window reload when needed) of the Material Theme icons?',
options: {ok: 'Sure!', cancel: 'Nope :('}
}
};
export const infoMessage = async () => {
if (await Window.showInformationMessage(MESSAGES.INFO.message, MESSAGES.INFO.options.ok, MESSAGES.INFO.options.cancel) === MESSAGES.INFO.options.ok) {
if (await Window.showInformationMessage(
MESSAGES.INFO.message,
...MESSAGES.INFO.options as any
) === MESSAGES.INFO.options.ok) {
ThemeCommands.fixIcons();
}
};
export const changelogMessage = async () =>
await Window.showInformationMessage(MESSAGES.CHANGELOG.message, MESSAGES.CHANGELOG.options.ok, MESSAGES.CHANGELOG.options.cancel) === MESSAGES.CHANGELOG.options.ok;
await Window.showInformationMessage(
MESSAGES.CHANGELOG.message,
...MESSAGES.CHANGELOG.options as any
) === MESSAGES.CHANGELOG.options.ok;
export const installationMessage = async () =>
await Window.showInformationMessage(
MESSAGES.INSTALLATION.message,
...MESSAGES.INSTALLATION.options as any
) === MESSAGES.INSTALLATION.options.ok;

View file

@ -4,9 +4,9 @@ import {
} from 'vscode';
import * as ThemeCommands from './commands';
import {isAutoApplyEnable} from './helpers/settings';
import {isAutoApplyEnable, setCustomSetting} from './helpers/settings';
import {onChangeConfiguration} from './helpers/configuration-change';
import {infoMessage, changelogMessage} from './helpers/messages';
import {infoMessage, changelogMessage, installationMessage} from './helpers/messages';
import checkInstallation from './helpers/check-installation';
import writeChangelog from './helpers/write-changelog';
@ -24,6 +24,13 @@ export async function activate() {
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();

View file

@ -93,7 +93,12 @@
},
"materialTheme.autoApplyIcons": {
"type": "boolean",
"description": "Enable/disable auto-apply of Material Theme icons",
"description": "Enable/disable auto-apply of Material Theme icons with window reload when needed",
"default": false
},
"materialTheme.showReloadNotification": {
"type": "boolean",
"description": "Useful when autoApplyIcons is false and you want to be asked to reload the window when needed",
"default": true
},
"materialTheme.fixIconsRunning": {