Skip to content

Commit

Permalink
Merge pull request #1892 from candela97/fix-inv-gift-detection
Browse files Browse the repository at this point in the history
Fix detecting inventory gifts
  • Loading branch information
tfedor authored Apr 10, 2024
2 parents f205c9e + 489379f commit d4713dc
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") {
gifts.push(appid);
} else {
passes.push(appid);
}
}
}
}

Expand Down

0 comments on commit d4713dc

Please sign in to comment.