fix(notifications) Fix hiding audio/video lost notification

This commit is contained in:
hmuresan 2021-08-05 15:57:08 +03:00 committed by Horatiu Muresan
parent 46cbc0ff49
commit 6f41ef75d7
1 changed files with 6 additions and 9 deletions

View File

@ -227,7 +227,7 @@ export function noDataFromSource(track) {
* @returns {Function} * @returns {Function}
*/ */
export function showNoDataFromSourceVideoError(jitsiTrack) { export function showNoDataFromSourceVideoError(jitsiTrack) {
return (dispatch, getState) => { return async (dispatch, getState) => {
let notificationInfo; let notificationInfo;
const track = getTrackByJitsiTrack(getState()['features/base/tracks'], jitsiTrack); const track = getTrackByJitsiTrack(getState()['features/base/tracks'], jitsiTrack);
@ -239,12 +239,11 @@ export function showNoDataFromSourceVideoError(jitsiTrack) {
if (track.isReceivingData) { if (track.isReceivingData) {
notificationInfo = undefined; notificationInfo = undefined;
} else { } else {
const notificationAction = showErrorNotification({ const notificationAction = await dispatch(showErrorNotification({
descriptionKey: 'dialog.cameraNotSendingData', descriptionKey: 'dialog.cameraNotSendingData',
titleKey: 'dialog.cameraNotSendingDataTitle' titleKey: 'dialog.cameraNotSendingDataTitle'
}); }));
dispatch(notificationAction);
notificationInfo = { notificationInfo = {
uid: notificationAction.uid uid: notificationAction.uid
}; };
@ -362,7 +361,7 @@ function replaceStoredTracks(oldTrack, newTrack) {
* @returns {{ type: TRACK_ADDED, track: Track }} * @returns {{ type: TRACK_ADDED, track: Track }}
*/ */
export function trackAdded(track) { export function trackAdded(track) {
return (dispatch, getState) => { return async (dispatch, getState) => {
track.on( track.on(
JitsiTrackEvents.TRACK_MUTE_CHANGED, JitsiTrackEvents.TRACK_MUTE_CHANGED,
() => dispatch(trackMutedChanged(track))); () => dispatch(trackMutedChanged(track)));
@ -389,12 +388,10 @@ export function trackAdded(track) {
track.on(JitsiTrackEvents.NO_DATA_FROM_SOURCE, () => dispatch(noDataFromSource({ jitsiTrack: track }))); track.on(JitsiTrackEvents.NO_DATA_FROM_SOURCE, () => dispatch(noDataFromSource({ jitsiTrack: track })));
if (!isReceivingData) { if (!isReceivingData) {
if (mediaType === MEDIA_TYPE.AUDIO) { if (mediaType === MEDIA_TYPE.AUDIO) {
const notificationAction = showNotification({ const notificationAction = await dispatch(showNotification({
descriptionKey: 'dialog.micNotSendingData', descriptionKey: 'dialog.micNotSendingData',
titleKey: 'dialog.micNotSendingDataTitle' titleKey: 'dialog.micNotSendingDataTitle'
}); }));
dispatch(notificationAction);
// Set the notification ID so that other parts of the application know that this was // Set the notification ID so that other parts of the application know that this was
// displayed in the context of the current device. // displayed in the context of the current device.