storing inbox unread size in snapshot

This commit is contained in:
Miodec 2022-09-01 17:43:52 +02:00
parent a01261b88f
commit a28ac81b2e
3 changed files with 29 additions and 0 deletions

View file

@ -27,4 +27,5 @@ export const defaultSnap: MonkeyTypes.Snapshot = {
addedAt: 0,
filterPresets: [],
xp: 0,
inboxUnreadSize: 0,
};

View file

@ -96,6 +96,7 @@ export async function initSnapshot(): Promise<
snap.addedAt = userData.addedAt;
snap.inventory = userData.inventory;
snap.xp = userData.xp ?? 0;
snap.inboxUnreadSize = userData.inboxUnreadSize ?? 0;
if (userData.lbMemory?.time15 || userData.lbMemory?.time60) {
//old memory format

View file

@ -473,6 +473,7 @@ declare namespace MonkeyTypes {
addedAt: number;
filterPresets: ResultFilters[];
xp: number;
inboxUnreadSize: number;
}
interface UserDetails {
@ -738,4 +739,30 @@ declare namespace MonkeyTypes {
color?: string;
customStyle?: string;
}
interface MonkeyMail {
id: string;
subject: string;
body: string;
timestamp: number;
read: boolean;
rewards: AllRewards[];
}
interface Reward<T> {
type: string;
item: T;
}
interface XpReward extends Reward<number> {
type: "xp";
item: number;
}
interface BadgeReward extends Reward<Badge> {
type: "badge";
item: Badge;
}
type AllRewards = XpReward | BadgeReward;
}