Skip to content

Commit

Permalink
Fix detecting inventory gifts
Browse files Browse the repository at this point in the history
  • Loading branch information
candela97 committed Apr 4, 2024
1 parent b867b9c commit 489379f
Showing 1 changed file with 15 additions and 23 deletions.
38 changes: 15 additions & 23 deletions src/js/Background/Modules/SteamCommunityApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,33 +125,25 @@ class SteamCommunityApi extends Api {
const gifts = [];
const passes = [];

let isPackage;

function addGiftsAndPasses(description) {
const appids = GameId.getAppids(description.value);

// Gift package with multiple apps
isPackage = true;

for (const appid of appids) {
if (!appid) { continue; }
if (description.type === "Gift") {
gifts.push(appid);
} else {
passes.push(appid);
}
}
}
let isPackage = false;

for (const description of data.descriptions) {
isPackage = false;
if (description.descriptions) {
for (const desc of description.descriptions) {
if (desc.type !== "html") { continue; }

addGiftsAndPasses(desc);
const desc = description.descriptions?.find(d => d.type === "html");
if (desc) {
const appids = GameId.getAppids(desc.value);
if (appids.length > 0) {

break;
// Gift package with multiple apps
isPackage = true;

for (const appid of appids) {
if (description.type === "Gift") {

Check warning on line 141 in src/js/Background/Modules/SteamCommunityApi.js

View workflow job for this annotation

GitHub Actions / run-eslint

Blocks are nested too deeply (5). Maximum allowed is 4
gifts.push(appid);
} else {
passes.push(appid);
}
}
}
}

Expand Down

0 comments on commit 489379f

Please sign in to comment.