1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

Merge branch 'develop' into gsouquet/threaded-messaging-2349

This commit is contained in:
Germain Souquet
2021-08-19 10:45:23 +01:00
4 changed files with 16 additions and 17 deletions

View File

@@ -521,7 +521,7 @@ interface IMessagesResponse {
state: IStateEvent[];
}
interface IRequestTokenResponse {
export interface IRequestTokenResponse {
sid: string;
submit_url?: string;
}
@@ -600,7 +600,7 @@ interface IUserDirectoryResponse {
limited: boolean;
}
interface IMyDevice {
export interface IMyDevice {
device_id: string;
display_name?: string;
last_seen_ip?: string;
@@ -5078,7 +5078,7 @@ export class MatrixClient extends EventEmitter {
email: string,
clientSecret: string,
sendAttempt: number,
nextLink: string,
nextLink?: string,
): Promise<IRequestTokenResponse> {
return this.requestTokenFromEndpoint(
"/account/password/email/requestToken",
@@ -7991,10 +7991,7 @@ export class MatrixClient extends EventEmitter {
autoJoinOnly?: boolean,
limit?: number,
batch?: string,
): Promise<{
rooms: ISpaceSummaryRoom[];
events: ISpaceSummaryEvent[];
}> {
): Promise<{rooms: ISpaceSummaryRoom[], events: ISpaceSummaryEvent[]}> {
const path = utils.encodeUri("/rooms/$roomId/spaces", {
$roomId: roomId,
});

View File

@@ -59,7 +59,7 @@ export class EncryptionSetupBuilder {
* @param {Object.<String, MatrixEvent>} accountData pre-existing account data, will only be read, not written.
* @param {CryptoCallbacks} delegateCryptoCallbacks crypto callbacks to delegate to if the key isn't in cache yet
*/
constructor(accountData: Record<string, MatrixEvent>, delegateCryptoCallbacks: ICryptoCallbacks) {
constructor(accountData: Record<string, MatrixEvent>, delegateCryptoCallbacks?: ICryptoCallbacks) {
this.accountDataClientAdapter = new AccountDataClientAdapter(accountData);
this.crossSigningCallbacks = new CrossSigningCallbacks();
this.ssssCryptoCallbacks = new SSSSCryptoCallbacks(delegateCryptoCallbacks);
@@ -351,7 +351,7 @@ class CrossSigningCallbacks implements ICryptoCallbacks, ICacheCallbacks {
class SSSSCryptoCallbacks {
private readonly privateKeys = new Map<string, Uint8Array>();
constructor(private readonly delegateCryptoCallbacks: ICryptoCallbacks) {}
constructor(private readonly delegateCryptoCallbacks?: ICryptoCallbacks) {}
public async getSecretStorageKey(
{ keys }: { keys: Record<string, ISecretStorageKeyInfo> },

View File

@@ -18,7 +18,7 @@ import { MatrixClient } from "../client";
import { EventType, IEncryptedFile, MsgType, UNSTABLE_MSC3089_BRANCH, UNSTABLE_MSC3089_LEAF } from "../@types/event";
import { Room } from "./room";
import { logger } from "../logger";
import { MatrixEvent } from "./event";
import { IContent, MatrixEvent } from "./event";
import {
averageBetweenStrings,
DEFAULT_ALPHABET,
@@ -451,11 +451,14 @@ export class MSC3089TreeSpace {
* @param {string} name The name of the file.
* @param {ArrayBuffer} encryptedContents The encrypted contents.
* @param {Partial<IEncryptedFile>} info The encrypted file information.
* @param {IContent} additionalContent Optional event content fields to include in the message.
* @returns {Promise<void>} Resolves when uploaded.
*/
public async createFile(
name: string,
encryptedContents: ArrayBuffer, info: Partial<IEncryptedFile>,
encryptedContents: ArrayBuffer,
info: Partial<IEncryptedFile>,
additionalContent?: IContent,
): Promise<void> {
const mxc = await this.client.uploadContent(new Blob([encryptedContents]), {
includeFilename: false,
@@ -464,6 +467,7 @@ export class MSC3089TreeSpace {
info.url = mxc;
const res = await this.client.sendMessage(this.roomId, {
...(additionalContent ?? {}),
msgtype: MsgType.File,
body: name,
url: mxc,

View File

@@ -80,7 +80,7 @@ export class CallEventHandler {
continue;
}
try {
this.handleCallEvent(e);
await this.handleCallEvent(e);
} catch (e) {
logger.error("Caught exception handling call event", e);
}
@@ -100,7 +100,7 @@ export class CallEventHandler {
if (event.isBeingDecrypted() || event.isDecryptionFailure()) {
// add an event listener for once the event is decrypted.
event.once("Event.decrypted", () => {
event.once("Event.decrypted", async () => {
if (!this.eventIsACall(event)) return;
if (this.callEventBuffer.includes(event)) {
@@ -110,7 +110,7 @@ export class CallEventHandler {
// This one wasn't buffered so just run the event handler for it
// straight away
try {
this.handleCallEvent(event);
await this.handleCallEvent(event);
} catch (e) {
logger.error("Caught exception handling call event", e);
}
@@ -169,7 +169,7 @@ export class CallEventHandler {
}
call.callId = content.call_id;
const initWithInvitePromise = call.initWithInvite(event);
await call.initWithInvite(event);
this.calls.set(call.callId, call);
// if we stashed candidate events for that call ID, play them back now
@@ -210,8 +210,6 @@ export class CallEventHandler {
"Glare detected: answering incoming call " + call.callId +
" and canceling outgoing call " + existingCall.callId,
);
// Await init with invite as we need a peerConn for the following methods
await initWithInvitePromise;
existingCall.replacedBy(call);
call.answer();
} else {