diff --git a/packages/client/CHANGELOG.md b/packages/client/CHANGELOG.md index 2a04e2c2c7..75d143e023 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.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.11.0...@stream-io/video-client-1.11.1) (2024-11-14) + + +### Bug Fixes + +* reject was not called on timeout, decline and cancel scenarios ([#1576](https://github.com/GetStream/stream-video-js/issues/1576)) ([8be76a4](https://github.com/GetStream/stream-video-js/commit/8be76a447729aeba7f5c68f8a9bb85b4738cb76d)) + ## [1.11.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.10.5...@stream-io/video-client-1.11.0) (2024-11-13) diff --git a/packages/client/package.json b/packages/client/package.json index d15a9a179b..c3c4b2ab1b 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@stream-io/video-client", - "version": "1.11.0", + "version": "1.11.1", "packageManager": "yarn@3.2.4", "main": "dist/index.cjs.js", "module": "dist/index.es.js", diff --git a/packages/client/src/Call.ts b/packages/client/src/Call.ts index cf9e207893..7b51a12680 100644 --- a/packages/client/src/Call.ts +++ b/packages/client/src/Call.ts @@ -516,20 +516,15 @@ export class Call { await waitUntilCallJoined(); } - if (reject && this.ringing) { - // I'm the one who started the call, so I should cancel it. - const hasOtherParticipants = this.state.remoteParticipants.length > 0; - if ( - this.isCreatedByMe && - !hasOtherParticipants && - callingState === CallingState.RINGING - ) { - // Signals other users that I have cancelled my call to them - // before they accepted it. - await this.reject(); - } else if (callingState === CallingState.RINGING) { - // Signals other users that I have rejected the incoming call. - await this.reject(); + if (callingState === CallingState.RINGING) { + if (reject) { + await this.reject(reason); + } else { + const hasOtherParticipants = this.state.remoteParticipants.length > 0; + if (this.isCreatedByMe && !hasOtherParticipants) { + // I'm the one who started the call, so I should cancel it when there are no other participants. + await this.reject('cancel'); + } } } @@ -1960,13 +1955,16 @@ export class Call { // ignore if the call is not ringing if (this.state.callingState !== CallingState.RINGING) return; - const timeoutInMs = settings.ring.auto_cancel_timeout_ms; + const timeoutInMs = this.isCreatedByMe + ? settings.ring.auto_cancel_timeout_ms + : settings.ring.incoming_call_timeout_ms; + // 0 means no auto-drop if (timeoutInMs <= 0) return; clearTimeout(this.dropTimeout); this.dropTimeout = setTimeout(() => { - this.leave({ reason: 'ring: timeout' }).catch((err) => { + this.leave({ reject: true, reason: 'timeout' }).catch((err) => { this.logger('error', 'Failed to drop call', err); }); }, timeoutInMs); diff --git a/packages/react-bindings/CHANGELOG.md b/packages/react-bindings/CHANGELOG.md index b139f67b86..6b46cc58a8 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.1.18](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-1.1.17...@stream-io/video-react-bindings-1.1.18) (2024-11-14) + +### Dependency Updates + +* `@stream-io/video-client` updated to version `1.11.1` ## [1.1.17](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-1.1.16...@stream-io/video-react-bindings-1.1.17) (2024-11-13) ### Dependency Updates diff --git a/packages/react-bindings/package.json b/packages/react-bindings/package.json index 1ac26ff464..6884dd07e8 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.1.17", + "version": "1.1.18", "packageManager": "yarn@3.2.4", "main": "./dist/index.cjs.js", "module": "./dist/index.es.js", diff --git a/packages/react-native-sdk/CHANGELOG.md b/packages/react-native-sdk/CHANGELOG.md index c9e5720c7f..cb3bc8b8c4 100644 --- a/packages/react-native-sdk/CHANGELOG.md +++ b/packages/react-native-sdk/CHANGELOG.md @@ -2,6 +2,17 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +## [1.3.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-1.3.0...@stream-io/video-react-native-sdk-1.3.1) (2024-11-14) + +### Dependency Updates + +* `@stream-io/video-client` updated to version `1.11.1` +* `@stream-io/video-react-bindings` updated to version `1.1.18` + +### Bug Fixes + +* reject was not called on timeout, decline and cancel scenarios ([#1576](https://github.com/GetStream/stream-video-js/issues/1576)) ([8be76a4](https://github.com/GetStream/stream-video-js/commit/8be76a447729aeba7f5c68f8a9bb85b4738cb76d)) + ## [1.3.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-1.2.15...@stream-io/video-react-native-sdk-1.3.0) (2024-11-13) diff --git a/packages/react-native-sdk/package.json b/packages/react-native-sdk/package.json index 02d56543b4..cc7b8e1323 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.3.0", + "version": "1.3.1", "packageManager": "yarn@3.2.4", "main": "dist/commonjs/index.js", "module": "dist/module/index.js", diff --git a/packages/react-native-sdk/src/components/Call/CallControls/IncomingCallControls.tsx b/packages/react-native-sdk/src/components/Call/CallControls/IncomingCallControls.tsx index 57b74fe60b..bc376ff57c 100644 --- a/packages/react-native-sdk/src/components/Call/CallControls/IncomingCallControls.tsx +++ b/packages/react-native-sdk/src/components/Call/CallControls/IncomingCallControls.tsx @@ -28,7 +28,10 @@ export const IncomingCallControls = ({ } = useTheme(); return ( - + diff --git a/packages/react-native-sdk/src/components/Call/CallControls/OutgoingCallControls.tsx b/packages/react-native-sdk/src/components/Call/CallControls/OutgoingCallControls.tsx index 6651c517af..31e9638b41 100644 --- a/packages/react-native-sdk/src/components/Call/CallControls/OutgoingCallControls.tsx +++ b/packages/react-native-sdk/src/components/Call/CallControls/OutgoingCallControls.tsx @@ -1,9 +1,9 @@ import React from 'react'; import { StyleSheet, View } from 'react-native'; import { useTheme } from '../../../contexts'; -import { HangUpCallButton } from './HangupCallButton'; import { ToggleAudioPreviewButton } from './ToggleAudioPreviewButton'; import { ToggleVideoPreviewButton } from './ToggleVideoPreviewButton'; +import { RejectCallButton } from './RejectCallButton'; /** * Props for the OutgoingCallControls Component. @@ -32,9 +32,10 @@ export const OutgoingCallControls = ({ - ); diff --git a/packages/react-native-sdk/src/components/Call/CallControls/RejectCallButton.tsx b/packages/react-native-sdk/src/components/Call/CallControls/RejectCallButton.tsx index 3ffb7f32ae..4fd2d17a51 100644 --- a/packages/react-native-sdk/src/components/Call/CallControls/RejectCallButton.tsx +++ b/packages/react-native-sdk/src/components/Call/CallControls/RejectCallButton.tsx @@ -20,16 +20,32 @@ type RejectCallButtonProps = { * Note: If the `onPressHandler` is passed this handler will not be executed. */ onRejectCallHandler?: () => void; + /** + * Sets the height, width and border-radius (half the value) of the button. + */ + size?: React.ComponentProps['size']; + /** + * Optional: Reason for rejecting the call. + * Pass a predefined or a custom reason. + * There are four predefined reasons for rejecting the call: + - `busy` - when the callee is busy and cannot accept the call. + - `decline` - when the callee intentionally declines the call. + - `cancel` - when the caller cancels the call. + - `timeout` - when the **caller** or **callee** rejects the call after `auto_cancel_timeout_ms` or `incoming_call_timeout_ms` accordingly. + */ + rejectReason?: string; }; /** * Button to reject a call. * - * Mostly calls call.leave({ reject: true }) internally. + * Calls call.leave({ reject: true, reason: `OPTIONAL-REASON` }) internally. */ export const RejectCallButton = ({ onPressHandler, onRejectCallHandler, + size, + rejectReason, }: RejectCallButtonProps) => { const call = useCall(); const { useCallCallingState } = useCallStateHooks(); @@ -50,7 +66,7 @@ export const RejectCallButton = ({ if (callingState === CallingState.LEFT) { return; } - await call?.leave({ reject: true }); + await call?.leave({ reject: true, reason: rejectReason }); if (onRejectCallHandler) { onRejectCallHandler(); } @@ -64,7 +80,7 @@ export const RejectCallButton = ({ { <> call.leave({ reject: true })} + onClick={() => { + const reason = call.isCreatedByMe ? 'cancel' : 'decline'; + call.leave({ reject: true, reason }); + }} disabled={buttonsDisabled} /> diff --git a/sample-apps/react-native/dogfood/package.json b/sample-apps/react-native/dogfood/package.json index de75f4767b..20a176ce98 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.5.0", + "version": "4.5.1", "private": true, "scripts": { "android": "react-native run-android",