Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for separate library refreshes #1356

Conversation

connercsbn
Copy link
Contributor

This patch, addressing #1320, adds an additional string[] parameter to GlobalState.refresh and checkGameUpdates, allowing you to update just one library at a time.

Launching still refreshes both libraries, but logging in or clicking the refresh button in a library only refreshes the corresponding library.

The way I did it, there's some repeated code. There's probably a better way of doing it, especially as more libraries are added, but for now this was the best I could do. Let me know if you have a better idea and I'll happily rewrite it.


Use the following Checklist if you have changed something on the Backend or Frontend:

  • Tested the feature and it's working on a current and clean install.
  • Tested the main App features and they are still working on a current and clean install. (Login, Install, Play, Uninstall, Move games, etc.)
  • Created / Updated Tests (If necessary)
  • Created / Updated documentation (If necessary)

electron/main.ts Outdated
ipcMain.handle('checkGameUpdates', async () => {
const legendaryUpdates = await LegendaryLibrary.get().listUpdateableGames()
const gogUpdates = await GOGLibrary.get().listUpdateableGames()
ipcMain.handle('checkGameUpdates', async (event, libraries) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you should receive a Runner here and then depending on the Runner you call the right one.
Use a switch to make it more scalable. :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could also have a full parameter to refresh all libraries

@imLinguin
Copy link
Member

I believe for libraries instead of string[] you could use Runner[]. That would be more strict in terms of possible values.

@flavioislima flavioislima added the pr:ready-for-review Feature-complete, ready for the grind! :P label May 25, 2022
Copy link
Member

@flavioislima flavioislima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good. Thanks for that! ⚔️
tested and is everything working fine.

@flavioislima flavioislima merged commit 37cdf7e into Heroic-Games-Launcher:main May 25, 2022
connercsbn added a commit to connercsbn/HeroicGamesLauncher that referenced this pull request May 25, 2022
@connercsbn connercsbn deleted the refresh_libraries_individually branch May 25, 2022 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:ready-for-review Feature-complete, ready for the grind! :P
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants