@@ -18,6 +18,7 @@ import {
18
18
libraryStore ,
19
19
sideloadLibrary ,
20
20
hyperPlayLibraryStore ,
21
+ steamLibraryStore ,
21
22
configStore
22
23
} from 'frontend/helpers/electronStores'
23
24
import {
@@ -54,6 +55,7 @@ class LibraryState {
54
55
gogLibrary : GameInfo [ ] = [ ]
55
56
sideloadedLibrary : GameInfo [ ] = [ ]
56
57
hyperPlayLibrary : GameInfo [ ] = [ ]
58
+ steamLibrary : GameInfo [ ] = [ ]
57
59
nonAvailableGames : GameInfo [ ] = [ ]
58
60
// array of appName's for games that need updating
59
61
gameUpdates : string [ ] = [ ]
@@ -108,6 +110,8 @@ class LibraryState {
108
110
this . sideloadedLibrary = newLibrary
109
111
} else if ( runner === 'hyperplay' ) {
110
112
this . hyperPlayLibrary = newLibrary
113
+ } else if ( runner === 'steam' ) {
114
+ this . steamLibrary = newLibrary
111
115
}
112
116
} )
113
117
}
@@ -153,6 +157,13 @@ class LibraryState {
153
157
this . refreshGogLibrary ( )
154
158
}
155
159
160
+ this . refreshSteamLibrary ( )
161
+ if ( ! this . steamLibrary . length || ! this . steamLibrary . length ) {
162
+ window . api . logInfo ( 'No cache found, getting data from steam...' )
163
+ await window . api . refreshLibrary ( 'steam' )
164
+ this . refreshSteamLibrary ( )
165
+ }
166
+
156
167
this . refreshSideloadedLibrary ( )
157
168
158
169
this . hiddenGames . list = configStore . get ( 'games.hidden' , [ ] )
@@ -197,6 +208,7 @@ class LibraryState {
197
208
this . refreshGogLibrary ( )
198
209
this . refreshSideloadedLibrary ( )
199
210
this . refreshHyperplayLibrary ( )
211
+ this . refreshSteamLibrary ( )
200
212
}
201
213
202
214
refreshEpicLibrary ( ) {
@@ -219,6 +231,10 @@ class LibraryState {
219
231
this . gogLibrary = games
220
232
}
221
233
234
+ refreshSteamLibrary ( ) {
235
+ this . steamLibrary = steamLibraryStore . get ( 'games' , [ ] )
236
+ }
237
+
222
238
refreshHyperplayLibrary ( ) {
223
239
this . hyperPlayLibrary = hyperPlayLibraryStore . get ( 'games' , [ ] )
224
240
}
@@ -314,6 +330,9 @@ class LibraryState {
314
330
this . hyperPlayLibrary . forEach ( ( game ) => {
315
331
if ( favouriteAppNames . includes ( game . app_name ) ) tempArray . push ( game )
316
332
} )
333
+ this . steamLibrary . forEach ( ( game ) => {
334
+ if ( favouriteAppNames . includes ( game . app_name ) ) tempArray . push ( game )
335
+ } )
317
336
}
318
337
return tempArray
319
338
}
@@ -330,14 +349,22 @@ class LibraryState {
330
349
const isGog = gogCategories . includes ( this . category )
331
350
const epicLibrary = isEpic ? this . epicLibrary : [ ]
332
351
const gogLibrary = isGog ? this . gogLibrary : [ ]
352
+ const steamLibrary =
353
+ this . category === 'steam' ? steamLibraryStore . get ( 'games' , [ ] ) : [ ]
333
354
const sideloadedApps = sideloadedCategories . includes ( this . category )
334
355
? this . sideloadedLibrary
335
356
: [ ]
336
357
const HPLibrary = hyperPlayCategories . includes ( this . category )
337
358
? this . hyperPlayLibrary
338
359
: [ ]
339
360
340
- library = [ ...HPLibrary , ...sideloadedApps , ...epicLibrary , ...gogLibrary ]
361
+ library = [
362
+ ...HPLibrary ,
363
+ ...sideloadedApps ,
364
+ ...epicLibrary ,
365
+ ...gogLibrary ,
366
+ ...steamLibrary
367
+ ]
341
368
342
369
if ( ! this . showNonAvailable ) {
343
370
const nonAvailableAppNames = Object . fromEntries (
0 commit comments