Show popups at client init

This commit is contained in:
naskya 2023-07-08 20:09:40 +00:00
parent 1b8b6a8dd0
commit fdb6f9f185

View File

@ -36,7 +36,7 @@ import { version, ui, lang, host } from "@/config";
import { applyTheme } from "@/scripts/theme";
import { isDeviceDarkmode } from "@/scripts/is-device-darkmode";
import { i18n } from "@/i18n";
import { confirm, alert, post, popup, toast } from "@/os";
import { confirm, alert, post, popup, toast, api } from "@/os";
import { stream } from "@/stream";
import * as sound from "@/scripts/sound";
import { $i, refreshAccount, login, updateAccount, signout } from "@/account";
@ -272,6 +272,25 @@ function checkForSplash() {
}
}
if ($i) {
api("announcements", { withUnreads: true })
.then((announcements) => {
console.log(announcements);
announcements.forEach((announcement) => {
if (announcement.showPopup && announcement.isRead === false)
popup(
defineAsyncComponent(
() => import("@/components/MkAnnouncement.vue"),
),
{ announcement: announcement },
{},
"closed",
);
});
})
.catch((err) => console.log(err));
}
// NOTE: この処理は必ず↑のクライアント更新時処理より後に来ること(テーマ再構築のため)
watch(
defaultStore.reactiveState.darkMode,