Skip to content

Commit

Permalink
feat: Cross platform support, and always show the latest played chara…
Browse files Browse the repository at this point in the history
…cter
  • Loading branch information
itssimple committed Jun 4, 2022
1 parent bf7ec80 commit 4a64a83
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/scripts/destiny2/apiClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -560,12 +560,16 @@ export class DestinyApiClient {
return null;
}

await self.getLinkedProfiles();

if (
self.linkedProfiles !== null &&
self.linkedProfiles.profiles !== null &&
self.linkedProfiles.profiles.length > 0
) {
var primaryMembership = self.linkedProfiles.profiles.sort((a, b) => a.dateLastPlayed > b.dateLastPlayed)[0];
var primaryMembership = self.linkedProfiles.profiles.sort((a, b) =>
a.dateLastPlayed > b.dateLastPlayed ? -1 : 1
)[0];

_profile = await self.getUserProfile(primaryMembership.membershipId, primaryMembership.membershipType);
}
Expand Down Expand Up @@ -595,6 +599,7 @@ export class DestinyApiClient {
: {},
characterCollectibles: _profile.characterCollectibles.data[_last.characterId].collectibles,
characterRecords: _profile.characterRecords.data[_last.characterId],
characterStringVariables: _profile.characterStringVariables.data[_last.characterId],
profileProgression: _profile.profileProgression.data,
metrics: _profile.metrics.data.metrics,
itemComponents: _profile.itemComponents,
Expand All @@ -604,6 +609,7 @@ export class DestinyApiClient {
profilePlugSets: !!!_profile.profilePlugSets.disabled ? _profile.profilePlugSets.data.plugs : {},
profileCollectibles: _profile.profileCollectibles.data,
profile: _profile.profile.data,
profileStringVariables: _profile.profileStringVariables.data,
};

return lastPlayedCharacter;
Expand Down

0 comments on commit 4a64a83

Please sign in to comment.