Skip to content

Commit e0eea5a

Browse files
authored
[Fix] Update for non token gated games (#889)
* fix update for non token gated games * rm unused code in cancel download * rm log * fix library refresh * add comment * fix lint * rm hp achievements submodule
1 parent f1b4cee commit e0eea5a

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

src/backend/downloadmanager/downloadqueue.ts

+5-18
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { gameManagerMap, libraryManagerMap } from 'backend/storeManagers'
22
import { TypeCheckedStoreBackend } from './../electron_store'
33
import { logError, logInfo, LogPrefix, logWarning } from '../logger/logger'
4-
import { getFileSize, removeFolder } from '../utils'
4+
import { getFileSize } from '../utils'
55
import { DMQueueElement, DMStatus, DownloadManagerState } from 'common/types'
66
import { installQueueElement, updateQueueElement } from './utils'
77
import { sendFrontendMessage } from '../main_window'
@@ -221,23 +221,10 @@ function cancelCurrentDownload({ removeDownloaded = false }) {
221221

222222
const { runner } = currentElement!.params
223223
if (runner === 'hyperplay' && removeDownloaded) {
224-
const { appName, gameInfo, channelName } = currentElement!.params
225-
const { folder_name } = gameInfo
226-
if (gameInfo.channels === undefined || channelName === undefined) {
227-
console.error(
228-
`Error when canceling current download channels ${gameInfo.channels} or channelName ${channelName} is undefined`
229-
)
230-
return
231-
}
232-
const releaseMeta = gameInfo.channels[channelName].release_meta
233-
234-
if (releaseMeta) {
235-
const tempfolder = join(configFolder, 'hyperplay', '.temp', appName)
236-
logInfo(`Removing ${tempfolder}...`, LogPrefix.DownloadManager)
237-
callAbortController(appName)
238-
} else if (folder_name) {
239-
removeFolder(currentElement.params.path, folder_name)
240-
}
224+
const { appName } = currentElement!.params
225+
const tempfolder = join(configFolder, 'hyperplay', '.temp', appName)
226+
logInfo(`Removing ${tempfolder}...`, LogPrefix.DownloadManager)
227+
callAbortController(appName)
241228
}
242229
currentElement = null
243230
}

src/frontend/helpers/library.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,13 @@ const launch = async ({
267267
}
268268

269269
const updateGame = async (gameInfo: GameInfo) => {
270-
const siweValues = await signSiweMessage()
270+
const channelRequiresTokens =
271+
gameInfo?.channels?.[gameInfo.install.channelName ?? ''].license_config
272+
.tokens
273+
let siweValues = undefined
274+
if (channelRequiresTokens) {
275+
siweValues = await signSiweMessage()
276+
}
271277
return gameUpdateState.updateGame({ ...gameInfo, siweValues })
272278
}
273279

src/frontend/state/libraryState.ts

+5
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ class LibraryState {
114114
async refresh(library?: Runner | 'all', checkUpdates = true): Promise<void> {
115115
if (checkUpdates) {
116116
const hpUpdates = await window.api.checkGameUpdates(['hyperplay'])
117+
/**
118+
* Need to clear the gameUpdates array on refresh or updated games will still show
119+
* as needing update after updating and entries will be added multiple times to the array
120+
*/
121+
this.gameUpdates = []
117122
this.gameUpdates = [...this.gameUpdates, ...hpUpdates]
118123
window.api
119124
.checkGameUpdates(['legendary', 'gog', 'nile'])

0 commit comments

Comments
 (0)