Skip to content

Commit

Permalink
feat: Now you can play on any platform, and it'll show you the last p…
Browse files Browse the repository at this point in the history
…layed character at all times
  • Loading branch information
itssimple committed Jun 4, 2022
1 parent ffd319c commit be26f77
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
11 changes: 6 additions & 5 deletions src/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,12 @@ async function initializeDatabase() {
window.historyChecker = setInterval(async function () {
if (destinyApiClient.profile) {
let lastPlayed = await destinyApiClient.getLastPlayedCharacter();

await destinyApiClient.loadCharacterHistory(
lastPlayed.characterInfo.membershipId,
lastPlayed.characterInfo.characterId
);
try {
await destinyApiClient.loadCharacterHistory(
lastPlayed.characterInfo.membershipId,
lastPlayed.characterInfo.characterId
);
} catch (e) {}
}
}, 300 * 1000);

Expand Down
5 changes: 2 additions & 3 deletions src/scripts/destiny2/apiClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -561,12 +561,11 @@ export class DestinyApiClient {
}

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

_profile = await self.getUserProfile(primaryMembership.membershipId, primaryMembership.membershipType);
}
Expand Down Expand Up @@ -956,7 +955,7 @@ export class DestinyApiClient {
} catch (e) {
log("CHARACTER-HISTORY", "Failed to load character history", e, history);
self.refreshToken();
reject(history.Result.content);
reject(history);
}

page++;
Expand Down

0 comments on commit be26f77

Please sign in to comment.