Skip to content

Commit

Permalink
Merge branch 'main' into more-aggregate-reports
Browse files Browse the repository at this point in the history
  • Loading branch information
su225 authored Dec 9, 2024
2 parents 9d0fcac + 4543fe4 commit 48a0592
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 24 deletions.
7 changes: 7 additions & 0 deletions packages/client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

## [1.11.15](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.11.14...@stream-io/video-client-1.11.15) (2024-12-09)


### Bug Fixes

* avoid call.get in all call.ring events ([#1615](https://github.com/GetStream/stream-video-js/issues/1615)) ([c757370](https://github.com/GetStream/stream-video-js/commit/c7573701a20b4a29cd2b6fd08a55d4eff503f77f))

## [1.11.14](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.11.13...@stream-io/video-client-1.11.14) (2024-12-04)


Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stream-io/video-client",
"version": "1.11.14",
"version": "1.11.15",
"packageManager": "[email protected]",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
Expand Down
25 changes: 25 additions & 0 deletions packages/client/src/Call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import type {
AcceptCallResponse,
BlockUserRequest,
BlockUserResponse,
CallRingEvent,
CollectUserFeedbackRequest,
CollectUserFeedbackResponse,
Credentials,
Expand Down Expand Up @@ -595,6 +596,30 @@ export class Call {
return this.state.createdBy?.id === this.currentUserId;
}

/**
* Update from the call response from the "call.ring" event
* @internal
*/
updateFromRingingEvent = async (event: CallRingEvent) => {
await this.setup();
// call.ring event excludes the call creator in the members list
// as the creator does not get the ring event
// so update the member list accordingly
const creator = this.state.members.find(
(m) => m.user.id === event.call.created_by.id,
);
if (!creator) {
this.state.setMembers(event.members);
} else {
this.state.setMembers([creator, ...event.members]);
}
// update the call state with the latest event data
this.state.updateFromCallResponse(event.call);
this.ringingSubject.next(true);
this.watching = true;
await this.applyDeviceConfig(false);
};

/**
* Loads the information about the call.
*
Expand Down
36 changes: 17 additions & 19 deletions packages/client/src/StreamVideoClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ export class StreamVideoClient {
);
return;
}

this.logger('info', `New call created and registered: ${call.cid}`);
const newCall = new Call({
streamClient: this.streamClient,
Expand All @@ -289,25 +288,24 @@ export class StreamVideoClient {
);
return;
}

// The call might already be tracked by the client,
// if `call.created` was received before `call.ring`.
// In that case, we cleanup the already tracked call.
const prevCall = this.writeableStateStore.findCall(call.type, call.id);
await prevCall?.leave({ reason: 'cleaning-up in call.ring' });
// we create a new call
const theCall = new Call({
streamClient: this.streamClient,
type: call.type,
id: call.id,
members,
clientStore: this.writeableStateStore,
ringing: true,
});
theCall.state.updateFromCallResponse(call);
// we fetch the latest metadata for the call from the server
await theCall.get();
this.writeableStateStore.registerCall(theCall);
// the client already has the call instance and we just need to update the state
const theCall = this.writeableStateStore.findCall(call.type, call.id);
if (theCall) {
await theCall.updateFromRingingEvent(event);
} else {
// if client doesn't have the call instance, create the instance and fetch the latest state
// Note: related - we also have onRingingCall method to handle this case from push notifications
const newCallInstance = new Call({
streamClient: this.streamClient,
type: call.type,
id: call.id,
members,
clientStore: this.writeableStateStore,
ringing: true,
});
await newCallInstance.get();
}
}),
);

Expand Down
5 changes: 5 additions & 0 deletions packages/react-bindings/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

## [1.2.9](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-1.2.8...@stream-io/video-react-bindings-1.2.9) (2024-12-09)

### Dependency Updates

* `@stream-io/video-client` updated to version `1.11.15`
## [1.2.8](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-1.2.7...@stream-io/video-react-bindings-1.2.8) (2024-12-04)

### Dependency Updates
Expand Down
2 changes: 1 addition & 1 deletion packages/react-bindings/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stream-io/video-react-bindings",
"version": "1.2.8",
"version": "1.2.9",
"packageManager": "[email protected]",
"main": "./dist/index.cjs.js",
"module": "./dist/index.es.js",
Expand Down
6 changes: 6 additions & 0 deletions packages/react-native-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

## [1.4.12](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-1.4.11...@stream-io/video-react-native-sdk-1.4.12) (2024-12-09)

### Dependency Updates

* `@stream-io/video-client` updated to version `1.11.15`
* `@stream-io/video-react-bindings` updated to version `1.2.9`
## [1.4.11](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-1.4.10...@stream-io/video-react-native-sdk-1.4.11) (2024-12-04)

### Dependency Updates
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stream-io/video-react-native-sdk",
"version": "1.4.11",
"version": "1.4.12",
"packageManager": "[email protected]",
"main": "dist/commonjs/index.js",
"module": "dist/module/index.js",
Expand Down
11 changes: 11 additions & 0 deletions packages/react-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

## [1.8.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.7.30...@stream-io/video-react-sdk-1.8.0) (2024-12-09)

### Dependency Updates

* `@stream-io/video-client` updated to version `1.11.15`
* `@stream-io/video-react-bindings` updated to version `1.2.9`

### Features

* add an option to filter participants in layouts ([#1612](https://github.com/GetStream/stream-video-js/issues/1612)) ([e1eac3f](https://github.com/GetStream/stream-video-js/commit/e1eac3fa4aa9239b9f0e75b6f33d51cd39c788e5))

## [1.7.30](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.7.29...@stream-io/video-react-sdk-1.7.30) (2024-12-04)

### Dependency Updates
Expand Down
2 changes: 1 addition & 1 deletion packages/react-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stream-io/video-react-sdk",
"version": "1.7.30",
"version": "1.8.0",
"packageManager": "[email protected]",
"main": "./dist/index.cjs.js",
"module": "./dist/index.es.js",
Expand Down
2 changes: 1 addition & 1 deletion sample-apps/react-native/dogfood/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stream-io/video-react-native-dogfood",
"version": "4.9.0",
"version": "4.9.1",
"private": true,
"scripts": {
"android": "react-native run-android",
Expand Down

0 comments on commit 48a0592

Please sign in to comment.