remove none state on callState. instead set it to undefined

This commit is contained in:
Audric Ackermann 2021-11-15 14:48:03 +11:00
parent c1db4bf06d
commit 1203f1dc48
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4
4 changed files with 7 additions and 10 deletions

View File

@ -24,7 +24,6 @@ import { useModuloWithTripleDots } from '../../../hooks/useModuloWithTripleDots'
import { CallWindowControls } from './CallButtons';
import { SessionSpinner } from '../SessionSpinner';
import { DEVICE_DISABLED_DEVICE_ID } from '../../../session/utils/CallManager';
// import { useCallAudioLevel } from '../../../hooks/useCallAudioLevel';
const VideoContainer = styled.div`
height: 100%;
@ -146,8 +145,6 @@ export const InConversationCallContainer = () => {
isAudioOutputMuted,
} = useVideoCallEventsListener('InConversationCallContainer', true);
// const isSpeaking = useCallAudioLevel();
if (videoRefRemote?.current && videoRefLocal?.current) {
if (videoRefRemote.current.srcObject !== remoteStream) {
videoRefRemote.current.srcObject = remoteStream;

View File

@ -176,7 +176,7 @@ export const fillConvoAttributesWithDefaults = (
});
};
export type CallState = 'offering' | 'incoming' | 'connecting' | 'ongoing' | 'none' | undefined;
export type CallState = 'offering' | 'incoming' | 'connecting' | 'ongoing' | undefined;
export class ConversationModel extends Backbone.Model<ConversationAttributes> {
public updateLastMessage: () => any;

View File

@ -22,7 +22,6 @@ import { PubKey } from '../types';
import { v4 as uuidv4 } from 'uuid';
import { PnServer } from '../../pushnotification';
// import { SoundMeter } from '../../../ts/components/session/calling/SoundMeter';
import { setIsRinging } from './RingingManager';
export type InputItem = { deviceId: string; label: string };
@ -531,8 +530,9 @@ function closeVideoCall() {
selectedCameraId = DEVICE_DISABLED_DEVICE_ID;
selectedAudioInputId = DEVICE_DISABLED_DEVICE_ID;
currentCallUUID = undefined;
callVideoListeners();
window.inboxStore?.dispatch(setFullScreenCall(false));
callVideoListeners();
}
function onDataChannelReceivedMessage(ev: MessageEvent<string>) {

View File

@ -765,7 +765,7 @@ const conversationsSlice = createSlice({
incomingCall(state: ConversationsStateType, action: PayloadAction<{ pubkey: string }>) {
const callerPubkey = action.payload.pubkey;
const existingCallState = state.conversationLookup[callerPubkey].callState;
if (existingCallState !== undefined && existingCallState !== 'none') {
if (existingCallState !== undefined) {
return state;
}
const foundConvo = getConversationController().get(callerPubkey);
@ -784,7 +784,7 @@ const conversationsSlice = createSlice({
endCall(state: ConversationsStateType, action: PayloadAction<{ pubkey: string }>) {
const callerPubkey = action.payload.pubkey;
const existingCallState = state.conversationLookup[callerPubkey].callState;
if (!existingCallState || existingCallState === 'none') {
if (!existingCallState) {
return state;
}
@ -796,7 +796,7 @@ const conversationsSlice = createSlice({
// we have to update the model itself.
// not the db (as we dont want to store that field in it)
// and not the redux store directly as it gets overriden by the commit() of the conversationModel
foundConvo.callState = 'none';
foundConvo.callState = undefined;
void foundConvo.commit();
return state;
@ -840,7 +840,7 @@ const conversationsSlice = createSlice({
startingCallWith(state: ConversationsStateType, action: PayloadAction<{ pubkey: string }>) {
const callerPubkey = action.payload.pubkey;
const existingCallState = state.conversationLookup[callerPubkey].callState;
if (existingCallState && existingCallState !== 'none') {
if (existingCallState) {
return state;
}
const foundConvo = getConversationController().get(callerPubkey);