Skip to content

Commit 92fec02

Browse files
authored
[VSC-1753]Add notification system for pre-releases campaigns (#1643)
* Add notification system for pre-releases campaigns * Fix lint Show notification again for "learn more" * fix lint * Fix notification for "learn more"
1 parent 88578fb commit 92fec02

File tree

7 files changed

+172
-4
lines changed

7 files changed

+172
-4
lines changed

l10n/bundle.l10n.es.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,5 +257,11 @@
257257
"Clear Build Error Hints": "Borrar Pistas de Error de Compilación",
258258
"Clear OpenOCD Error Hints": "Borrar Pistas de Error de OpenOCD",
259259
"Open Reference": "Abrir Referencia",
260-
"Launch Debug": "Iniciar depuración"
260+
"Launch Debug": "Iniciar depuración",
261+
"🎉 New ESP-IDF Extension setup available! We've completely redesigned the installation process with the ESP-IDF Installer Manager (EIM) for a smoother, more reliable setup experience. Help us improve by trying the pre-release!": "🎉 ¡Nueva configuración de la extensión ESP-IDF disponible! Hemos rediseñado completamente el proceso de instalación con el Gestor de Instalación ESP-IDF (EIM) para una experiencia de configuración más fluida y confiable. ¡Ayúdanos a mejorar probando la versión preliminar!",
262+
"Try New Pre-Release": "Probar nueva versión preliminar",
263+
"Learn More": "Más información",
264+
"Not Now": "Ahora no",
265+
"To install the pre-release version, click the 'Switch to Pre-Release Version' button.": "Para instalar la versión preliminar, haga clic en el botón 'Cambiar a versión preliminar'.",
266+
"Got it": "Entendido"
261267
}

l10n/bundle.l10n.pt.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,5 +258,11 @@
258258
"Clear Build Error Hints": "Limpar Dicas de Erro de Compilação",
259259
"Clear OpenOCD Error Hints": "Limpar Dicas de Erro do OpenOCD",
260260
"Open Reference": "Abrir Referência",
261-
"Launch Debug": "Iniciar depuração"
261+
"Launch Debug": "Iniciar depuração",
262+
"🎉 New ESP-IDF Extension setup available! We've completely redesigned the installation process with the ESP-IDF Installer Manager (EIM) for a smoother, more reliable setup experience. Help us improve by trying the pre-release!": "🎉 Nova configuração da extensão ESP-IDF disponível! Redesenhamos completamente o processo de instalação com o Gerenciador de Instalação ESP-IDF (EIM) para uma experiência de configuração mais suave e confiável. Ajude-nos a melhorar experimentando a versão pré-lançamento!",
263+
"Try New Pre-Release": "Experimentar nova versão pré-lançamento",
264+
"Learn More": "Saiba mais",
265+
"Not Now": "Agora não",
266+
"To install the pre-release version, click the 'Switch to Pre-Release Version' button.": "Para instalar a versão pré-lançamento, clique no botão 'Alternar para versão pré-lançamento'.",
267+
"Got it": "Entendi"
262268
}

l10n/bundle.l10n.ru.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,5 +258,11 @@
258258
"Clear Build Error Hints": "Очистить подсказки по ошибкам сборки",
259259
"Clear OpenOCD Error Hints": "Очистить подсказки по ошибкам OpenOCD",
260260
"Open Reference": "Открыть ссылку",
261-
"Launch Debug": "Запуск отладки"
261+
"Launch Debug": "Запуск отладки",
262+
"🎉 New ESP-IDF Extension setup available! We've completely redesigned the installation process with the ESP-IDF Installer Manager (EIM) for a smoother, more reliable setup experience. Help us improve by trying the pre-release!": "🎉 Доступна новая настройка расширения ESP-IDF! Мы полностью переработали процесс установки с помощью Менеджера установки ESP-IDF (EIM) для более плавного и надежного опыта настройки. Помогите нам улучшить его, попробовав предварительную версию!",
263+
"Try New Pre-Release": "Попробовать новую предварительную версию",
264+
"Learn More": "Узнать больше",
265+
"Not Now": "Не сейчас",
266+
"To install the pre-release version, click the 'Switch to Pre-Release Version' button.": "Для установки предварительной версии нажмите кнопку 'Переключиться на предварительную версию'.",
267+
"Got it": "Понятно"
262268
}

l10n/bundle.l10n.zh-CN.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,5 +258,11 @@
258258
"Clear Build Error Hints": "清除构建错误提示",
259259
"Clear OpenOCD Error Hints": "清除 OpenOCD 错误提示",
260260
"Open Reference": "打开参考",
261-
"Launch Debug": "启动调试"
261+
"Launch Debug": "启动调试",
262+
"🎉 New ESP-IDF Extension setup available! We've completely redesigned the installation process with the ESP-IDF Installer Manager (EIM) for a smoother, more reliable setup experience. Help us improve by trying the pre-release!": "🎉 新的 ESP-IDF 扩展设置已发布!我们使用 ESP-IDF 安装管理器 (EIM) 完全重新设计了安装过程,提供更流畅、更可靠的设置体验。通过试用预发布版本帮助我们改进!",
263+
"Try New Pre-Release": "试用新的预发布版本",
264+
"Learn More": "了解更多",
265+
"Not Now": "暂不使用",
266+
"To install the pre-release version, click the 'Switch to Pre-Release Version' button.": "要安装预发布版本,请点击\"切换到预发布版本\"按钮。",
267+
"Got it": "知道了"
262268
}

src/config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ export namespace ESP {
9090
export const DB_VERSION_KEY = "esp.extension.version";
9191
}
9292

93+
export namespace PreReleaseNotification {
94+
export const SHOWN_KEY = "espIdf.prerelease.notification.shown";
95+
// Specific notification campaigns - add new ones for future campaigns
96+
export const EIM_SETUP_CAMPAIGN = "eim-setup-2025";
97+
}
98+
9399
export namespace URL {
94100
export const IDF_GITHUB_ASSETS = "https://dl.espressif.com/github_assets";
95101
export const IDF_VERSIONS =

src/extension.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ import { getEspAdf } from "./espAdf/espAdfDownload";
7979
import { getEspMdf } from "./espMdf/espMdfDownload";
8080
import { SetupPanel } from "./setup/SetupPanel";
8181
import { ChangelogViewer } from "./changelog-viewer";
82+
import { PreReleaseNotification } from "./preReleaseNotification";
8283
import { getSetupInitialValues, ISetupInitArgs } from "./setup/setupInit";
8384
import {
8485
getVirtualEnvPythonPath,
@@ -287,6 +288,9 @@ export async function activate(context: vscode.ExtensionContext) {
287288
utils.setExtensionContext(context);
288289
ChangelogViewer.showChangeLogAndUpdateVersion(context);
289290

291+
// Show pre-release notification if not shown for this version
292+
PreReleaseNotification.showPreReleaseNotification(context);
293+
290294
// Check if running in a VS Code fork and prompt for clangd extension installation
291295
if (PreCheck.isRunningInVSCodeFork()) {
292296
await checkAndPromptForClangdExtension();

src/preReleaseNotification.ts

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
/*
2+
* Project: ESP-IDF VSCode Extension
3+
* File Created: Thursday, 7th August 2025
4+
* Copyright 2024 Espressif Systems (Shanghai) CO LTD
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import { ExtensionContext, window, env, Uri, l10n } from "vscode";
20+
import { ESP } from "./config";
21+
import { Logger } from "./logger/logger";
22+
import { packageJson } from "./utils";
23+
import { NotificationMode, readParameter } from "./idfConfiguration";
24+
import { Telemetry } from "./telemetry";
25+
26+
export namespace PreReleaseNotification {
27+
export async function showPreReleaseNotification(context: ExtensionContext) {
28+
// Check if this specific campaign was already shown
29+
const campaignKey = ESP.PreReleaseNotification.EIM_SETUP_CAMPAIGN;
30+
const shownCampaigns = context.globalState.get<string[]>(
31+
ESP.PreReleaseNotification.SHOWN_KEY,
32+
[]
33+
);
34+
35+
// Check notification settings
36+
const notificationMode = readParameter("idf.notificationMode") as string;
37+
const enableNotification =
38+
notificationMode === NotificationMode.All ||
39+
notificationMode === NotificationMode.Notifications;
40+
41+
// Only show if this campaign hasn't been shown and notifications are enabled
42+
if (!shownCampaigns.includes(campaignKey) && enableNotification) {
43+
// Track that the notification was shown
44+
Telemetry.sendEvent("preReleaseNotification", {
45+
campaign: campaignKey,
46+
action: "shown",
47+
extensionVersion: packageJson.version,
48+
});
49+
50+
const message = l10n.t(
51+
"🎉 New ESP-IDF Extension setup available! We've completely redesigned the installation process with the ESP-IDF Installer Manager (EIM) for a smoother, more reliable setup experience. Help us improve by trying the pre-release!"
52+
);
53+
54+
const tryPreRelease = l10n.t("Try New Pre-Release");
55+
const learnMore = l10n.t("Learn More");
56+
const notNow = l10n.t("Not Now");
57+
58+
const response = await window.showInformationMessage(
59+
message,
60+
{ modal: false },
61+
tryPreRelease,
62+
learnMore,
63+
notNow
64+
);
65+
66+
if (response === tryPreRelease) {
67+
// Track user clicked to try pre-release
68+
Telemetry.sendEvent("preReleaseNotification", {
69+
campaign: campaignKey,
70+
action: "tryPreRelease",
71+
extensionVersion: packageJson.version,
72+
});
73+
74+
// Open the extension in Extensions view
75+
const extensionUri = Uri.parse(
76+
"vscode:extension/espressif.esp-idf-extension"
77+
);
78+
await env.openExternal(extensionUri);
79+
80+
// Show additional guidance for enabling pre-release
81+
const preReleaseInfo = await window.showInformationMessage(
82+
l10n.t(
83+
"To install the pre-release version, click the 'Switch to Pre-Release Version' button."
84+
),
85+
{ modal: false },
86+
l10n.t("Got it")
87+
);
88+
89+
Logger.info("User clicked to try pre-release from notification");
90+
91+
// Mark this campaign as shown when user tries pre-release
92+
const updatedCampaigns = [...shownCampaigns, campaignKey];
93+
await context.globalState.update(
94+
ESP.PreReleaseNotification.SHOWN_KEY,
95+
updatedCampaigns
96+
);
97+
} else if (response === learnMore) {
98+
// Track user clicked to learn more
99+
Telemetry.sendEvent("preReleaseNotification", {
100+
campaign: campaignKey,
101+
action: "learnMore",
102+
extensionVersion: packageJson.version,
103+
});
104+
105+
// Open documentation about the new setup experience
106+
const docsUri = Uri.parse(
107+
"https://docs.espressif.com/projects/idf-im-ui/en/latest/"
108+
);
109+
await env.openExternal(docsUri);
110+
Logger.info("User clicked to learn more from pre-release notification");
111+
112+
// Re-show the notification after viewing docs
113+
setTimeout(() => {
114+
showPreReleaseNotification(context);
115+
}, 2000); // Small delay to let the external browser open
116+
} else {
117+
// Track user dismissed the notification (clicked "Not Now" or dismissed)
118+
Telemetry.sendEvent("preReleaseNotification", {
119+
campaign: campaignKey,
120+
action: response ? "notNow" : "dismissed",
121+
extensionVersion: packageJson.version,
122+
});
123+
Logger.info("User dismissed pre-release notification");
124+
125+
// Mark this campaign as shown only when dismissed or "Not Now"
126+
const updatedCampaigns = [...shownCampaigns, campaignKey];
127+
await context.globalState.update(
128+
ESP.PreReleaseNotification.SHOWN_KEY,
129+
updatedCampaigns
130+
);
131+
}
132+
}
133+
}
134+
}

0 commit comments

Comments
 (0)