fixes & add button to see if notification dot works

This commit is contained in:
KevinWh0 2024-06-17 17:44:00 +02:00 committed by dakkar
parent 16ecc2e406
commit 88eb1a0c53
7 changed files with 84 additions and 19 deletions

View file

@ -21,6 +21,7 @@ import { initializeSw } from '@/scripts/initialize-sw.js';
import { deckStore } from '@/ui/deck/deck-store.js';
import { emojiPicker } from '@/scripts/emoji-picker.js';
import { mainRouter } from '@/router/main.js';
import { setFavIconDot } from '@/scripts/favicon-dot.js';
export async function mainBoot() {
const { isClientUpdated } = await common(() => createApp(
@ -261,6 +262,15 @@ export async function mainBoot() {
}
}
function attemptShowNotificationDot() {
if (!$i) return;
if (defaultStore.state.enableFaviconNotificationDot) {
setFavIconDot(true);
}
}
if ($i.hasUnreadNotification) attemptShowNotificationDot();
const main = markRaw(stream.useChannel('main', null, 'System'));
// 自分の情報が更新されたとき
@ -269,6 +279,8 @@ export async function mainBoot() {
});
main.on('readAllNotifications', () => {
setFavIconDot(false);
updateAccount({
hasUnreadNotification: false,
unreadNotificationsCount: 0,
@ -276,6 +288,8 @@ export async function mainBoot() {
});
main.on('unreadNotification', () => {
attemptShowNotificationDot();
const unreadNotificationsCount = ($i?.unreadNotificationsCount ?? 0) + 1;
updateAccount({
hasUnreadNotification: true,