Skip to content

Commit

Permalink
feat: add isUpdateAvailable property to checkForUpdates result (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian authored Feb 3, 2025
1 parent 44603f2 commit 14ee2d6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-trains-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"electron-updater": minor
---

feat: add `isUpdateAvailable` property to `checkForUpdates` result
3 changes: 3 additions & 0 deletions packages/electron-updater/src/AppUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter

/**
* Asks the server whether there is an update.
* @returns null if the updater is disabled, otherwise info about the latest version
*/
checkForUpdates(): Promise<UpdateCheckResult | null> {
if (!this.isUpdaterActive()) {
Expand Down Expand Up @@ -461,6 +462,7 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter
)
this.emit("update-not-available", updateInfo)
return {
isUpdateAvailable: false,
versionInfo: updateInfo,
updateInfo,
}
Expand All @@ -472,6 +474,7 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter
const cancellationToken = new CancellationToken()
//noinspection ES6MissingAwait
return {
isUpdateAvailable: true,
versionInfo: updateInfo,
updateInfo,
cancellationToken,
Expand Down
2 changes: 2 additions & 0 deletions packages/electron-updater/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ export interface ResolvedUpdateFileInfo {
}

export interface UpdateCheckResult {
readonly isUpdateAvailable: boolean

Check warning on line 81 in packages/electron-updater/src/main.ts

View workflow job for this annotation

GitHub Actions / test-linux (ArtifactPublisherTest,BuildTest,ExtraBuildTest,RepoSlugTest,binDownloadTest,configura...

Delete `··`

Check warning on line 81 in packages/electron-updater/src/main.ts

View workflow job for this annotation

GitHub Actions / test-linux (snapTest,debTest,fpmTest,protonTest)

Delete `··`

Check warning on line 81 in packages/electron-updater/src/main.ts

View workflow job for this annotation

GitHub Actions / test-linux (winPackagerTest,BuildTest,winCodeSignTest,webInstallerTest)

Delete `··`

Check warning on line 81 in packages/electron-updater/src/main.ts

View workflow job for this annotation

GitHub Actions / test-linux (oneClickInstallerTest,assistedInstallerTest)

Delete `··`
readonly updateInfo: UpdateInfo

readonly downloadPromise?: Promise<Array<string>> | null
Expand Down

0 comments on commit 14ee2d6

Please sign in to comment.