From 100f08f9b335a6011fbab7056d6171868bc77541 Mon Sep 17 00:00:00 2001 From: Giacomo Cusinato <7659518+giacomocusinato@users.noreply.github.com> Date: Wed, 5 Nov 2025 17:39:50 +0100 Subject: [PATCH 1/2] chore: remove donation dialog and links --- .../browser/arduino-ide-frontend-module.ts | 9 -- .../contributions/check-for-ide-updates.ts | 43 ++----- .../ide-updater/ide-updater-dialog.tsx | 47 -------- .../dialogs/version-welcome-dialog.tsx | 107 ------------------ .../src/browser/style/ide-updater-dialog.css | 32 ------ .../src/browser/style/index.css | 1 - .../browser/style/version-welcome-dialog.css | 7 -- i18n/en.json | 11 -- 8 files changed, 7 insertions(+), 250 deletions(-) delete mode 100644 arduino-ide-extension/src/browser/dialogs/version-welcome-dialog.tsx delete mode 100644 arduino-ide-extension/src/browser/style/version-welcome-dialog.css diff --git a/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts b/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts index 9625ffae5..bc0caaee1 100644 --- a/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts +++ b/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts @@ -368,10 +368,6 @@ import { DebugConfigurationWidget } from './theia/debug/debug-configuration-widg import { DebugConfigurationWidget as TheiaDebugConfigurationWidget } from '@theia/debug/lib/browser/view/debug-configuration-widget'; import { DebugToolBar } from '@theia/debug/lib/browser/view/debug-toolbar-widget'; -import { - VersionWelcomeDialog, - VersionWelcomeDialogProps, -} from './dialogs/version-welcome-dialog'; import { TestViewContribution as TheiaTestViewContribution } from '@theia/test/lib/browser/view/test-view-contribution'; import { TestViewContribution } from './theia/test/test-view-contribution'; @@ -987,11 +983,6 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => { title: 'IDEUpdater', }); - bind(VersionWelcomeDialog).toSelf().inSingletonScope(); - bind(VersionWelcomeDialogProps).toConstantValue({ - title: 'VersionWelcomeDialog', - }); - bind(UserFieldsDialog).toSelf().inSingletonScope(); bind(UserFieldsDialogProps).toConstantValue({ title: 'UserFields', diff --git a/arduino-ide-extension/src/browser/contributions/check-for-ide-updates.ts b/arduino-ide-extension/src/browser/contributions/check-for-ide-updates.ts index a2f76d15f..09087ab96 100644 --- a/arduino-ide-extension/src/browser/contributions/check-for-ide-updates.ts +++ b/arduino-ide-extension/src/browser/contributions/check-for-ide-updates.ts @@ -8,7 +8,6 @@ import { } from '../../common/protocol/ide-updater'; import { IDEUpdaterDialog } from '../dialogs/ide-updater/ide-updater-dialog'; import { Contribution } from './contribution'; -import { VersionWelcomeDialog } from '../dialogs/version-welcome-dialog'; import { AppService } from '../app-service'; import { SemVer } from 'semver'; @@ -20,9 +19,6 @@ export class CheckForIDEUpdates extends Contribution { @inject(IDEUpdaterDialog) private readonly updaterDialog: IDEUpdaterDialog; - @inject(VersionWelcomeDialog) - private readonly versionWelcomeDialog: VersionWelcomeDialog; - @inject(LocalStorageService) private readonly localStorage: LocalStorageService; @@ -59,13 +55,8 @@ export class CheckForIDEUpdates extends Contribution { return this.updater.checkForUpdates(true); }) .then(async (updateInfo) => { - if (!updateInfo) { - const isNewVersion = await this.isNewStableVersion(); - if (isNewVersion) { - this.versionWelcomeDialog.open(); - } - return; - } + if (!updateInfo) return; + const versionToSkip = await this.localStorage.getData( SKIP_IDE_VERSION ); @@ -86,6 +77,11 @@ export class CheckForIDEUpdates extends Contribution { }); } + /** + * This value is set in localStorage but currently not used. + * We keep this logic running anyway for eventual future needs + * (eg. show a new version welcome dialog) + */ private async setCurrentIDEVersion(): Promise { try { const { appVersion } = await this.appService.info(); @@ -95,29 +91,4 @@ export class CheckForIDEUpdates extends Contribution { // ignore invalid versions } } - - /** - * Check if user is running a new IDE version for the first time. - * @returns true if the current IDE version is greater than the last used version - * and both are non-prerelease versions. - */ - private async isNewStableVersion(): Promise { - try { - const { appVersion } = await this.appService.info(); - const prevVersion = await this.localStorage.getData( - LAST_USED_IDE_VERSION - ); - - const prevSemVer = new SemVer(prevVersion ?? ''); - const currSemVer = new SemVer(appVersion ?? ''); - - if (prevSemVer.prerelease.length || currSemVer.prerelease.length) { - return false; - } - - return currSemVer.compare(prevSemVer) === 1; - } catch (e) { - return false; - } - } } diff --git a/arduino-ide-extension/src/browser/dialogs/ide-updater/ide-updater-dialog.tsx b/arduino-ide-extension/src/browser/dialogs/ide-updater/ide-updater-dialog.tsx index 52eebd9c5..54517ce23 100644 --- a/arduino-ide-extension/src/browser/dialogs/ide-updater/ide-updater-dialog.tsx +++ b/arduino-ide-extension/src/browser/dialogs/ide-updater/ide-updater-dialog.tsx @@ -17,7 +17,6 @@ import { } from '../../../common/protocol/ide-updater'; import { LocalStorageService } from '@theia/core/lib/browser'; import { WindowService } from '@theia/core/lib/browser/window/window-service'; -import { sanitize } from 'dompurify'; @injectable() export class IDEUpdaterDialogProps extends DialogProps {} @@ -166,51 +165,6 @@ export class IDEUpdaterDialog extends ReactDialog { goToDownloadPageButton.focus(); } - private appendDonateFooter() { - const footer = document.createElement('div'); - footer.classList.add('ide-updater-dialog--footer'); - const footerContent = document.createElement('div'); - footerContent.classList.add('ide-updater-dialog--footer-content'); - footer.appendChild(footerContent); - - const footerLink = document.createElement('a'); - footerLink.innerText = sanitize( - nls.localize('arduino/ide-updater/donateLinkText', 'donate to support us') - ); - footerLink.classList.add('ide-updater-dialog--footer-link'); - footerLink.onclick = () => - this.openExternal('https://www.arduino.cc/en/donate'); - - const footerLinkIcon = document.createElement('span'); - footerLinkIcon.title = nls.localize( - 'arduino/ide-updater/donateLinkIconTitle', - 'open donation page' - ); - footerLinkIcon.classList.add('ide-updater-dialog--footer-link-icon'); - footerLink.appendChild(footerLinkIcon); - - const placeholderKey = '%%link%%'; - const footerText = sanitize( - nls.localize( - 'arduino/ide-updater/donateText', - 'Open source is love, {0}', - placeholderKey - ) - ); - const placeholder = footerText.indexOf(placeholderKey); - if (placeholder !== -1) { - const parts = footerText.split(placeholderKey); - footerContent.appendChild(document.createTextNode(parts[0])); - footerContent.appendChild(footerLink); - footerContent.appendChild(document.createTextNode(parts[1])); - } else { - footerContent.appendChild(document.createTextNode(footerText)); - footerContent.appendChild(footerLink); - } - - this.controlPanel.insertAdjacentElement('afterend', footer); - } - private openDownloadPage(): void { this.openExternal('https://www.arduino.cc/en/software'); this.close(); @@ -233,7 +187,6 @@ export class IDEUpdaterDialog extends ReactDialog { downloadStarted: true, }); this.clearButtons(); - this.appendDonateFooter(); this.updater.downloadUpdate(); } diff --git a/arduino-ide-extension/src/browser/dialogs/version-welcome-dialog.tsx b/arduino-ide-extension/src/browser/dialogs/version-welcome-dialog.tsx deleted file mode 100644 index 380d980df..000000000 --- a/arduino-ide-extension/src/browser/dialogs/version-welcome-dialog.tsx +++ /dev/null @@ -1,107 +0,0 @@ -import React from '@theia/core/shared/react'; -import { inject, injectable } from '@theia/core/shared/inversify'; -import { Message } from '@theia/core/shared/@phosphor/messaging'; -import { ReactDialog } from '../theia/dialogs/dialogs'; -import { nls } from '@theia/core'; -import { DialogProps } from '@theia/core/lib/browser'; -import { WindowService } from '@theia/core/lib/browser/window/window-service'; -import { AppService } from '../app-service'; -import { sanitize } from 'dompurify'; - -@injectable() -export class VersionWelcomeDialogProps extends DialogProps {} - -@injectable() -export class VersionWelcomeDialog extends ReactDialog { - @inject(AppService) - private readonly appService: AppService; - - @inject(WindowService) - private readonly windowService: WindowService; - - constructor( - @inject(VersionWelcomeDialogProps) - protected override readonly props: VersionWelcomeDialogProps - ) { - super({ - title: nls.localize( - 'arduino/versionWelcome/title', - 'Welcome to a new version of the Arduino IDE!' - ), - }); - this.node.id = 'version-welcome-dialog-container'; - this.contentNode.classList.add('version-welcome-dialog'); - } - - protected render(): React.ReactNode { - return ( -
-

- {nls.localize( - 'arduino/versionWelcome/donateMessage', - 'Arduino is committed to keeping software free and open-source for everyone. Your donation helps us develop new features, improve libraries, and support millions of users worldwide.' - )} -

-

- {nls.localize( - 'arduino/versionWelcome/donateMessage2', - 'Please consider supporting our work on the free open source Arduino IDE.' - )} -

-
- ); - } - - override get value(): void { - return; - } - - private appendButtons(): void { - const cancelButton = this.createButton( - nls.localize('arduino/versionWelcome/cancelButton', 'Maybe later') - ); - cancelButton.classList.add('secondary'); - cancelButton.classList.add('cancel-button'); - this.addAction(cancelButton, this.close.bind(this), 'click'); - this.controlPanel.appendChild(cancelButton); - - const donateButton = this.createButton( - nls.localize('arduino/versionWelcome/donateButton', 'Donate now') - ); - this.addAction(donateButton, this.onDonateButtonClick.bind(this), 'click'); - this.controlPanel.appendChild(donateButton); - donateButton.focus(); - } - - private onDonateButtonClick(): void { - this.openDonationPage(); - this.close(); - } - - private readonly openDonationPage = () => { - const url = 'https://www.arduino.cc/en/donate'; - this.windowService.openNewWindow(url, { external: true }); - }; - - private async updateTitleVersion(): Promise { - const appInfo = await this.appService.info(); - const { appVersion } = appInfo; - - if (appVersion) { - this.titleNode.innerText = sanitize( - nls.localize( - 'arduino/versionWelcome/titleWithVersion', - 'Welcome to the new Arduino IDE {0}!', - appVersion - ) - ); - } - } - - protected override onAfterAttach(msg: Message): void { - this.update(); - this.appendButtons(); - this.updateTitleVersion(); - super.onAfterAttach(msg); - } -} diff --git a/arduino-ide-extension/src/browser/style/ide-updater-dialog.css b/arduino-ide-extension/src/browser/style/ide-updater-dialog.css index 8d722c9d1..5d5592baf 100644 --- a/arduino-ide-extension/src/browser/style/ide-updater-dialog.css +++ b/arduino-ide-extension/src/browser/style/ide-updater-dialog.css @@ -34,37 +34,6 @@ min-width: 0; } -.ide-updater-dialog--footer { - display: inline-block; - margin-top: -16px; - padding: 12px 0 24px 0; - border-top: 1px solid var(--theia-editorWidget-border); -} -.ide-updater-dialog--footer-content { - float: right; -} - -.ide-updater-dialog--footer-link { - display: inline-block; - color: var(--theia-textLink-foreground); - font-weight: 500; - line-height: 13px; -} -.ide-updater-dialog--footer-link:hover { - color: var(--theia-textLink-foreground); - cursor: pointer; -} -.ide-updater-dialog--footer-link-icon { - display: inline-block; - -webkit-mask: url(../icons/link-open-icon.svg) center no-repeat; - background-color: var(--theia-textLink-foreground); - height: 12px; - width: 12px; - cursor: pointer; - transform: translateY(2px); - margin-left: 4px; -} - .ide-updater-dialog .changelog { color: var(--theia-editor-foreground); background-color: var(--theia-editor-background); @@ -140,7 +109,6 @@ max-height: 100%; overflow: hidden; display: flex; - padding-bottom: 20px !important; } #ide-updater-dialog-container .skip-version-button { diff --git a/arduino-ide-extension/src/browser/style/index.css b/arduino-ide-extension/src/browser/style/index.css index 593cf1eaf..fd7887ae1 100644 --- a/arduino-ide-extension/src/browser/style/index.css +++ b/arduino-ide-extension/src/browser/style/index.css @@ -10,7 +10,6 @@ @import "./settings-dialog.css"; @import "./firmware-uploader-dialog.css"; @import "./ide-updater-dialog.css"; -@import "./version-welcome-dialog.css"; @import "./certificate-uploader-dialog.css"; @import "./user-fields-dialog.css"; @import "./debug.css"; diff --git a/arduino-ide-extension/src/browser/style/version-welcome-dialog.css b/arduino-ide-extension/src/browser/style/version-welcome-dialog.css deleted file mode 100644 index 80d6f71e4..000000000 --- a/arduino-ide-extension/src/browser/style/version-welcome-dialog.css +++ /dev/null @@ -1,7 +0,0 @@ -#version-welcome-dialog-container > .dialogBlock { - width: 546px; - - .bold { - font-weight: bold; - } -} diff --git a/i18n/en.json b/i18n/en.json index 5e3d19be2..f6e559cca 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -275,9 +275,6 @@ "checkForUpdates": "Check for Arduino IDE Updates", "closeAndInstallButton": "Close and Install", "closeToInstallNotice": "Close the software and install the update on your machine.", - "donateLinkIconTitle": "open donation page", - "donateLinkText": "donate to support us", - "donateText": "Open source is love, {0}", "downloadButton": "Download", "downloadingNotice": "Downloading the latest version of the Arduino IDE.", "errorCheckingForUpdates": "Error while checking for Arduino IDE updates.\n{0}", @@ -523,14 +520,6 @@ "renameSketchFolderMessage": "The sketch '{0}' cannot be used. {1} To get rid of this message, rename the sketch. Do you want to rename the sketch now?", "renameSketchFolderTitle": "Invalid sketch name" }, - "versionWelcome": { - "cancelButton": "Maybe later", - "donateButton": "Donate now", - "donateMessage": "Arduino is committed to keeping software free and open-source for everyone. Your donation helps us develop new features, improve libraries, and support millions of users worldwide.", - "donateMessage2": "Please consider supporting our work on the free open source Arduino IDE.", - "title": "Welcome to a new version of the Arduino IDE!", - "titleWithVersion": "Welcome to the new Arduino IDE {0}!" - }, "workspace": { "alreadyExists": "'{0}' already exists." } From de1e2f06af1d52979639d006e303cbe78f1ce1d5 Mon Sep 17 00:00:00 2001 From: Giacomo Cusinato <7659518+giacomocusinato@users.noreply.github.com> Date: Wed, 5 Nov 2025 17:40:12 +0100 Subject: [PATCH 2/2] chore: remove unused dompurify package --- arduino-ide-extension/package.json | 1 - yarn.lock | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/arduino-ide-extension/package.json b/arduino-ide-extension/package.json index ff9a09eff..f24437031 100644 --- a/arduino-ide-extension/package.json +++ b/arduino-ide-extension/package.json @@ -67,7 +67,6 @@ "cross-fetch": "^3.1.5", "dateformat": "^3.0.3", "deepmerge": "^4.2.2", - "dompurify": "^2.4.7", "drivelist": "^9.2.4", "electron-updater": "^4.6.5", "fast-deep-equal": "^3.1.3", diff --git a/yarn.lock b/yarn.lock index 87c12c1f0..ff680ad33 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5912,7 +5912,7 @@ domexception@^4.0.0: dependencies: webidl-conversions "^7.0.0" -dompurify@^2.2.9, dompurify@^2.4.7: +dompurify@^2.2.9: version "2.5.8" resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-2.5.8.tgz#2809d89d7e528dc7a071dea440d7376df676f824" integrity sha512-o1vSNgrmYMQObbSSvF/1brBYEQPHhV1+gsmrusO7/GXtp1T9rCS8cXFqVxK/9crT1jA6Ccv+5MTSjBNqr7Sovw==