Skip to content

Commit

Permalink
Fix SteamCommunity login warning
Browse files Browse the repository at this point in the history
  • Loading branch information
tfedor committed Aug 4, 2019
1 parent d4ac943 commit 161c2a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 25 deletions.
24 changes: 3 additions & 21 deletions js/background/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,13 +442,7 @@ class SteamCommunity extends Api {
let coupons = CacheStorage.get("inventory_3", 3600);
if (!coupons) {
coupons = {};
let data;
try {
data = await self.getInventory(3);
} catch(err) {
console.error(err);
return coupons;
}
let data = await self.getInventory(3);

for (let description of data.descriptions) {
if (!description.type || description.type !== "Coupon") { continue; }
Expand Down Expand Up @@ -502,13 +496,7 @@ class SteamCommunity extends Api {
if (!value) {
let gifts = [], passes = [];

let data;
try {
data = await self.getInventory(1);
} catch(err) {
console.error(err);
return { "gifts": gifts, "passes": passes };
}
let data = await self.getInventory(1);

for (let description of data.descriptions) {
let isPackage = false;
Expand Down Expand Up @@ -556,13 +544,7 @@ class SteamCommunity extends Api {
// only used for market highlighting, need to be able to return a Set() of ['market_hash_name']
let inventory = CacheStorage.get("inventory_6", 3600);
if (!inventory) {
try {
inventory = await self.getInventory(6);
} catch(err) {
console.error(err);
return [];
}

inventory = await self.getInventory(6);
inventory = inventory.descriptions.map(item => item.market_hash_name);
CacheStorage.set("inventory_6", inventory);
}
Expand Down
8 changes: 4 additions & 4 deletions js/content/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -1339,18 +1339,18 @@ let Inventory = (function(){
let promises = [];

if (SyncedStorage.get("highlight_inv_guestpass") || SyncedStorage.get("tag_inv_guestpass") || SyncedStorage.get("highlight_inv_gift") || SyncedStorage.get("tag_inv_gift")) {
promises.push(Background.action('inventory.gifts').then(({ "gifts": x, "passes": y, }) => { gifts = new Set(x); guestpasses = new Set(y); }, EnhancedSteam.addLoginWarning));
promises.push(Background.action('inventory.gifts').then(({ "gifts": x, "passes": y, }) => { gifts = new Set(x); guestpasses = new Set(y); }));
}

if (SyncedStorage.get("highlight_coupon") || SyncedStorage.get("tag_coupon") || SyncedStorage.get("show_coupon")) {
promises.push(Background.action('inventory.coupons').then(handleCoupons, EnhancedSteam.addLoginWarning));
promises.push(Background.action('inventory.coupons').then(handleCoupons));
}

if (SyncedStorage.get("highlight_owned") || SyncedStorage.get("tag_owned")) {
promises.push(Background.action('inventory.community').then(inv6 => inv6set = new Set(inv6), EnhancedSteam.addLoginWarning));
promises.push(Background.action('inventory.community').then(inv6 => inv6set = new Set(inv6)));
}

_promise = Promise.all(promises);
_promise = Promise.all(promises).catch(EnhancedSteam.addLoginWarning);
return _promise;
};

Expand Down

0 comments on commit 161c2a7

Please sign in to comment.