feat(conference): review remarks

This commit is contained in:
Calin-Teodor 2023-03-08 13:45:10 +02:00
parent c7062e5a4a
commit dc099eda44
1 changed files with 54 additions and 50 deletions

View File

@ -6,6 +6,7 @@ import { batch } from 'react-redux';
import { appNavigate } from '../app/actions';
import { IStore } from '../app/types';
import {
CONFERENCE_FAILED,
CONFERENCE_JOINED,
CONFERENCE_LEFT,
KICKED_OUT
@ -77,6 +78,13 @@ MiddlewareRegistry.register(store => next => action => {
break;
}
case CONFERENCE_FAILED: {
clearInterval(intervalId);
intervalId = null;
break;
}
}
return result;
@ -179,26 +187,25 @@ function _maybeDisplayCalendarNotification({ dispatch, getState }: IStore) {
let eventToShow;
if (eventList?.length) {
if (!calendarEnabled && reducedUI) {
return;
}
for (const event of eventList) {
const eventURL
= event?.url
&& getURLWithoutParamsNormalized(new URL(event.url));
= event?.url && getURLWithoutParamsNormalized(new URL(event.url));
if (eventURL && eventURL !== currentConferenceURL) {
// @ts-ignore
if ((!eventToShow && event.startDate > now
// @ts-ignore
&& event.startDate < now + ALERT_MILLISECONDS)
if ((!eventToShow && event.startDate > now && event.startDate < now + ALERT_MILLISECONDS)
// @ts-ignore
|| (event.startDate < now && event.endDate > now)) {
eventToShow = event;
}
}
}
}
if (calendarEnabled && !reducedUI) {
_calendarNotification(
{
dispatch,
@ -207,9 +214,6 @@ function _maybeDisplayCalendarNotification({ dispatch, getState }: IStore) {
);
}
return undefined;
}
/**
* Calendar notification.
*
@ -228,7 +232,10 @@ function _calendarNotification({ dispatch, getState }: IStore, eventToShow: any)
= locationURL ? getURLWithoutParamsNormalized(locationURL) : '';
const now = Date.now();
if (eventToShow) {
if (!eventToShow) {
return;
}
const customActionNameKey = [ 'notify.joinMeeting' ];
const customActionType = [ BUTTON_TYPES.PRIMARY ];
const customActionHandler = [ () => batch(() => {
@ -255,6 +262,3 @@ function _calendarNotification({ dispatch, getState }: IStore, eventToShow: any)
uid
}, NOTIFICATION_TIMEOUT_TYPE.STICKY));
}
return null;
}