@todesktop/runtime
Advanced tools
Comparing version 1.6.3-10 to 1.6.3-11
@@ -15,3 +15,2 @@ import type { AllPublishOptions, PublishConfiguration } from "builder-util-runtime"; | ||
private readonly _createdAt; | ||
private _hasAppFinishedLaunching; | ||
private _hasUpdateReadyToInstall; | ||
@@ -24,2 +23,4 @@ private _isActive; | ||
private _updaterAgent?; | ||
private readonly _whenInitialized; | ||
private _whenInitializedResolve; | ||
constructor({ autoCheckInterval, // 10 min | ||
@@ -26,0 +27,0 @@ logger, shouldAutoCheckOnLaunch, }: AutoUpdaterConstructorOptions); |
@@ -16,2 +16,3 @@ "use strict"; | ||
const path = require("path"); | ||
const alwaysResolve_1 = require("../alwaysResolve"); | ||
const getConfig_1 = require("../getConfig"); | ||
@@ -29,9 +30,12 @@ const setTimeout_1 = require("../setTimeout"); | ||
this._createdAt = Date.now(); | ||
this._hasAppFinishedLaunching = false; | ||
this._hasUpdateReadyToInstall = false; | ||
this._isActive = true; | ||
this._pendingCheckSources = []; | ||
this._whenInitializedResolve = () => { }; | ||
this._autoCheckInterval = autoCheckInterval; | ||
this._logger = logger; | ||
this._shouldAutoCheckOnLaunch = shouldAutoCheckOnLaunch; | ||
this._whenInitialized = new Promise((resolve) => { | ||
this._whenInitializedResolve = resolve; | ||
}); | ||
this._subscribeToElectronEvents(); | ||
@@ -42,2 +46,3 @@ } | ||
return __awaiter(this, arguments, void 0, function* ({ getReleaseStatusFn = getReleaseStatus_1.default, } = {}) { | ||
const logger = this._logger; | ||
let inactiveReason = ""; | ||
@@ -50,5 +55,10 @@ if (!electron.app.isPackaged) { | ||
} | ||
yield this._appFinishedLaunchingPromise; | ||
// Maybe it's better to wait for app#ready event, but now nobody knows | ||
// why #will-finish-launching is used instead | ||
yield (0, alwaysResolve_1.default)(this._appFinishedLaunchingPromise, { logger }); | ||
if (inactiveReason === "") { | ||
const { isReleased } = yield getReleaseStatusFn(this._logger); | ||
const { isReleased } = yield (0, alwaysResolve_1.default)(getReleaseStatusFn(logger), { | ||
logger, | ||
defaultResult: { isReleased: true }, | ||
}); | ||
if (!isReleased) { | ||
@@ -63,2 +73,3 @@ inactiveReason = "the build isn't released"; | ||
this._log("info", message); | ||
this._whenInitializedResolve(); | ||
return; | ||
@@ -71,4 +82,5 @@ } | ||
if (this._shouldAutoCheckOnLaunch) { | ||
this._autoCheckOnLaunch().catch((e) => this._logger.error(e)); | ||
this._autoCheckOnLaunch().catch((e) => logger.error(e)); | ||
} | ||
this._whenInitializedResolve(); | ||
}); | ||
@@ -79,7 +91,3 @@ } | ||
this._log("info", ".checkForUpdates called"); | ||
if (!this._hasAppFinishedLaunching) { | ||
const error = new Error("Cannot checkForUpdates before app is ready (see https://www.electronjs.org/docs/api/app#event-ready)"); | ||
this._log("error", error); | ||
throw error; | ||
} | ||
yield (0, alwaysResolve_1.default)(this._whenInitialized); | ||
if (!this._isActive) { | ||
@@ -294,3 +302,2 @@ return { | ||
electron.app.on("will-finish-launching", () => { | ||
this._hasAppFinishedLaunching = true; | ||
this._log("debug", "electron will-finish-launching event emitted", { | ||
@@ -297,0 +304,0 @@ appVersion: electron.app.getVersion(), |
@@ -1,1 +0,1 @@ | ||
export declare const CLIENT_VERSION = "1.6.3-10"; | ||
export declare const CLIENT_VERSION = "1.6.3-11"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CLIENT_VERSION = void 0; | ||
exports.CLIENT_VERSION = "1.6.3-10"; | ||
exports.CLIENT_VERSION = "1.6.3-11"; |
@@ -7,3 +7,3 @@ { | ||
"name": "@todesktop/runtime", | ||
"version": "1.6.3-10", | ||
"version": "1.6.3-11", | ||
"license": "MIT", | ||
@@ -10,0 +10,0 @@ "author": "ToDesktop <hi@todesktop.com> (https://www.todesktop.com/)", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
103311
41
1743