fix bug with mailbox
This commit is contained in:
Vendored
+5
-2
@@ -650,14 +650,16 @@
|
|||||||
function deleteMessage(message) {
|
function deleteMessage(message) {
|
||||||
messages.remove(message);
|
messages.remove(message);
|
||||||
}
|
}
|
||||||
function setChannel() {
|
function setChannel(shouldUpdateMailbox = true) {
|
||||||
if (cannotSetChannel.value == true) return;
|
if (cannotSetChannel.value == true) return;
|
||||||
if (currentPrimaryChannel != void 0) {
|
if (currentPrimaryChannel != void 0) {
|
||||||
UDN.unsubscribe(currentPrimaryChannel.value);
|
UDN.unsubscribe(currentPrimaryChannel.value);
|
||||||
}
|
}
|
||||||
UDN.subscribe(primaryChannel.value);
|
UDN.subscribe(primaryChannel.value);
|
||||||
|
if (shouldUpdateMailbox) {
|
||||||
updateMailbox();
|
updateMailbox();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
function leaveChannel() {
|
function leaveChannel() {
|
||||||
if (cannotLeaveChannel.value == true) return;
|
if (cannotLeaveChannel.value == true) return;
|
||||||
UDN.unsubscribe(currentPrimaryChannel.value);
|
UDN.unsubscribe(currentPrimaryChannel.value);
|
||||||
@@ -677,7 +679,7 @@
|
|||||||
}
|
}
|
||||||
UDN.onconnect = () => {
|
UDN.onconnect = () => {
|
||||||
isConnected.value = true;
|
isConnected.value = true;
|
||||||
setChannel();
|
setChannel(false);
|
||||||
if (mailboxId.value != "") {
|
if (mailboxId.value != "") {
|
||||||
UDN.connectMailbox(mailboxId.value);
|
UDN.connectMailbox(mailboxId.value);
|
||||||
}
|
}
|
||||||
@@ -687,6 +689,7 @@
|
|||||||
UDN.connectMailbox(id);
|
UDN.connectMailbox(id);
|
||||||
};
|
};
|
||||||
UDN.onmailboxconnect = () => {
|
UDN.onmailboxconnect = () => {
|
||||||
|
console.log("connected");
|
||||||
isMailboxConnected.value = true;
|
isMailboxConnected.value = true;
|
||||||
};
|
};
|
||||||
UDN.onmailboxdelete = () => {
|
UDN.onmailboxdelete = () => {
|
||||||
|
|||||||
+5
-2
@@ -195,7 +195,7 @@ export function deleteMessage(message: Message): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// channels
|
// channels
|
||||||
export function setChannel(): void {
|
export function setChannel(shouldUpdateMailbox: boolean = true): void {
|
||||||
if (cannotSetChannel.value == true) return;
|
if (cannotSetChannel.value == true) return;
|
||||||
|
|
||||||
if (currentPrimaryChannel != undefined) {
|
if (currentPrimaryChannel != undefined) {
|
||||||
@@ -203,8 +203,10 @@ export function setChannel(): void {
|
|||||||
}
|
}
|
||||||
UDN.subscribe(primaryChannel.value);
|
UDN.subscribe(primaryChannel.value);
|
||||||
|
|
||||||
|
if (shouldUpdateMailbox) {
|
||||||
updateMailbox();
|
updateMailbox();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function leaveChannel(): void {
|
export function leaveChannel(): void {
|
||||||
if (cannotLeaveChannel.value == true) return;
|
if (cannotLeaveChannel.value == true) return;
|
||||||
@@ -233,7 +235,7 @@ export async function decryptReceivedMessage(message: Message): Promise<void> {
|
|||||||
// LISTENERS
|
// LISTENERS
|
||||||
UDN.onconnect = () => {
|
UDN.onconnect = () => {
|
||||||
isConnected.value = true;
|
isConnected.value = true;
|
||||||
setChannel();
|
setChannel(false);
|
||||||
|
|
||||||
if (mailboxId.value != "") {
|
if (mailboxId.value != "") {
|
||||||
UDN.connectMailbox(mailboxId.value);
|
UDN.connectMailbox(mailboxId.value);
|
||||||
@@ -246,6 +248,7 @@ UDN.onmailboxcreate = (id) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
UDN.onmailboxconnect = () => {
|
UDN.onmailboxconnect = () => {
|
||||||
|
console.log("connected")
|
||||||
isMailboxConnected.value = true;
|
isMailboxConnected.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user