8
8
InstalledInfo ,
9
9
LibraryTopSectionOptions ,
10
10
RefreshOptions ,
11
+ Runner ,
11
12
WineVersionInfo
12
13
} from 'src/types'
13
14
import { TFunction , withTranslation } from 'react-i18next'
@@ -232,12 +233,13 @@ export class GlobalState extends PureComponent<Props> {
232
233
this . setState ( { libraryTopSection : value } )
233
234
}
234
235
235
- handleSuccessfulLogin = ( runner : 'epic' | 'gog' ) => {
236
+ handleSuccessfulLogin = ( runner : Runner ) => {
236
237
this . handleFilter ( 'all' )
237
238
this . handleCategory ( runner )
238
239
this . refreshLibrary ( {
239
240
fullRefresh : true ,
240
- runInBackground : false
241
+ runInBackground : false ,
242
+ library : runner
241
243
} )
242
244
}
243
245
@@ -253,7 +255,7 @@ export class GlobalState extends PureComponent<Props> {
253
255
}
254
256
} )
255
257
256
- this . handleSuccessfulLogin ( 'epic' )
258
+ this . handleSuccessfulLogin ( 'legendery' as Runner )
257
259
}
258
260
259
261
return response . status
@@ -289,7 +291,7 @@ export class GlobalState extends PureComponent<Props> {
289
291
window . location . reload ( )
290
292
}
291
293
292
- refresh = async ( checkUpdates ?: boolean ) : Promise < void > => {
294
+ refresh = async ( library ?: Runner , checkUpdates ?: boolean ) : Promise < void > => {
293
295
console . log ( 'refreshing' )
294
296
295
297
let updates = this . state . gameUpdates
@@ -309,7 +311,7 @@ export class GlobalState extends PureComponent<Props> {
309
311
310
312
try {
311
313
updates = checkUpdates
312
- ? await ipcRenderer . invoke ( 'checkGameUpdates' )
314
+ ? await ipcRenderer . invoke ( 'checkGameUpdates' , library )
313
315
: this . state . gameUpdates
314
316
} catch ( error ) {
315
317
ipcRenderer . send ( 'logError' , error )
@@ -338,7 +340,8 @@ export class GlobalState extends PureComponent<Props> {
338
340
refreshLibrary = async ( {
339
341
checkForUpdates,
340
342
fullRefresh,
341
- runInBackground = true
343
+ runInBackground = true ,
344
+ library = undefined
342
345
} : RefreshOptions ) : Promise < void > => {
343
346
if ( this . state . refreshing ) return
344
347
@@ -348,11 +351,11 @@ export class GlobalState extends PureComponent<Props> {
348
351
} )
349
352
ipcRenderer . send ( 'logInfo' , 'Refreshing Library' )
350
353
try {
351
- await ipcRenderer . invoke ( 'refreshLibrary' , fullRefresh )
354
+ await ipcRenderer . invoke ( 'refreshLibrary' , fullRefresh , library )
352
355
} catch ( error ) {
353
356
ipcRenderer . send ( 'logError' , error )
354
357
}
355
- this . refresh ( checkForUpdates )
358
+ this . refresh ( library , checkForUpdates )
356
359
}
357
360
358
361
refreshWineVersionInfo = async ( fetch : boolean ) : Promise < void > => {
@@ -407,7 +410,8 @@ export class GlobalState extends PureComponent<Props> {
407
410
appName,
408
411
status,
409
412
folder,
410
- progress
413
+ progress,
414
+ runner
411
415
} : GameStatus ) => {
412
416
const { libraryStatus, gameUpdates } = this . state
413
417
const currentApp = libraryStatus . filter (
@@ -440,7 +444,8 @@ export class GlobalState extends PureComponent<Props> {
440
444
// This avoids calling legendary again before the previous process is killed when canceling
441
445
this . refreshLibrary ( {
442
446
checkForUpdates : true ,
443
- runInBackground : true
447
+ runInBackground : true ,
448
+ library : runner
444
449
} )
445
450
446
451
storage . setItem (
@@ -454,7 +459,7 @@ export class GlobalState extends PureComponent<Props> {
454
459
} )
455
460
}
456
461
457
- this . refreshLibrary ( { runInBackground : true } )
462
+ this . refreshLibrary ( { runInBackground : true , library : runner } )
458
463
this . setState ( { libraryStatus : newLibraryStatus } )
459
464
}
460
465
}
0 commit comments