Skip to content

Commit

Permalink
CU-86a63drvf - NEON3 - Investigate why auto update keeps downloading …
Browse files Browse the repository at this point in the history
…forever
  • Loading branch information
dustr94 committed Jan 6, 2025
1 parent 2f5165c commit fb39994
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 9 deletions.
6 changes: 3 additions & 3 deletions electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ asarUnpack:
- resources/**
win:
artifactName: NeonWallet-${version}-win.${ext}
publisherName:
- 'COZ, Inc.'
target:
- target: nsis
arch:
- x64
sign: "./customSign.js"
sign: './customSign.js'
nsis:
shortcutName: ${productName}
uninstallDisplayName: ${productName}
Expand Down Expand Up @@ -54,5 +56,3 @@ publish:
provider: github
owner: CityOfZion
repo: neon-wallet-desktop
private: true
token: ${env.GH_TOKEN}
9 changes: 5 additions & 4 deletions src/main/updater.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { mainApi } from '@shared/api/main'
import { BrowserWindow } from 'electron'
import { autoUpdater } from 'electron-updater'

export function registerUpdaterHandler() {
autoUpdater.on('update-downloaded', () => {
const browserWindow = BrowserWindow.getAllWindows()[0]
if (!browserWindow) return
browserWindow.webContents.send('updateCompleted')
mainApi.send('updateCompleted')
})

autoUpdater.on('error', error => {
mainApi.send('updateError', error.message)
})

mainApi.listenAsync('checkForUpdates', async () => {
Expand Down
7 changes: 7 additions & 0 deletions src/renderer/src/hooks/useBeforeLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,19 @@ const useOverTheAirUpdate = () => {
window.api.sendAsync('quitAndInstall')
})

const removeUpdateErrorListener = window.api.listen('updateError', error => {
ToastHelper.dismiss('auto-update-downloading')
ToastHelper.error({ message: t('error'), duration: 5000 })
console.error(error)
})

window.api.sendAsync('checkForUpdates').then(hasUpdates => {
if (!hasUpdates) return
ToastHelper.loading({ message: t('downloading'), id: 'auto-update-downloading' })
})

return () => {
removeUpdateErrorListener()
removeUpdateCompletedListener()
}
}, [dispatch, t])
Expand Down
5 changes: 3 additions & 2 deletions src/renderer/src/locales/en/hooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
},
"useOverTheAirUpdate": {
"downloading": "New version found. Downloading...",
"downloaded": "New version downloaded. The app will restart to apply update."
"downloaded": "New version downloaded. The app will restart to apply update.",
"error": "Error downloading update. Please try again later restarting the app."
},
"useNeonBackup": {
"errors": {
Expand All @@ -43,4 +44,4 @@
"importData": "There was an error importing the data (It might imported partially)."
}
}
}
}
1 change: 1 addition & 0 deletions src/shared/@types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export type TMainApiSend = {
getStoreFromWC: TSession
hardwareWalletDisconnected: THardwareWalletInfo
updateCompleted: undefined
updateError: string
deeplink: string
getHardwareWalletSignatureStart: undefined
getHardwareWalletSignatureEnd: undefined
Expand Down
1 change: 1 addition & 0 deletions src/shared/@types/i18next-resources.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ interface Resources {
useOverTheAirUpdate: {
downloading: 'New version found. Downloading...'
downloaded: 'New version downloaded. The app will restart to apply update.'
error: 'Error downloading update. Please try again later restarting the app.'
}
useNeonBackup: {
errors: {
Expand Down

0 comments on commit fb39994

Please sign in to comment.