Ux/reload notification (#232)
* 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
This commit is contained in:
parent
c91cc8cc0f
commit
48c6feaf75
10 changed files with 158 additions and 73 deletions
|
@ -2,24 +2,52 @@ import {
|
|||
window as Window
|
||||
} from 'vscode';
|
||||
|
||||
import * as ThemeCommands from './../commands';
|
||||
|
||||
const MESSAGES = {
|
||||
INFO: {
|
||||
message: 'Do you want to reload to apply Material Theme Icons to enjoy the full experience?',
|
||||
options: {ok: 'Yeah, releoad', cancel: 'No, thank you'}
|
||||
options: {ok: 'Yeah, reload', autoreload: 'Yes and enable auto-reload', cancel: 'No, thank you', nomore: 'Never show again'}
|
||||
},
|
||||
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) {
|
||||
ThemeCommands.fixIcons();
|
||||
const result = await Window.showInformationMessage(
|
||||
MESSAGES.INFO.message,
|
||||
MESSAGES.INFO.options.ok,
|
||||
MESSAGES.INFO.options.autoreload,
|
||||
MESSAGES.INFO.options.cancel,
|
||||
MESSAGES.INFO.options.nomore
|
||||
);
|
||||
|
||||
switch (result) {
|
||||
case MESSAGES.INFO.options.ok:
|
||||
return {reload: true};
|
||||
case MESSAGES.INFO.options.autoreload:
|
||||
return {reload: true, autoreload: true};
|
||||
case MESSAGES.INFO.options.nomore:
|
||||
return {nomore: true};
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
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.ok,
|
||||
MESSAGES.CHANGELOG.options.cancel
|
||||
) === MESSAGES.CHANGELOG.options.ok;
|
||||
|
||||
export const installationMessage = async () =>
|
||||
await Window.showInformationMessage(
|
||||
MESSAGES.INSTALLATION.message,
|
||||
MESSAGES.INSTALLATION.options.ok,
|
||||
MESSAGES.INSTALLATION.options.cancel,
|
||||
) === MESSAGES.INSTALLATION.options.ok;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue