wip
This commit is contained in:
parent
b717f0d1f4
commit
51afc9ace9
|
@ -22,6 +22,7 @@ import { deckStore } from '@/ui/deck/deck-store.js';
|
|||
import { emojiPicker } from '@/scripts/emoji-picker.js';
|
||||
import { mainRouter } from '@/router/main.js';
|
||||
import { type Keymap, makeHotkey } from '@/scripts/hotkey.js';
|
||||
import { addCustomEmoji, removeCustomEmojis, updateCustomEmojis } from '@/custom-emojis.js';
|
||||
|
||||
export async function mainBoot() {
|
||||
const { isClientUpdated } = await common(() => createApp(
|
||||
|
@ -62,6 +63,18 @@ export async function mainBoot() {
|
|||
}
|
||||
});
|
||||
|
||||
stream.on('emojiAdded', emojiData => {
|
||||
addCustomEmoji(emojiData.emoji);
|
||||
});
|
||||
|
||||
stream.on('emojiUpdated', emojiData => {
|
||||
updateCustomEmojis(emojiData.emojis);
|
||||
});
|
||||
|
||||
stream.on('emojiDeleted', emojiData => {
|
||||
removeCustomEmojis(emojiData.emojis);
|
||||
});
|
||||
|
||||
for (const plugin of ColdDeviceStorage.get('plugins').filter(p => p.active)) {
|
||||
import('@/plugin.js').then(async ({ install }) => {
|
||||
// Workaround for https://bugs.webkit.org/show_bug.cgi?id=242740
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
import { shallowRef, computed, markRaw, watch } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { misskeyApi, misskeyApiGet } from '@/scripts/misskey-api.js';
|
||||
import { useStream } from '@/stream.js';
|
||||
import { get, set } from '@/scripts/idb-proxy.js';
|
||||
|
||||
const storageCache = await get('emojis');
|
||||
|
@ -29,23 +28,20 @@ watch(customEmojis, emojis => {
|
|||
}
|
||||
}, { immediate: true });
|
||||
|
||||
// TODO: ここら辺副作用なのでいい感じにする
|
||||
const stream = useStream();
|
||||
|
||||
stream.on('emojiAdded', emojiData => {
|
||||
customEmojis.value = [emojiData.emoji, ...customEmojis.value];
|
||||
export function addCustomEmoji(emoji: Misskey.entities.EmojiSimple) {
|
||||
customEmojis.value = [emoji, ...customEmojis.value];
|
||||
set('emojis', customEmojis.value);
|
||||
});
|
||||
}
|
||||
|
||||
stream.on('emojiUpdated', emojiData => {
|
||||
customEmojis.value = customEmojis.value.map(item => emojiData.emojis.find(search => search.name === item.name) as Misskey.entities.EmojiSimple ?? item);
|
||||
export function updateCustomEmojis(emojis: Misskey.entities.EmojiSimple[]) {
|
||||
customEmojis.value = customEmojis.value.map(item => emojis.find(search => search.name === item.name) ?? item);
|
||||
set('emojis', customEmojis.value);
|
||||
});
|
||||
}
|
||||
|
||||
stream.on('emojiDeleted', emojiData => {
|
||||
customEmojis.value = customEmojis.value.filter(item => !emojiData.emojis.some(search => search.name === item.name));
|
||||
export function removeCustomEmojis(emojis: Misskey.entities.EmojiSimple[]) {
|
||||
customEmojis.value = customEmojis.value.filter(item => !emojis.some(search => search.name === item.name));
|
||||
set('emojis', customEmojis.value);
|
||||
});
|
||||
}
|
||||
|
||||
export async function fetchCustomEmojis(force = false) {
|
||||
const now = Date.now();
|
||||
|
|
Loading…
Reference in a new issue