diff --git a/arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx b/arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx
index f4ebbb2f6..af90e2035 100644
--- a/arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx
+++ b/arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx
@@ -280,7 +280,8 @@ export class ArduinoFrontendContribution
}
this.updaterService.init(
- this.arduinoPreferences.get('arduino.ide.updateChannel')
+ this.arduinoPreferences.get('arduino.ide.updateChannel'),
+ this.arduinoPreferences.get('arduino.ide.updateBaseUrl')
);
this.updater.checkForUpdates(true).then(async (updateInfo) => {
if (!updateInfo) return;
diff --git a/arduino-ide-extension/src/browser/arduino-preferences.ts b/arduino-ide-extension/src/browser/arduino-preferences.ts
index 910d724bc..ba6bc83c4 100644
--- a/arduino-ide-extension/src/browser/arduino-preferences.ts
+++ b/arduino-ide-extension/src/browser/arduino-preferences.ts
@@ -78,6 +78,14 @@ export const ArduinoConfigSchema: PreferenceSchema = {
"Release channel to get updated from. 'stable' is the stable release, 'nightly' is the latest development build."
),
},
+ 'arduino.ide.updateBaseUrl': {
+ type: 'string',
+ default: 'https://downloads.arduino.cc/arduino-ide',
+ description: nls.localize(
+ 'arduino/preferences/ide.updateBaseUrl',
+ `The base URL where to download updates from. Defaults to 'https://downloads.arduino.cc/arduino-ide'`
+ ),
+ },
'arduino.board.certificates': {
type: 'string',
description: nls.localize(
@@ -178,6 +186,7 @@ export interface ArduinoConfiguration {
'arduino.window.autoScale': boolean;
'arduino.window.zoomLevel': number;
'arduino.ide.updateChannel': UpdateChannel;
+ 'arduino.ide.updateBaseUrl': string;
'arduino.board.certificates': string;
'arduino.sketchbook.showAllFiles': boolean;
'arduino.cloud.enabled': boolean;
diff --git a/arduino-ide-extension/src/browser/dialogs/ide-updater/ide-updater-component.tsx b/arduino-ide-extension/src/browser/dialogs/ide-updater/ide-updater-component.tsx
index 3c1c4911e..0d2fa3a49 100644
--- a/arduino-ide-extension/src/browser/dialogs/ide-updater/ide-updater-component.tsx
+++ b/arduino-ide-extension/src/browser/dialogs/ide-updater/ide-updater-component.tsx
@@ -1,3 +1,4 @@
+import { WindowService } from '@theia/core/lib/browser/window/window-service';
import { nls } from '@theia/core/lib/common';
import { shell } from 'electron';
import * as React from 'react';
@@ -8,6 +9,7 @@ import ProgressBar from '../../components/ProgressBar';
export type IDEUpdaterComponentProps = {
updateInfo: UpdateInfo;
+ windowService: WindowService;
downloadFinished?: boolean;
downloadStarted?: boolean;
progress?: ProgressInfo;
@@ -22,6 +24,7 @@ export const IDEUpdaterComponent = ({
updateInfo: { version, releaseNotes },
downloadStarted = false,
downloadFinished = false,
+ windowService,
progress,
error,
onDownload,
@@ -62,98 +65,147 @@ export const IDEUpdaterComponent = ({
);
- return (
-
- {downloadFinished ? (
-
-
- {nls.localize(
- 'arduino/ide-updater/versionDownloaded',
- 'Arduino IDE {0} has been downloaded.',
- version
- )}
-
-
+ const DownloadCompleted: () => React.ReactElement = () => (
+
+
+ {nls.localize(
+ 'arduino/ide-updater/versionDownloaded',
+ 'Arduino IDE {0} has been downloaded.',
+ version
+ )}
+
+
+ {nls.localize(
+ 'arduino/ide-updater/closeToInstallNotice',
+ 'Close the software and install the update on your machine.'
+ )}
+
+
+ {closeButton}
+
+ {nls.localize(
+ 'arduino/ide-updater/closeAndInstallButton',
+ 'Close and Install'
+ )}
+
+
+
+ );
+
+ const DownloadStarted: () => React.ReactElement = () => (
+
+
+ {nls.localize(
+ 'arduino/ide-updater/downloadingNotice',
+ 'Downloading the latest version of the Arduino IDE.'
+ )}
+
+
+
+ );
+
+ const PreDownload: () => React.ReactElement = () => (
+
+
+
+
+
{nls.localize(
- 'arduino/ide-updater/closeToInstallNotice',
- 'Close the software and install the update on your machine.'
+ 'arduino/ide-updater/updateAvailable',
+ 'Update Available'
)}
-
- {closeButton}
-
- {nls.localize(
- 'arduino/ide-updater/closeAndInstallButton',
- 'Close and Install'
- )}
-
-
- ) : downloadStarted ? (
-
-
- {nls.localize(
- 'arduino/ide-updater/downloadingNotice',
- 'Downloading the latest version of the Arduino IDE.'
- )}
-
-
+
+ {nls.localize(
+ 'arduino/ide-updater/newVersionAvailable',
+ 'A new version of Arduino IDE ({0}) is available for download.',
+ version
+ )}
- ) : (
-
-
-
+ {releaseNotes && (
+
-
-
-
- {nls.localize(
- 'arduino/ide-updater/updateAvailable',
- 'Update Available'
- )}
-
-
-
- {nls.localize(
- 'arduino/ide-updater/newVersionAvailable',
- 'A new version of Arduino IDE ({0}) is available for download.',
- version
- )}
-
- {releaseNotes && (
-
+ )}
+
+
+ {nls.localize(
+ 'arduino/ide-updater/skipVersionButton',
+ 'Skip Version'
)}
-
-
- {nls.localize(
- 'arduino/ide-updater/skipVersionButton',
- 'Skip Version'
- )}
-
-
- {closeButton}
-
- {nls.localize('arduino/ide-updater/downloadButton', 'Download')}
-
-
-
+
+
+ {closeButton}
+
+ {nls.localize('arduino/ide-updater/downloadButton', 'Download')}
+
+
+
+ );
+
+ const onGoToDownloadClick = (
+ event: React.SyntheticEvent
+ ) => {
+ const { target } = event.nativeEvent;
+ if (target instanceof HTMLAnchorElement) {
+ event.nativeEvent.preventDefault();
+ windowService.openNewWindow(target.href, { external: true });
+ onClose();
+ }
+ };
+
+ const GoToDownloadPage: () => React.ReactElement = () => (
+
+
+ {nls.localize(
+ 'arduino/ide-updater/goToDownloadPage',
+ "An update for the Arduino IDE is available, but we're not able to download and install it automatically. Please go to the download page and download the latest version from there."
+ )}
+
+
+
+ );
+
+ return (
+
+ {!!error ? (
+
+ ) : downloadFinished ? (
+
+ ) : downloadStarted ? (
+
+ ) : (
+
)}
- {!!error &&
{error}
}
+ {/* {!!error &&
{error}
} */}
);
};
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 56b8c84f5..dbba6df96 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
@@ -15,6 +15,7 @@ import {
} from '../../../common/protocol/ide-updater';
import { LocalStorageService } from '@theia/core/lib/browser';
import { SKIP_IDE_VERSION } from '../../arduino-frontend-contribution';
+import { WindowService } from '@theia/core/lib/browser/window/window-service';
@injectable()
export class IDEUpdaterDialogWidget extends ReactWidget {
@@ -35,6 +36,9 @@ export class IDEUpdaterDialogWidget extends ReactWidget {
@inject(LocalStorageService)
protected readonly localStorageService: LocalStorageService;
+ @inject(WindowService)
+ protected windowService: WindowService;
+
init(updateInfo: UpdateInfo, onClose: () => void): void {
this.updateInfo = updateInfo;
this.progressInfo = undefined;
@@ -92,9 +96,11 @@ export class IDEUpdaterDialogWidget extends ReactWidget {