forked from arduino/arduino-ide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented filter and update all for libs/boards.
Closes arduino#177 Closes arduino#1188 Signed-off-by: Akos Kitta <[email protected]>
- Loading branch information
Akos Kitta
committed
Aug 30, 2022
1 parent
34a7fdb
commit 7bdfff0
Showing
37 changed files
with
1,689 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 8 additions & 2 deletions
10
arduino-ide-extension/src/browser/boards/boards-widget-frontend-contribution.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
arduino-ide-extension/src/browser/contributions/check-for-ide-updates.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { nls } from '@theia/core/lib/common/nls'; | ||
import { LocalStorageService } from '@theia/core/lib/browser/storage-service'; | ||
import { inject, injectable } from '@theia/core/shared/inversify'; | ||
import { | ||
IDEUpdater, | ||
SKIP_IDE_VERSION, | ||
} from '../../common/protocol/ide-updater'; | ||
import { IDEUpdaterDialog } from '../dialogs/ide-updater/ide-updater-dialog'; | ||
import { Contribution } from './contribution'; | ||
|
||
@injectable() | ||
export class CheckForIDEUpdates extends Contribution { | ||
@inject(IDEUpdater) | ||
private readonly updater: IDEUpdater; | ||
|
||
@inject(IDEUpdaterDialog) | ||
private readonly updaterDialog: IDEUpdaterDialog; | ||
|
||
@inject(LocalStorageService) | ||
private readonly localStorage: LocalStorageService; | ||
|
||
override onStart(): void { | ||
this.preferences.onPreferenceChanged( | ||
({ preferenceName, newValue, oldValue }) => { | ||
if (newValue !== oldValue) { | ||
switch (preferenceName) { | ||
case 'arduino.ide.updateChannel': | ||
case 'arduino.ide.updateBaseUrl': | ||
this.updater.init( | ||
this.preferences.get('arduino.ide.updateChannel'), | ||
this.preferences.get('arduino.ide.updateBaseUrl') | ||
); | ||
} | ||
} | ||
} | ||
); | ||
} | ||
|
||
override onReady(): void { | ||
const checkForUpdates = this.preferences['arduino.checkForUpdates']; | ||
if (!checkForUpdates) { | ||
return; | ||
} | ||
this.updater | ||
.init( | ||
this.preferences.get('arduino.ide.updateChannel'), | ||
this.preferences.get('arduino.ide.updateBaseUrl') | ||
) | ||
.then(() => this.updater.checkForUpdates(true)) | ||
.then(async (updateInfo) => { | ||
if (!updateInfo) return; | ||
const versionToSkip = await this.localStorage.getData<string>( | ||
SKIP_IDE_VERSION | ||
); | ||
if (versionToSkip === updateInfo.version) return; | ||
this.updaterDialog.open(updateInfo); | ||
}) | ||
.catch((e) => { | ||
this.messageService.error( | ||
nls.localize( | ||
'arduino/ide-updater/errorCheckingForUpdates', | ||
'Error while checking for Arduino IDE updates.\n{0}', | ||
e.message | ||
) | ||
); | ||
}); | ||
} | ||
} |
Oops, something went wrong.