接入私聊消息通知和联系人免打扰
This commit is contained in:
1 parent
5c882ac855
commit
7e165ba9b4
23 files changed
+286
-97
No files matched your search
@@ -39,6 +39,7 @@ const shareRead = ref(false)
|
||||
const pendingFile = ref<File>()
|
||||
const view = ref<Awaited<ReturnType<typeof synchronize>>>()
|
||||
const target = computed(() => typeof route.params.user === 'string' ? route.params.user : '')
|
||||
const activeContact = computed(() => contacts.value.find((item) => item.id === target.value && item.state === 'friend'))
|
||||
const peer = computed(() => view.value?.peers.find((item) => item.id === selected.value))
|
||||
const trusted = computed(() => peer.value && view.value?.pinned[peer.value.id] === peer.value.publicKey)
|
||||
const changed = computed(() => peer.value && view.value?.pinned[peer.value.id] && !trusted.value)
|
||||
@@ -101,6 +102,15 @@ async function refresh() {
|
||||
if (!current.peers.some((device) => device.id === selected.value)) selected.value = current.peers[0]?.id ?? ''
|
||||
}
|
||||
|
||||
function toggleMute() {
|
||||
const contact = activeContact.value
|
||||
if (!contact) return
|
||||
void execute(async () => {
|
||||
await session.changeContact(contact.id, contact.muted ? 'unmute' : 'mute')
|
||||
await loadConversations()
|
||||
})
|
||||
}
|
||||
|
||||
function scheduleReceipt() {
|
||||
clearTimeout(receiptTimer)
|
||||
if (!view.value?.shareRead || busy.value || !trusted.value) return
|
||||
@@ -287,6 +297,8 @@ onBeforeUnmount(() => {
|
||||
<section class="device-page">
|
||||
<header class="page-header">
|
||||
<h1>加密聊天</h1>
|
||||
<button v-if="activeContact" type="button" class="plain" :aria-pressed="activeContact.muted" :disabled="busy"
|
||||
@click="toggleMute">消息免打扰</button>
|
||||
<button v-if="ownCode" class="plain" :disabled="busy" @click="sync">刷新</button>
|
||||
</header>
|
||||
<div class="conversation-layout">
|
||||
|
||||
Reference in new issue
Block a user