Closed ELowry closed 3 years ago
The main issue here is that just like the current solution, this would result in pretty massive errors if the user for example opens Stadia via a link to a store page - because the IDs aren't actually readable via the current function if the page isn't opened via /home
first. The very same issue pops up if the user uses the "Pro" or "Captures" shortcut, because those re-load the page.
While the chances are low, this is definitely something that happens to a couple of people per day and would cause pretty dramatic issues in lots of situations. I.e. people using the "Pro" shortcut to claim games and then visiting the home screen again, or installing the extension while having the store loaded. Shortcuts would break, filtering would suddenly filter out all games listed as undefined and so on.
Overall, loading the ID from a entry that may or may not exist in a certain use case, shouldn't be considered a stable solution.
I currently implemented a little check as a temporarily solution, that simply hides the shortcut/filter icons, if the game has no ID. That way around at least nothing can break, that isn't solved by just refreshing the page.
What could work (for now, Google knows how long till they change that..) is changing the filter function to work based on the SKU and moving the shortcut option into the popup that opens when you click a game. both the popup and the "last played" tile at the top (that i actually have to add filter/shortcuts to), always feature the data-app-id
attribute no matter how you load the page, which could simply be used for the shortcut.
Basically, keep the shortcut icon for the last-played tile (since it features the ID) and add it to all other games like this (ignoring the german/english mix):
That last solution seems like a good compromise.
I'll look into adding it later. For now the code I have written should not add any further conflicts than what was previously was there (in fact it should address some of the situations you described since after a page reaload the user will still have access to the stored data).
I agree that it's not a proper solution yet, so I'll follow your suggestion and look into adding it to the "popup" version.
I was about to make some changes/fixes to the extension anyway, so i can actually add that quickly as well, if you don't mind.
If i change the filter to use the SKU and the shortcuts use the data-app-id value (which is the actual UID of the game), we can actually drop the entire sku2uid function in the first place. Adding the shortcut button to the popup and last played tile shouldn't be any issue.
Feel free. I'm a bit busy and don't have time to do that (not until later today for sure), but if you have any questions or need anything, I'll be happy to have a quick look =)
Quick update on version 1.7.8, so you can check if everything works fine (:
Looking good!!!
I'll close this then =)
The system is quite simple and should lighten things by only having the
enhanced_loadUIDs
function run every 5 minutes.You could only run the
enhanced_loadUIDs
function once per "session" (if successful), since the likelihood of a new game being added to the library in that interval is slim and there is a good chance the data won't be available in that situation anyway. But I'll leave that to you.The "timer" being used for this step is on line 1466 and is set to
3000
(5min 60 sec 1000milisec).