Skip to content

Commit

Permalink
Added option to disable restart message.
Browse files Browse the repository at this point in the history
References #225
  • Loading branch information
PKief committed Apr 4, 2018
1 parent 8bdabfd commit 08a0cbc
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 4 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@
"default": false,
"description": "%configuration.showUpdateMessage%"
},
"material-icon-theme.showReloadMessage": {
"type": "boolean",
"default": true,
"description": "%configuration.showReloadMessage%"
},
"material-icon-theme.activeIconPack": {
"type": "string",
"default": "angular",
Expand Down
1 change: 1 addition & 0 deletions package.nls.de.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"configuration.languages.associations": "Benutzerdefinierte Language Icons konfigurieren.",
"configuration.showWelcomeMessage": "Willkommensnachricht nach der ersten Installation anzeigen.",
"configuration.showUpdateMessage": "Nachricht bei Aktualisierungen anzeigen.",
"configuration.showReloadMessage": "Nachricht zum Neustarten anzeigen.",
"configuration.activeIconPack": "Icon Paket auswählen, die bestimme Icons aktivieren.",
"configuration.folders.theme": "Art der Ordner Icons auswählen.",
"configuration.folders.color": "Farbe der Ordner Icons verändern.",
Expand Down
1 change: 1 addition & 0 deletions package.nls.es.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"configuration.languages.associations": "Configurar asociaciones personalizadas de iconos de idioma.",
"configuration.showWelcomeMessage": "Mostrar mensaje de bienvenida después de la primera instalación.",
"configuration.showUpdateMessage": "Mostrar mensaje al actualizar.",
"configuration.showReloadMessage": "Mostrar mensaje de reinicio.",
"configuration.activeIconPack": "Seleccione un paquete de iconos que permita iconos específicos.",
"configuration.folders.theme": "Seleccione el tipo de iconos de carpeta.",
"configuration.folders.color": "Cambia el color de las carpetas.",
Expand Down
1 change: 1 addition & 0 deletions package.nls.fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"configuration.languages.associations": "Configurer des associations d'icônes de langue personnalisées.",
"configuration.showWelcomeMessage": "Afficher le message de bienvenue après l'installation initiale",
"configuration.showUpdateMessage": "Afficher le message de mise à jour.",
"configuration.showReloadMessage": "Afficher le message de redémarrage.",
"configuration.activeIconPack": "Sélectionner un pack d'icônes qui active des icônes spécifiques.",
"configuration.folders.theme": "Sélectionner le type d'icônes de dossier.",
"configuration.folders.color": "Changer la couleur des icônes du dossier.",
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"configuration.languages.associations": "Set custom language icon associations.",
"configuration.showWelcomeMessage": "Show the welcome message after first installation.",
"configuration.showUpdateMessage": "Show the update message after each update.",
"configuration.showReloadMessage": "Show restart notification.",
"configuration.activeIconPack": "Select an icon pack that enables specific icons.",
"configuration.folders.theme": "Set the type for the folder icons.",
"configuration.folders.color": "Change the color of the folder icons.",
Expand Down
1 change: 1 addition & 0 deletions package.nls.pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"configuration.languages.associations": "Definir ícones para associações de idiomas customizadas.",
"configuration.showWelcomeMessage": "Mostrar mensagem de bem-vindo após a primeira instalação.",
"configuration.showUpdateMessage": "Mostrar mensagem de atualização após cada atualização.",
"configuration.showReloadMessage": "Mostrar mensagem da reinicialização.",
"configuration.activeIconPack": "Selecione um pacote de ícones que habilitam ícones específicos.",
"configuration.folders.icons": "Definir o tipo de ícones de pasta.",
"configuration.folders.theme": "Definir o tipo dos ícones das pastas.",
Expand Down
1 change: 1 addition & 0 deletions package.nls.pt-PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"configuration.languages.associations": "Definir ícones para associações de idiomas personalizados.",
"configuration.showWelcomeMessage": "Exibir mensagem de boas-vindas após a primeira instalação.",
"configuration.showUpdateMessage": "Exibir mensagem de actualização após cada actualização.",
"configuration.showReloadMessage": "Exibir mensagem da reinicialização.",
"configuration.activeIconPack": "Selecciona um pacote de ícones que habilitam ícones específicos.",
"configuration.folders.icons": "Definir o formato de ícones de directórios.",
"configuration.folders.theme": "Definir o formato dos ícones dos directórios.",
Expand Down
1 change: 1 addition & 0 deletions package.nls.ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"configuration.languages.associations": "Настройка ассоциаций значков пользовательского языка.",
"configuration.showWelcomeMessage": "Показывать приветственное сообщение после первой установки.",
"configuration.showUpdateMessage": "Показывать сообщение об обновлении после каждого обновления.",
"configuration.showReloadMessage": "Показывать сообщение перезагрузки.",
"configuration.activeIconPack": "Выберите набор значков, которые включают определенные значки.",
"configuration.folders.theme": "Установить тип иконок для папок.",
"configuration.folders.color": "Изменение цвета иконок папок.",
Expand Down
1 change: 1 addition & 0 deletions package.nls.zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"configuration.languages.associations": "定义自定义语言映射的图标。",
"configuration.showWelcomeMessage": "首次安装后显示欢迎信息。",
"configuration.showUpdateMessage": "更新后显示升级信息。",
"configuration.showReloadMessage": "显示重启消息。",
"configuration.activeIconPack": "选择一个图标包。",
"configuration.folders.theme": "设置文件夹图标类型。\n接受的值为 \"specific\", \"classic\"\"none\"",
"configuration.folders.color": "更改文件夹图标的颜色。",
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/change-detection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const compareConfigs = (configs: string[]): Promise<{ [name: string]: any }> =>
return getMaterialIconsJSON().then(json => {
configs.forEach(configName => {
// no further actions (e.g. reload) required
if (/show(Welcome|Update)Message/g.test(configName)) return;
if (/show(Welcome|Update|Reload)Message/g.test(configName)) return;

const configValue = getThemeConfig(configName).globalValue;
const currentState = getObjectPropertyValue(json.options, configName);
Expand Down
28 changes: 25 additions & 3 deletions src/messages/reload.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
import * as vscode from 'vscode';
import * as i18n from './../i18n';
import * as helpers from './../helpers';

/** User has to confirm if he wants to reload the editor */
export const showConfirmToReloadMessage = (): Promise<boolean> => {
return new Promise((resolve, reject) => {
// if the user does not want to see the reload message
if (helpers.getThemeConfig('showReloadMessage').globalValue === false) return;

vscode.window.showInformationMessage(
i18n.translate('confirmReload'),
i18n.translate('reload')
i18n.translate('reload'),
i18n.translate('neverShowAgain')
).then(value => {
if (value === i18n.translate('reload')) resolve(true);
else resolve(false);
switch (value) {
case i18n.translate('reload'):
resolve(true);
break;

case i18n.translate('neverShowAgain'):
disableReloadMessage();
resolve(false);
break;

default:
resolve(false);
break;
}
});
});
};

/** Disable the reload message in the global settings */
const disableReloadMessage = () => {
helpers.setThemeConfig('showReloadMessage', false, true);
};

0 comments on commit 08a0cbc

Please sign in to comment.