Support for message before show changelog page (#207)

* chore: update variantsIcons defaults

* chore(show-changelog): added message for changelog

* chore(show-changelog): added check for message ok

* chore: removed wrong added variantsIcons
This commit is contained in:
Alessio Occhipinti 2018-06-21 23:02:57 +02:00 committed by Mattia Astorino
parent 1b49c2edca
commit b8fec9ff01
3 changed files with 36 additions and 24 deletions

View file

@ -196,24 +196,22 @@
"Ocean High Contrast": "vs-dark" "Ocean High Contrast": "vs-dark"
}, },
"variantsIcons": [ "variantsIcons": [
"_folder_dark_build", "_folder_sass",
"_folder_dark", "_folder_css",
"_folder_light_build", "_folder_ci",
"_folder_light", "_folder_dist",
"_folder_vscode", "_folder_test",
"_folder_github",
"_folder_git",
"_folder_bower",
"_folder_assets",
"_folder_src",
"_folder_js",
"_folder_images",
"_folder_gulp", "_folder_gulp",
"_folder_node", "_folder_node",
"_folder_images", "_folder_vscode",
"_folder_js", "_folder_dark",
"_folder_css", "_folder_light"
"_folder_sass",
"_folder_src",
"_folder_assets",
"_folder_bower",
"_folder_git",
"_folder_github",
"_folder_test",
"_folder_dist",
"_folder_ci"
] ]
} }

View file

@ -4,11 +4,22 @@ import {
import * as ThemeCommands from './../commands'; import * as ThemeCommands from './../commands';
const INFO_MESSAGE = 'You should reload the window for full activate the Material Theme.'; const MESSAGES = {
const OPTIONS = {ok: 'Reload now', cancel: 'Cancel'}; INFO: {
message: 'You should reload the window for full activate the Material Theme.',
options: {ok: 'Reload now', cancel: 'Cancel'}
},
CHANGELOG: {
message: 'Material Theme was updated. Check the changelog for more details!',
options: {ok: 'Show changelog', cancel: 'Maybe later'}
}
};
export const infoMessage = async () => { export const infoMessage = async () => {
if (await Window.showInformationMessage(INFO_MESSAGE, OPTIONS.ok, OPTIONS.cancel) === OPTIONS.ok) { if (await Window.showInformationMessage(MESSAGES.INFO.message, MESSAGES.INFO.options.ok, MESSAGES.INFO.options.cancel) === MESSAGES.INFO.options.ok) {
ThemeCommands.fixIcons(); ThemeCommands.fixIcons();
} }
}; };
export const changelogMessage = async () =>
await Window.showInformationMessage(MESSAGES.CHANGELOG.message, MESSAGES.CHANGELOG.options.ok, MESSAGES.CHANGELOG.options.cancel) === MESSAGES.CHANGELOG.options.ok;

View file

@ -6,10 +6,10 @@ import {
import * as ThemeCommands from './commands'; import * as ThemeCommands from './commands';
import {isAutoApplyEnable} from './helpers/settings'; import {isAutoApplyEnable} from './helpers/settings';
import {onChangeConfiguration} from './helpers/configuration-change'; import {onChangeConfiguration} from './helpers/configuration-change';
import {infoMessage} from './helpers/messages'; import {infoMessage, changelogMessage} from './helpers/messages';
import shouldShowChangelog from './helpers/should-show-changelog'; import shouldShowChangelog from './helpers/should-show-changelog';
export function activate() { export async function activate() {
const config = Workspace.getConfiguration(); const config = Workspace.getConfiguration();
// Listen on set theme: when the theme is Material Theme, just adjust icon and accent. // Listen on set theme: when the theme is Material Theme, just adjust icon and accent.
@ -21,7 +21,10 @@ export function activate() {
} }
if (shouldShowChangelog()) { if (shouldShowChangelog()) {
ThemeCommands.showChangelog(); const show = await changelogMessage();
if (show) {
ThemeCommands.showChangelog();
}
} }
// Registering commands // Registering commands