feat: add changelog entry in preparation for update

This commit is contained in:
Paul Makles
2023-06-11 17:31:22 +01:00
parent d4728b8107
commit 961ee92a1c
11 changed files with 232 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
import { action, makeAutoObservable, runInAction } from "mobx";
import { latestChangelog } from "../../assets/changelogs";
import { changelogEntries, latestChangelog } from "../../assets/changelogs";
import { modalController } from "../../controllers/modals/ModalController";
import Persistent from "../interfaces/Persistent";
import Store from "../interfaces/Store";
@@ -58,14 +58,29 @@ export default class Changelog implements Store, Persistent<Data>, Syncable {
*/
checkForUpdates() {
if (this.viewed < latestChangelog) {
modalController.push({
type: "changelog",
initial: latestChangelog,
});
const expires = new Date(+changelogEntries[latestChangelog].date);
expires.setDate(expires.getDate() + 7);
if (+new Date() < +expires) {
if (latestChangelog === 3) {
modalController.push({
type: "changelog_usernames",
});
} else {
modalController.push({
type: "changelog",
initial: latestChangelog,
});
}
}
runInAction(() => {
this.viewed = latestChangelog;
});
} else {
modalController.push({
type: "changelog_usernames",
});
}
}
}