From b8fec9ff019c58bfe4178fac9ef1236b7c62e961 Mon Sep 17 00:00:00 2001 From: Alessio Occhipinti Date: Thu, 21 Jun 2018 23:02:57 +0200 Subject: [PATCH] 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 --- extensions/defaults.json | 34 ++++++++++++++--------------- extensions/helpers/messages.ts | 17 ++++++++++++--- extensions/material.theme.config.ts | 9 +++++--- 3 files changed, 36 insertions(+), 24 deletions(-) diff --git a/extensions/defaults.json b/extensions/defaults.json index 90acb09..c19f5db 100644 --- a/extensions/defaults.json +++ b/extensions/defaults.json @@ -196,24 +196,22 @@ "Ocean High Contrast": "vs-dark" }, "variantsIcons": [ - "_folder_dark_build", - "_folder_dark", - "_folder_light_build", - "_folder_light", - "_folder_vscode", + "_folder_sass", + "_folder_css", + "_folder_ci", + "_folder_dist", + "_folder_test", + "_folder_github", + "_folder_git", + "_folder_bower", + "_folder_assets", + "_folder_src", + "_folder_js", + "_folder_images", "_folder_gulp", "_folder_node", - "_folder_images", - "_folder_js", - "_folder_css", - "_folder_sass", - "_folder_src", - "_folder_assets", - "_folder_bower", - "_folder_git", - "_folder_github", - "_folder_test", - "_folder_dist", - "_folder_ci" + "_folder_vscode", + "_folder_dark", + "_folder_light" ] -} \ No newline at end of file +} diff --git a/extensions/helpers/messages.ts b/extensions/helpers/messages.ts index a33a2af..1d60dd1 100644 --- a/extensions/helpers/messages.ts +++ b/extensions/helpers/messages.ts @@ -4,11 +4,22 @@ import { import * as ThemeCommands from './../commands'; -const INFO_MESSAGE = 'You should reload the window for full activate the Material Theme.'; -const OPTIONS = {ok: 'Reload now', cancel: 'Cancel'}; +const MESSAGES = { + 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 () => { - 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(); } }; + +export const changelogMessage = async () => + await Window.showInformationMessage(MESSAGES.CHANGELOG.message, MESSAGES.CHANGELOG.options.ok, MESSAGES.CHANGELOG.options.cancel) === MESSAGES.CHANGELOG.options.ok; diff --git a/extensions/material.theme.config.ts b/extensions/material.theme.config.ts index 8466755..e3086e9 100644 --- a/extensions/material.theme.config.ts +++ b/extensions/material.theme.config.ts @@ -6,10 +6,10 @@ import { import * as ThemeCommands from './commands'; import {isAutoApplyEnable} from './helpers/settings'; import {onChangeConfiguration} from './helpers/configuration-change'; -import {infoMessage} from './helpers/messages'; +import {infoMessage, changelogMessage} from './helpers/messages'; import shouldShowChangelog from './helpers/should-show-changelog'; -export function activate() { +export async function activate() { const config = Workspace.getConfiguration(); // Listen on set theme: when the theme is Material Theme, just adjust icon and accent. @@ -21,7 +21,10 @@ export function activate() { } if (shouldShowChangelog()) { - ThemeCommands.showChangelog(); + const show = await changelogMessage(); + if (show) { + ThemeCommands.showChangelog(); + } } // Registering commands