cleanup UI for missed call messages in msg list

pull/1978/head
Audric Ackermann 4 years ago
parent 80aa672034
commit ae8688bf2a
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -7,10 +7,17 @@ import { PropsForMissedCallNotification } from '../../state/ducks/conversations'
import { getSelectedConversation } from '../../state/selectors/conversations'; import { getSelectedConversation } from '../../state/selectors/conversations';
import { ReadableMessage } from './ReadableMessage'; import { ReadableMessage } from './ReadableMessage';
const MissedCallContent = styled.div` export const StyledFakeMessageBubble = styled.div`
background-color: red; background: var(--color-fake-chat-bubble-background);
width: 100%; color: var(--color-text);
height: 30px;
width: 90%;
max-width: 700px;
margin: 10px auto;
padding: 5px 0px;
border-radius: 4px;
word-break: break-word;
text-align: center;
`; `;
export const MissedCallNotification = (props: PropsForMissedCallNotification) => { export const MissedCallNotification = (props: PropsForMissedCallNotification) => {
@ -30,7 +37,7 @@ export const MissedCallNotification = (props: PropsForMissedCallNotification) =>
isUnread={isUnread} isUnread={isUnread}
key={`readable-message-${messageId}`} key={`readable-message-${messageId}`}
> >
<MissedCallContent>{window.i18n('callMissed', displayName)}</MissedCallContent> <StyledFakeMessageBubble>{window.i18n('callMissed', displayName)}</StyledFakeMessageBubble>
</ReadableMessage> </ReadableMessage>
); );
}; };

@ -41,6 +41,8 @@ const StyledDraggableVideoElement = styled(StyledVideoElement)`
const DraggableCallWindowInner = styled.div` const DraggableCallWindowInner = styled.div`
cursor: pointer; cursor: pointer;
min-width: 85px;
min-height: 85px;
`; `;
const CenteredAvatarInDraggable = styled.div` const CenteredAvatarInDraggable = styled.div`

@ -124,7 +124,9 @@ function sendVideoStatusViaDataChannel() {
const stringToSend = JSON.stringify({ const stringToSend = JSON.stringify({
video: videoEnabledLocally, video: videoEnabledLocally,
}); });
dataChannel?.send(stringToSend); if (dataChannel && dataChannel.readyState === 'open') {
dataChannel?.send(stringToSend);
}
} }
export async function selectCameraByDeviceId(cameraDeviceId: string) { export async function selectCameraByDeviceId(cameraDeviceId: string) {
@ -276,7 +278,9 @@ async function openMediaDevicesAndAddTracks() {
const firstAudio = audioInputsList[0].deviceId; const firstAudio = audioInputsList[0].deviceId;
const firstVideo = camerasList[0].deviceId; const firstVideo = camerasList[0].deviceId;
window.log.info(`openMediaDevices video:${firstVideo} audio:${firstAudio}`); window.log.info(
`openMediaDevices videoDevice:${firstVideo}:${camerasList[0].label} audioDevice:${firstAudio}`
);
const devicesConfig = { const devicesConfig = {
audio: { audio: {
@ -385,7 +389,7 @@ function handleConnectionStateChanged(pubkey: string) {
} }
function closeVideoCall() { function closeVideoCall() {
window.log.info('closingVideoCall ', peerConnection); window.log.info('closingVideoCall ');
if (peerConnection) { if (peerConnection) {
peerConnection.ontrack = null; peerConnection.ontrack = null;
peerConnection.onicecandidate = null; peerConnection.onicecandidate = null;
@ -584,13 +588,18 @@ export function handleCallTypeEndCall(sender: string) {
callCache.delete(sender); callCache.delete(sender);
window.log.info('handling callMessage END_CALL'); window.log.info('handling callMessage END_CALL');
if (videoEventsListener) { const convos = getConversationController().getConversations();
videoEventsListener(null, null, [], [], true); const callingConvos = convos.filter(convo => convo.callState !== undefined);
if (callingConvos.length > 0) {
// we just got a end call event from whoever we are in a call with
if (callingConvos.length === 1 && callingConvos[0].id === sender) {
closeVideoCall();
if (videoEventsListener) {
videoEventsListener(null, null, [], [], true);
}
window.inboxStore?.dispatch(endCall({ pubkey: sender }));
}
} }
closeVideoCall();
//
// FIXME audric trigger UI cleanup
window.inboxStore?.dispatch(endCall({ pubkey: sender }));
} }
async function buildAnswerAndSendIt(sender: string) { async function buildAnswerAndSendIt(sender: string) {

@ -142,7 +142,7 @@ export function pushedMissedCall(conversationName: string) {
pushToastInfo( pushToastInfo(
'missedCall', 'missedCall',
window.i18n('callMissedTitle'), window.i18n('callMissedTitle'),
window.i18n('callMissedTitle', conversationName) window.i18n('callMissed', conversationName)
); );
} }

Loading…
Cancel
Save