You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Merge branch 'develop' into feed
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
35
CHANGELOG.md
35
CHANGELOG.md
@@ -1,3 +1,38 @@
|
|||||||
|
Changes in [10.0.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v10.0.0) (2021-04-26)
|
||||||
|
==================================================================================================
|
||||||
|
[Full Changelog](https://github.com/matrix-org/matrix-js-sdk/compare/v10.0.0-rc.1...v10.0.0)
|
||||||
|
|
||||||
|
* No changes since rc.1
|
||||||
|
|
||||||
|
Changes in [10.0.0-rc.1](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v10.0.0-rc.1) (2021-04-21)
|
||||||
|
============================================================================================================
|
||||||
|
[Full Changelog](https://github.com/matrix-org/matrix-js-sdk/compare/v9.11.0...v10.0.0-rc.1)
|
||||||
|
|
||||||
|
BREAKING CHANGES
|
||||||
|
---
|
||||||
|
|
||||||
|
* The `RoomState.members` event is now only emitted when the room member's power level or the room's normal power level actually changes
|
||||||
|
|
||||||
|
All changes
|
||||||
|
---
|
||||||
|
|
||||||
|
* Restrict event emit for room members that had power levels changed
|
||||||
|
[\#1675](https://github.com/matrix-org/matrix-js-sdk/pull/1675)
|
||||||
|
* Fix sync with misconfigured push rules
|
||||||
|
[\#1669](https://github.com/matrix-org/matrix-js-sdk/pull/1669)
|
||||||
|
* Add missing await
|
||||||
|
[\#1665](https://github.com/matrix-org/matrix-js-sdk/pull/1665)
|
||||||
|
* Migrate to `eslint-plugin-matrix-org`
|
||||||
|
[\#1642](https://github.com/matrix-org/matrix-js-sdk/pull/1642)
|
||||||
|
* Add missing event type enum for key verification done
|
||||||
|
[\#1664](https://github.com/matrix-org/matrix-js-sdk/pull/1664)
|
||||||
|
* Fix timeline jumpiness by setting correct txnId
|
||||||
|
[\#1663](https://github.com/matrix-org/matrix-js-sdk/pull/1663)
|
||||||
|
* Fix calling addEventListener if it does not exist
|
||||||
|
[\#1661](https://github.com/matrix-org/matrix-js-sdk/pull/1661)
|
||||||
|
* Persist unsent messages for subsequent sessions
|
||||||
|
[\#1655](https://github.com/matrix-org/matrix-js-sdk/pull/1655)
|
||||||
|
|
||||||
Changes in [9.11.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v9.11.0) (2021-04-12)
|
Changes in [9.11.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v9.11.0) (2021-04-12)
|
||||||
==================================================================================================
|
==================================================================================================
|
||||||
[Full Changelog](https://github.com/matrix-org/matrix-js-sdk/compare/v9.11.0-rc.1...v9.11.0)
|
[Full Changelog](https://github.com/matrix-org/matrix-js-sdk/compare/v9.11.0-rc.1...v9.11.0)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "matrix-js-sdk",
|
"name": "matrix-js-sdk",
|
||||||
"version": "9.11.0",
|
"version": "10.0.0",
|
||||||
"description": "Matrix Client-Server SDK for Javascript",
|
"description": "Matrix Client-Server SDK for Javascript",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepublishOnly": "yarn build",
|
"prepublishOnly": "yarn build",
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {TestClient} from '../../TestClient';
|
import {TestClient} from '../../TestClient';
|
||||||
import {MatrixCall, CallErrorCode} from '../../../src/webrtc/call';
|
import {MatrixCall, CallErrorCode, CallEvent} from '../../../src/webrtc/call';
|
||||||
|
|
||||||
const DUMMY_SDP = (
|
const DUMMY_SDP = (
|
||||||
"v=0\r\n" +
|
"v=0\r\n" +
|
||||||
@@ -254,4 +254,48 @@ describe('Call', function() {
|
|||||||
sdpMid: '',
|
sdpMid: '',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should map asserted identity messages to remoteAssertedIdentity', async function() {
|
||||||
|
const callPromise = call.placeVoiceCall();
|
||||||
|
await client.httpBackend.flush();
|
||||||
|
await callPromise;
|
||||||
|
await call.onAnswerReceived({
|
||||||
|
getContent: () => {
|
||||||
|
return {
|
||||||
|
version: 1,
|
||||||
|
call_id: call.callId,
|
||||||
|
party_id: 'party_id',
|
||||||
|
answer: {
|
||||||
|
sdp: DUMMY_SDP,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const identChangedCallback = jest.fn();
|
||||||
|
call.on(CallEvent.AssertedIdentityChanged, identChangedCallback);
|
||||||
|
|
||||||
|
await call.onAssertedIdentityReceived({
|
||||||
|
getContent: () => {
|
||||||
|
return {
|
||||||
|
version: 1,
|
||||||
|
call_id: call.callId,
|
||||||
|
party_id: 'party_id',
|
||||||
|
asserted_identity: {
|
||||||
|
id: "@steve:example.com",
|
||||||
|
display_name: "Steve Gibbons",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(identChangedCallback).toHaveBeenCalled();
|
||||||
|
|
||||||
|
const ident = call.getRemoteAssertedIdentity();
|
||||||
|
expect(ident.id).toEqual("@steve:example.com");
|
||||||
|
expect(ident.displayName).toEqual("Steve Gibbons");
|
||||||
|
|
||||||
|
// Hangup to stop timers
|
||||||
|
call.hangup(CallErrorCode.UserHangup, true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ export enum EventType {
|
|||||||
CallSelectAnswer = "m.call.select_answer",
|
CallSelectAnswer = "m.call.select_answer",
|
||||||
CallNegotiate = "m.call.negotiate",
|
CallNegotiate = "m.call.negotiate",
|
||||||
CallReplaces = "m.call.replaces",
|
CallReplaces = "m.call.replaces",
|
||||||
|
CallAssertedIdentity = "m.call.asserted_identity",
|
||||||
|
CallAssertedIdentityPrefix = "org.matrix.call.asserted_identity",
|
||||||
KeyVerificationRequest = "m.key.verification.request",
|
KeyVerificationRequest = "m.key.verification.request",
|
||||||
KeyVerificationStart = "m.key.verification.start",
|
KeyVerificationStart = "m.key.verification.start",
|
||||||
KeyVerificationCancel = "m.key.verification.cancel",
|
KeyVerificationCancel = "m.key.verification.cancel",
|
||||||
|
|||||||
@@ -500,7 +500,7 @@ MatrixClient.prototype.rehydrateDevice = async function() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getDeviceResult = this.getDehydratedDevice();
|
const getDeviceResult = await this.getDehydratedDevice();
|
||||||
if (!getDeviceResult) {
|
if (!getDeviceResult) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -729,6 +729,17 @@ MatrixClient.prototype.setSupportsCallTransfer = function(supportsCallTransfer)
|
|||||||
this._supportsCallTransfer = supportsCallTransfer;
|
this._supportsCallTransfer = supportsCallTransfer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new call.
|
||||||
|
* The place*Call methods on the returned call can be used to actually place a call
|
||||||
|
*
|
||||||
|
* @param {string} roomId The room the call is to be placed in.
|
||||||
|
* @return {MatrixCall} the call or null if the browser doesn't support calling.
|
||||||
|
*/
|
||||||
|
MatrixClient.prototype.createCall = function(roomId) {
|
||||||
|
return createNewMatrixCall(this, roomId);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current sync state.
|
* Get the current sync state.
|
||||||
* @return {?string} the sync state, which may be null.
|
* @return {?string} the sync state, which may be null.
|
||||||
@@ -4799,7 +4810,8 @@ MatrixClient.prototype._processRoomEventsSearch = function(searchResults, respon
|
|||||||
searchResults.highlights = Object.keys(highlights);
|
searchResults.highlights = Object.keys(highlights);
|
||||||
|
|
||||||
// append the new results to our existing results
|
// append the new results to our existing results
|
||||||
for (let i = 0; i < room_events.results.length; i++) {
|
const resultsLength = room_events.results ? room_events.results.length : 0;
|
||||||
|
for (let i = 0; i < resultsLength; i++) {
|
||||||
const sr = SearchResult.fromJson(room_events.results[i], this.getEventMapper());
|
const sr = SearchResult.fromJson(room_events.results[i], this.getEventMapper());
|
||||||
searchResults.results.push(sr);
|
searchResults.results.push(sr);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -351,8 +351,14 @@ RoomState.prototype.setStateEvents = function(stateEvents) {
|
|||||||
} else if (event.getType() === "m.room.power_levels") {
|
} else if (event.getType() === "m.room.power_levels") {
|
||||||
const members = utils.values(self.members);
|
const members = utils.values(self.members);
|
||||||
utils.forEach(members, function(member) {
|
utils.forEach(members, function(member) {
|
||||||
|
// We only propagate `RoomState.members` event if the
|
||||||
|
// power levels has been changed
|
||||||
|
// large room suffer from large re-rendering especially when not needed
|
||||||
|
const oldLastModified = member.getLastModifiedTime();
|
||||||
member.setPowerLevelEvent(event);
|
member.setPowerLevelEvent(event);
|
||||||
|
if (oldLastModified !== member.getLastModifiedTime()) {
|
||||||
self.emit("RoomState.members", event, self, member);
|
self.emit("RoomState.members", event, self, member);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// assume all our sentinels are now out-of-date
|
// assume all our sentinels are now out-of-date
|
||||||
|
|||||||
@@ -982,6 +982,15 @@ Room.prototype.addEventsToTimeline = function(events, toStartOfTimeline,
|
|||||||
return this.currentState.getMember(userId);
|
return this.currentState.getMember(userId);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all currently loaded members from the current
|
||||||
|
* room state.
|
||||||
|
* @returns {RoomMember[]} Room members
|
||||||
|
*/
|
||||||
|
Room.prototype.getMembers = function() {
|
||||||
|
return this.currentState.getMembers();
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of members whose membership state is "join".
|
* Get a list of members whose membership state is "join".
|
||||||
* @return {RoomMember[]} A list of currently joined members.
|
* @return {RoomMember[]} A list of currently joined members.
|
||||||
|
|||||||
@@ -268,6 +268,10 @@ export function PushProcessor(client) {
|
|||||||
return cond.value === val;
|
return cond.value === val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof cond.pattern !== 'string') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
let regex;
|
let regex;
|
||||||
|
|
||||||
if (cond.key == 'content.body') {
|
if (cond.key == 'content.body') {
|
||||||
|
|||||||
@@ -70,6 +70,11 @@ interface TurnServer {
|
|||||||
ttl?: number,
|
ttl?: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface AssertedIdentity {
|
||||||
|
id: string,
|
||||||
|
displayName: string,
|
||||||
|
}
|
||||||
|
|
||||||
export enum CallState {
|
export enum CallState {
|
||||||
Fledgling = 'fledgling',
|
Fledgling = 'fledgling',
|
||||||
InviteSent = 'invite_sent',
|
InviteSent = 'invite_sent',
|
||||||
@@ -111,6 +116,8 @@ export enum CallEvent {
|
|||||||
HoldUnhold = 'hold_unhold',
|
HoldUnhold = 'hold_unhold',
|
||||||
// Feeds have changed
|
// Feeds have changed
|
||||||
FeedsChanged = 'feeds_changed',
|
FeedsChanged = 'feeds_changed',
|
||||||
|
|
||||||
|
AssertedIdentityChanged = 'asserted_identity_changed',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum CallErrorCode {
|
export enum CallErrorCode {
|
||||||
@@ -299,6 +306,8 @@ export class MatrixCall extends EventEmitter {
|
|||||||
// the call) we buffer them up here so we can then add the ones from the party we pick
|
// the call) we buffer them up here so we can then add the ones from the party we pick
|
||||||
private remoteCandidateBuffer = new Map<string, RTCIceCandidate[]>();
|
private remoteCandidateBuffer = new Map<string, RTCIceCandidate[]>();
|
||||||
|
|
||||||
|
private remoteAssertedIdentity: AssertedIdentity;
|
||||||
|
|
||||||
constructor(opts: CallOpts) {
|
constructor(opts: CallOpts) {
|
||||||
super();
|
super();
|
||||||
this.roomId = opts.roomId;
|
this.roomId = opts.roomId;
|
||||||
@@ -411,6 +420,10 @@ export class MatrixCall extends EventEmitter {
|
|||||||
return Boolean(this.opponentCaps && this.opponentCaps["m.call.transferee"]);
|
return Boolean(this.opponentCaps && this.opponentCaps["m.call.transferee"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getRemoteAssertedIdentity(): AssertedIdentity {
|
||||||
|
return this.remoteAssertedIdentity;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of all CallFeeds
|
* Returns an array of all CallFeeds
|
||||||
* @returns {Array<CallFeed>} CallFeeds
|
* @returns {Array<CallFeed>} CallFeeds
|
||||||
@@ -1121,6 +1134,16 @@ export class MatrixCall extends EventEmitter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async onAssertedIdentityReceived(event: MatrixEvent) {
|
||||||
|
if (!event.getContent().asserted_identity) return;
|
||||||
|
|
||||||
|
this.remoteAssertedIdentity = {
|
||||||
|
id: event.getContent().asserted_identity.id,
|
||||||
|
displayName: event.getContent().asserted_identity.display_name,
|
||||||
|
};
|
||||||
|
this.emit(CallEvent.AssertedIdentityChanged);
|
||||||
|
}
|
||||||
|
|
||||||
private callHasEnded(): boolean {
|
private callHasEnded(): boolean {
|
||||||
// This exists as workaround to typescript trying to be clever and erroring
|
// This exists as workaround to typescript trying to be clever and erroring
|
||||||
// when putting if (this.state === CallState.Ended) return; twice in the same
|
// when putting if (this.state === CallState.Ended) return; twice in the same
|
||||||
@@ -1750,6 +1773,9 @@ export function setAudioInput(deviceId: string) { audioInput = deviceId; }
|
|||||||
export function setVideoInput(deviceId: string) { videoInput = deviceId; }
|
export function setVideoInput(deviceId: string) { videoInput = deviceId; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* DEPRECATED
|
||||||
|
* Use client.createCall()
|
||||||
|
*
|
||||||
* Create a new Matrix call for the browser.
|
* Create a new Matrix call for the browser.
|
||||||
* @param {MatrixClient} client The client instance to use.
|
* @param {MatrixClient} client The client instance to use.
|
||||||
* @param {string} roomId The room the call is in.
|
* @param {string} roomId The room the call is in.
|
||||||
|
|||||||
@@ -87,7 +87,11 @@ export class CallEventHandler {
|
|||||||
|
|
||||||
private onEvent = (event: MatrixEvent) => {
|
private onEvent = (event: MatrixEvent) => {
|
||||||
// any call events or ones that might be once they're decrypted
|
// any call events or ones that might be once they're decrypted
|
||||||
if (event.getType().indexOf("m.call.") === 0 || event.isBeingDecrypted()) {
|
if (
|
||||||
|
event.getType().indexOf("m.call.") === 0 ||
|
||||||
|
event.getType().indexOf("org.matrix.call.") === 0
|
||||||
|
|| event.isBeingDecrypted()
|
||||||
|
) {
|
||||||
// queue up for processing once all events from this sync have been
|
// queue up for processing once all events from this sync have been
|
||||||
// processed (see above).
|
// processed (see above).
|
||||||
this.callEventBuffer.push(event);
|
this.callEventBuffer.push(event);
|
||||||
@@ -271,6 +275,18 @@ export class CallEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
call.onNegotiateReceived(event);
|
call.onNegotiateReceived(event);
|
||||||
|
} else if (
|
||||||
|
event.getType() === EventType.CallAssertedIdentity ||
|
||||||
|
event.getType() === EventType.CallAssertedIdentityPrefix
|
||||||
|
) {
|
||||||
|
if (!call) return;
|
||||||
|
|
||||||
|
if (event.getContent().party_id === call.ourPartyId) {
|
||||||
|
// Ignore remote echo (not that we send asserted identity, but still...)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
call.onAssertedIdentityReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user