From c7573701a20b4a29cd2b6fd08a55d4eff503f77f Mon Sep 17 00:00:00 2001 From: Santhosh Vaiyapuri <3846977+santhoshvai@users.noreply.github.com> Date: Mon, 9 Dec 2024 13:58:56 +0100 Subject: [PATCH 1/6] fix: avoid call.get in all call.ring events (#1615) As per spec ``` When the event is received, you need to ensure there is a WS connection open. If the connection needs to be opened, you also need to call call.get to fetch the latest state of the call object ``` Avoids confusion on support where users logging callingstate inform that they get left before ringing state --- packages/client/src/Call.ts | 25 ++++++++++++++++ packages/client/src/StreamVideoClient.ts | 36 +++++++++++------------- 2 files changed, 42 insertions(+), 19 deletions(-) diff --git a/packages/client/src/Call.ts b/packages/client/src/Call.ts index 8d22dcdb9..18595a5ac 100644 --- a/packages/client/src/Call.ts +++ b/packages/client/src/Call.ts @@ -26,6 +26,7 @@ import type { AcceptCallResponse, BlockUserRequest, BlockUserResponse, + CallRingEvent, CollectUserFeedbackRequest, CollectUserFeedbackResponse, Credentials, @@ -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. * diff --git a/packages/client/src/StreamVideoClient.ts b/packages/client/src/StreamVideoClient.ts index 354fc1e85..6eb29840f 100644 --- a/packages/client/src/StreamVideoClient.ts +++ b/packages/client/src/StreamVideoClient.ts @@ -263,7 +263,6 @@ export class StreamVideoClient { ); return; } - this.logger('info', `New call created and registered: ${call.cid}`); const newCall = new Call({ streamClient: this.streamClient, @@ -287,25 +286,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(); + } }), ); From aac61b0cabb89f4278aea2ac1bd811c0ad7cf81b Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot <> Date: Mon, 9 Dec 2024 13:02:08 +0000 Subject: [PATCH 2/6] chore(@stream-io/video-client): release version 1.11.15 --- packages/client/CHANGELOG.md | 7 +++++++ packages/client/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/client/CHANGELOG.md b/packages/client/CHANGELOG.md index 427f62b40..139cddf4d 100644 --- a/packages/client/CHANGELOG.md +++ b/packages/client/CHANGELOG.md @@ -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) diff --git a/packages/client/package.json b/packages/client/package.json index 699c9408c..aff810861 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@stream-io/video-client", - "version": "1.11.14", + "version": "1.11.15", "packageManager": "yarn@3.2.4", "main": "dist/index.cjs.js", "module": "dist/index.es.js", From 63bf825cc65ff722d87bd05fedcf0249c996cb66 Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot <> Date: Mon, 9 Dec 2024 13:02:38 +0000 Subject: [PATCH 3/6] chore(@stream-io/video-react-bindings): release version 1.2.9 --- packages/react-bindings/CHANGELOG.md | 5 +++++ packages/react-bindings/package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/react-bindings/CHANGELOG.md b/packages/react-bindings/CHANGELOG.md index d9ecd9a68..4f1fd108b 100644 --- a/packages/react-bindings/CHANGELOG.md +++ b/packages/react-bindings/CHANGELOG.md @@ -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 diff --git a/packages/react-bindings/package.json b/packages/react-bindings/package.json index e57f6b588..f4ba10095 100644 --- a/packages/react-bindings/package.json +++ b/packages/react-bindings/package.json @@ -1,6 +1,6 @@ { "name": "@stream-io/video-react-bindings", - "version": "1.2.8", + "version": "1.2.9", "packageManager": "yarn@3.2.4", "main": "./dist/index.cjs.js", "module": "./dist/index.es.js", From 7fa0705b4cdc7ee0717a7f4b0c1f90e0b827b51c Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot <> Date: Mon, 9 Dec 2024 13:02:49 +0000 Subject: [PATCH 4/6] chore(@stream-io/video-react-sdk): release version 1.8.0 --- packages/react-sdk/CHANGELOG.md | 11 +++++++++++ packages/react-sdk/package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/react-sdk/CHANGELOG.md b/packages/react-sdk/CHANGELOG.md index 81e705d63..69d80888a 100644 --- a/packages/react-sdk/CHANGELOG.md +++ b/packages/react-sdk/CHANGELOG.md @@ -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 diff --git a/packages/react-sdk/package.json b/packages/react-sdk/package.json index 1861efdb1..aecb52704 100644 --- a/packages/react-sdk/package.json +++ b/packages/react-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@stream-io/video-react-sdk", - "version": "1.7.30", + "version": "1.8.0", "packageManager": "yarn@3.2.4", "main": "./dist/index.cjs.js", "module": "./dist/index.es.js", From f79d7889e2652cea879d62922c31922778ad4fdc Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot <> Date: Mon, 9 Dec 2024 13:03:11 +0000 Subject: [PATCH 5/6] chore(@stream-io/video-react-native-sdk): release version 1.4.12 --- packages/react-native-sdk/CHANGELOG.md | 6 ++++++ packages/react-native-sdk/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/react-native-sdk/CHANGELOG.md b/packages/react-native-sdk/CHANGELOG.md index 0e752ddbc..ab02b5718 100644 --- a/packages/react-native-sdk/CHANGELOG.md +++ b/packages/react-native-sdk/CHANGELOG.md @@ -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 diff --git a/packages/react-native-sdk/package.json b/packages/react-native-sdk/package.json index a406fc503..c725af164 100644 --- a/packages/react-native-sdk/package.json +++ b/packages/react-native-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@stream-io/video-react-native-sdk", - "version": "1.4.11", + "version": "1.4.12", "packageManager": "yarn@3.2.4", "main": "dist/commonjs/index.js", "module": "dist/module/index.js", From 4543fe45dd8e1183afddb002a4262f8dfc3c1cbf Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot <> Date: Mon, 9 Dec 2024 13:03:36 +0000 Subject: [PATCH 6/6] chore(@stream-io/video-react-native-dogfood): release version 4.9.1 --- sample-apps/react-native/dogfood/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sample-apps/react-native/dogfood/package.json b/sample-apps/react-native/dogfood/package.json index f247f627b..6079943bb 100644 --- a/sample-apps/react-native/dogfood/package.json +++ b/sample-apps/react-native/dogfood/package.json @@ -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",