Skip to content

Commit

Permalink
refactor: remove supports optimistic send
Browse files Browse the repository at this point in the history
  • Loading branch information
domw30 committed Oct 5, 2023
1 parent e07d0ef commit 0b4635b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/chat/matrix-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ export class MatrixClient implements IChatClient {
this.events = events;
}

supportsOptimisticSend() {
return false;
}

async connect(userId: string, accessToken: string) {
this.userId = userId;
this.setConnectionStatus(ConnectionStatus.Connecting);
Expand Down Expand Up @@ -191,6 +187,7 @@ export class MatrixClient implements IChatClient {
_file?: FileUploadResult,
optimisticId?: string
): Promise<any> {
// throw new Error('Method not implemented.');
await this.waitForConnection();
let content = {
body: message,
Expand All @@ -205,6 +202,8 @@ export class MatrixClient implements IChatClient {
};
}

// set custom metadata (optimisticId)
// send message docs
const messageResult = await this.matrix.sendMessage(channelId, content);
const newMessage = await this.matrix.fetchRoomEvent(channelId, messageResult.event_id);
return {
Expand Down Expand Up @@ -263,6 +262,7 @@ export class MatrixClient implements IChatClient {
}

if (event.type === 'm.room.message') {
// rendering two messages
this.events.receiveNewMessage(event.room_id, (await mapMatrixMessage(event, this.matrix)) as any);
}

Expand Down

0 comments on commit 0b4635b

Please sign in to comment.