MCPcopy Index your code
hub / github.com/massCodeIO/massCode / checkForUpdates

Function checkForUpdates

src/main/updates/index.ts:103–139  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

101}
102
103export function checkForUpdates() {
104 if (!app.isPackaged) {
105 return
106 }
107
108 autoUpdater.autoDownload = false
109 autoUpdater.autoInstallOnAppQuit = true
110 autoUpdater.logger = null
111
112 autoUpdater.on('update-available', (info) => {
113 const isAutoUpdateEnabled = store.preferences.get('updates.autoUpdate')
114 const isSameMajor = getMajorVersion(info.version) === currentMajorVersion
115
116 if (!isAutoUpdateEnabled || !isSameMajor) {
117 notifyAboutUpdate(info.version)
118 return
119 }
120
121 autoUpdater.downloadUpdate().catch((error) => {
122 log('Error downloading update', error)
123 })
124 })
125
126 autoUpdater.on('update-downloaded', (info) => {
127 send('system:update-downloaded', { version: info.version })
128 })
129
130 autoUpdater.on('error', (error) => {
131 log('Auto-update error', error)
132 })
133
134 void runUpdateCheck()
135
136 setInterval(() => {
137 void runUpdateCheck()
138 }, INTERVAL)
139}

Callers 1

index.tsFile · 0.90

Calls 6

logFunction · 0.90
sendFunction · 0.90
getMajorVersionFunction · 0.85
notifyAboutUpdateFunction · 0.85
runUpdateCheckFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected