Skip to content

Commit

Permalink
SteamScreenshots: Check context after downloading screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
darklinkpower committed May 28, 2024
1 parent b05fe35 commit 61d973d
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ public override void GameContextChanged(Game oldContext, Game newContext)
private void ResetToDefaultValues()
{
SetCollapsedVisibility();
_activeContext = default;
_isValuesDefaultState = true;
}

Expand Down Expand Up @@ -217,7 +218,7 @@ private async Task LoadControlData(Game game, CancellationToken cancellationToke
var gameDataPath = Path.Combine(_pluginStoragePath, "appdetails", $"{steamId}_appdetails.json");
if (FileSystem.FileExists(gameDataPath))
{
await SetScreenshots(gameDataPath, false);
await SetScreenshots(gameDataPath, false, scopeContext);
return;
}

Expand All @@ -231,10 +232,10 @@ private async Task LoadControlData(Game game, CancellationToken cancellationToke
return;
}

await SetScreenshots(gameDataPath, true);
await SetScreenshots(gameDataPath, true, scopeContext);
}

private async Task SetScreenshots(string gameDataPath, bool downloadScreenshots)
private async Task SetScreenshots(string gameDataPath, bool downloadScreenshots, Guid scopeContext)
{
try
{
Expand All @@ -258,6 +259,10 @@ private async Task SetScreenshots(string gameDataPath, bool downloadScreenshots)
if (downloadScreenshots)
{
await DownloadScreenshotsThumbnails(response.data.screenshots);
if (_activeContext != scopeContext)
{
return;
}
}

foreach (var screenshot in response.data.screenshots)
Expand Down

0 comments on commit 61d973d

Please sign in to comment.