Removes groupv1 protos
This commit is contained in:
parent
6c70cd450b
commit
8aac997b4f
13 changed files with 21 additions and 373 deletions
|
@ -7,7 +7,7 @@
|
|||
import type { EventHandler } from './EventTarget';
|
||||
import EventTarget from './EventTarget';
|
||||
import MessageReceiver from './MessageReceiver';
|
||||
import type { ContactSyncEvent, GroupSyncEvent } from './messageReceiverEvents';
|
||||
import type { ContactSyncEvent } from './messageReceiverEvents';
|
||||
import MessageSender from './SendMessage';
|
||||
import { assertDev } from '../util/assert';
|
||||
import * as log from '../logging/log';
|
||||
|
@ -19,14 +19,10 @@ class SyncRequestInner extends EventTarget {
|
|||
|
||||
contactSync?: boolean;
|
||||
|
||||
groupSync?: boolean;
|
||||
|
||||
timeout: any;
|
||||
|
||||
oncontact: (event: ContactSyncEvent) => void;
|
||||
|
||||
ongroup: (event: GroupSyncEvent) => void;
|
||||
|
||||
timeoutMillis: number;
|
||||
|
||||
constructor(private receiver: MessageReceiver, timeoutMillis?: number) {
|
||||
|
@ -41,9 +37,6 @@ class SyncRequestInner extends EventTarget {
|
|||
this.oncontact = this.onContactSyncComplete.bind(this);
|
||||
receiver.addEventListener('contactSync', this.oncontact);
|
||||
|
||||
this.ongroup = this.onGroupSyncComplete.bind(this);
|
||||
receiver.addEventListener('groupSync', this.ongroup);
|
||||
|
||||
this.timeoutMillis = timeoutMillis || 60000;
|
||||
}
|
||||
|
||||
|
@ -72,7 +65,6 @@ class SyncRequestInner extends EventTarget {
|
|||
),
|
||||
singleProtoJobQueue.add(MessageSender.getRequestBlockSyncMessage()),
|
||||
singleProtoJobQueue.add(MessageSender.getRequestContactSyncMessage()),
|
||||
singleProtoJobQueue.add(MessageSender.getRequestGroupSyncMessage()),
|
||||
]);
|
||||
} catch (error: unknown) {
|
||||
log.error(
|
||||
|
@ -89,20 +81,15 @@ class SyncRequestInner extends EventTarget {
|
|||
this.update();
|
||||
}
|
||||
|
||||
onGroupSyncComplete() {
|
||||
this.groupSync = true;
|
||||
this.update();
|
||||
}
|
||||
|
||||
update() {
|
||||
if (this.contactSync && this.groupSync) {
|
||||
if (this.contactSync) {
|
||||
this.dispatchEvent(new Event('success'));
|
||||
this.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
onTimeout() {
|
||||
if (this.contactSync || this.groupSync) {
|
||||
if (this.contactSync) {
|
||||
this.dispatchEvent(new Event('success'));
|
||||
} else {
|
||||
this.dispatchEvent(new Event('timeout'));
|
||||
|
@ -113,7 +100,6 @@ class SyncRequestInner extends EventTarget {
|
|||
cleanup() {
|
||||
clearTimeout(this.timeout);
|
||||
this.receiver.removeEventListener('contactsync', this.oncontact);
|
||||
this.receiver.removeEventListener('groupSync', this.ongroup);
|
||||
delete this.listeners;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue