-
Notifications
You must be signed in to change notification settings - Fork 138
feat: support not to auto check update & manual check update #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
443ba1d
6248aa1
90977b0
0bf8f7c
7019793
29231e2
83bd1ec
ad1f79c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -95,6 +95,11 @@ export interface IUpdateElectronAppOptions<L = ILogger> { | |||||||
* Minimum allowed interval is `5 minutes`. | ||||||||
*/ | ||||||||
readonly updateInterval?: string; | ||||||||
/** | ||||||||
* @param {Boolean} autoCheck Decides whether to automatically check for updates | ||||||||
* Defaults to `true`. | ||||||||
*/ | ||||||||
readonly autoCheck?: boolean; | ||||||||
/** | ||||||||
* @param {Object} logger A custom logger object that defines a `log` function. | ||||||||
* Defaults to `console`. See electron-log, a module | ||||||||
|
@@ -152,7 +157,7 @@ export function updateElectronApp(opts: IUpdateElectronAppOptions = {}) { | |||||||
} | ||||||||
|
||||||||
function initUpdater(opts: ReturnType<typeof validateInput>) { | ||||||||
const { updateSource, updateInterval, logger } = opts; | ||||||||
const { updateSource, updateInterval, autoCheck, logger } = opts; | ||||||||
|
||||||||
// exit early on unsupported platforms, e.g. `linux` | ||||||||
if (!supportedPlatforms.includes(process?.platform)) { | ||||||||
|
@@ -241,11 +246,13 @@ function initUpdater(opts: ReturnType<typeof validateInput>) { | |||||||
); | ||||||||
} | ||||||||
|
||||||||
// check for updates right away and keep checking later | ||||||||
autoUpdater.checkForUpdates(); | ||||||||
setInterval(() => { | ||||||||
if (autoCheck) { | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I wonder if we want to be stricter about actually passing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. update-electron-app/src/index.ts Line 216 in c5f1d43
I follow this, so I didn't do strict equal |
||||||||
// check for updates right away and keep checking later | ||||||||
autoUpdater.checkForUpdates(); | ||||||||
}, ms(updateInterval)); | ||||||||
setInterval(() => { | ||||||||
autoUpdater.checkForUpdates(); | ||||||||
}, ms(updateInterval)); | ||||||||
} | ||||||||
} | ||||||||
|
||||||||
/** | ||||||||
|
@@ -296,11 +303,12 @@ function validateInput(opts: IUpdateElectronAppOptions) { | |||||||
const defaults = { | ||||||||
host: 'https://update.electronjs.org', | ||||||||
updateInterval: '10 minutes', | ||||||||
autoCheck: true, | ||||||||
logger: console, | ||||||||
notifyUser: true, | ||||||||
}; | ||||||||
|
||||||||
const { host, updateInterval, logger, notifyUser, onNotifyUser } = Object.assign( | ||||||||
const { host, updateInterval, autoCheck, logger, notifyUser, onNotifyUser } = Object.assign( | ||||||||
{}, | ||||||||
defaults, | ||||||||
opts, | ||||||||
|
@@ -348,5 +356,5 @@ function validateInput(opts: IUpdateElectronAppOptions) { | |||||||
|
||||||||
assert(logger && typeof logger.log, 'function'); | ||||||||
|
||||||||
return { updateSource, updateInterval, logger, notifyUser, onNotifyUser }; | ||||||||
return { updateSource, updateInterval, autoCheck, logger, notifyUser, onNotifyUser }; | ||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other comments
update-electron-app/src/index.ts
Lines 98 to 107 in c5f1d43
those writing style uses indentation
so I do that too
which one should I follow