Skip to content

Commit

Permalink
Merge branch 'main' into PBE-5855-feat/react-native-video-design-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
kristian-mkd committed Nov 14, 2024
2 parents 0feb527 + bcac386 commit bc06a89
Show file tree
Hide file tree
Showing 15 changed files with 79 additions and 29 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.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)


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.0",
"version": "1.11.1",
"packageManager": "[email protected]",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
Expand Down
30 changes: 14 additions & 16 deletions packages/client/src/Call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
}

Expand Down Expand Up @@ -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);
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.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
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.1.17",
"version": "1.1.18",
"packageManager": "[email protected]",
"main": "./dist/index.cjs.js",
"module": "./dist/index.es.js",
Expand Down
11 changes: 11 additions & 0 deletions packages/react-native-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.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)


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.3.0",
"version": "1.3.1",
"packageManager": "[email protected]",
"main": "dist/commonjs/index.js",
"module": "dist/module/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ export const IncomingCallControls = ({
} = useTheme();
return (
<View style={[styles.buttonGroup, incomingCall.buttonGroup]}>
<RejectCallButton onPressHandler={onRejectCallHandler} />
<RejectCallButton
onPressHandler={onRejectCallHandler}
rejectReason="decline"
/>
<ToggleVideoPreviewButton />
<AcceptCallButton onPressHandler={onAcceptCallHandler} />
</View>
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -32,9 +32,10 @@ export const OutgoingCallControls = ({
<ToggleAudioPreviewButton />
<ToggleVideoPreviewButton />
</View>
<HangUpCallButton
<RejectCallButton
onPressHandler={onHangupCallHandler}
size={buttonSizes.md}
rejectReason="cancel"
/>
</View>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof CallControlsButton>['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();
Expand All @@ -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();
}
Expand All @@ -64,7 +80,7 @@ export const RejectCallButton = ({
<CallControlsButton
onPress={rejectCallHandler}
color={colors.iconAlertWarning}
size={buttonSizes.lg}
size={size ?? buttonSizes.lg}
// TODO: check what to do about this random style prop
// svgContainerStyle={theme.icon.lg}
style={rejectCallButton}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-sdk/src/utils/push/internal/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const processCallFromPush = async (
}
await callFromPush.join();
} else if (action === 'decline') {
await callFromPush.leave({ reject: true });
await callFromPush.leave({ reject: true, reason: 'decline' });
}
} catch (e) {
const logger = getLogger(['processCallFromPush']);
Expand Down
6 changes: 6 additions & 0 deletions packages/react-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.7.16](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.7.15...@stream-io/video-react-sdk-1.7.16) (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`
## [1.7.15](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.7.14...@stream-io/video-react-sdk-1.7.15) (2024-11-13)


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.15",
"version": "1.7.16",
"packageManager": "[email protected]",
"main": "./dist/index.cjs.js",
"module": "./dist/index.es.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ export const RingingCallControls = () => {
<>
<AcceptCallButton disabled={buttonsDisabled} />
<CancelCallButton
onClick={() => call.leave({ reject: true })}
onClick={() => {
const reason = call.isCreatedByMe ? 'cancel' : 'decline';
call.leave({ reject: true, reason });
}}
disabled={buttonsDisabled}
/>
</>
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.5.0",
"version": "4.5.1",
"private": true,
"scripts": {
"android": "react-native run-android",
Expand Down

0 comments on commit bc06a89

Please sign in to comment.