Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(conference): dismiss calendar notification (#13050)

Calinteodor238def34cf47
diff --git a/lang/main.json b/lang/main.json
index 77ca521c1e..035cf025bf 100644
--- a/lang/main.json
+++ b/lang/main.json
@@ -675,6 +675,7 @@
"dataChannelClosedDescription": "The bridge channel has been disconnected and thus video quality is limited to its lowest setting.",
"disconnected": "disconnected",
"displayNotifications": "Display notifications for",
+ "dontRemindMe": "Do not remind me",
"focus": "Conference focus",
"focusFail": "{{component}} not available - retry in {{ms}} sec",
"gifsMenu": "GIPHY",
diff --git a/react/features/conference/actionTypes.ts b/react/features/conference/actionTypes.ts
new file mode 100644
index 0000000000..bcbbd582a0
--- /dev/null
+++ b/react/features/conference/actionTypes.ts
@@ -0,0 +1,8 @@
+/**
+ * The type of (redux) action which dismisses calendar notification.
+ *
+ * {
+ * type: DISMISS_CALENDAR_NOTIFICATION
+ * }
+ */
+export const DISMISS_CALENDAR_NOTIFICATION = 'DISMISS_CALENDAR_NOTIFICATION';
diff --git a/react/features/conference/actions.native.ts b/react/features/conference/actions.native.ts
index 14a091ccb6..87985b9b93 100644
--- a/react/features/conference/actions.native.ts
+++ b/react/features/conference/actions.native.ts
@@ -5,6 +5,9 @@ import { openDialog } from '../base/dialog/actions';
import { AlertDialog } from '../base/dialog/components/native';
import { getParticipantDisplayName } from '../base/participants/functions';
+import { DISMISS_CALENDAR_NOTIFICATION } from './actionTypes';
+
+
/**
* Notify that we've been kicked out of the conference.
*
@@ -32,3 +35,14 @@ export function notifyKickedOut(participant: any, submit?: Function) {
}));
};
}
+
+/**
+ * Dismisses calendar notification about next or ongoing event.
+ *
+ * @returns {Object}
+ */
+export function dismissCalendarNotification() {
+ return {
+ type: DISMISS_CALENDAR_NOTIFICATION
+ };
+}
diff --git a/react/features/conference/actions.web.ts b/react/features/conference/actions.web.ts
index b1d42237e6..f01c89a6c0 100644
--- a/react/features/conference/actions.web.ts
+++ b/react/features/conference/actions.web.ts
@@ -3,6 +3,8 @@ import { getParticipantDisplayName } from '../base/participants/functions';
import { showNotification } from '../notifications/actions';
import { NOTIFICATION_TIMEOUT_TYPE, NOTIFICATION_TYPE } from '../notifications/constants';
+import { DISMISS_CALENDAR_NOTIFICATION } from './actionTypes';
+
/**
* Notify that we've been kicked out of the conference.
*
@@ -32,3 +34,14 @@ export function notifyKickedOut(participant: any, _?: Function) {
}, NOTIFICATION_TIMEOUT_TYPE.STICKY));
};
}
+
+/**
+ * Dismisses calendar notification about next or ongoing event.
+ *
+ * @returns {Object}
+ */
+export function dismissCalendarNotification() {
+ return {
+ type: DISMISS_CALENDAR_NOTIFICATION
+ };
+}
diff --git a/react/features/conference/middleware.ts b/react/features/conference/middleware.ts
index 7dc9db80ab..b9f5a4b0fd 100644
--- a/react/features/conference/middleware.ts
+++ b/react/features/conference/middleware.ts
@@ -36,10 +36,12 @@ import {
import { showSalesforceNotification } from '../salesforce/actions';
import { setToolboxEnabled } from '../toolbox/actions.any';
+import { DISMISS_CALENDAR_NOTIFICATION } from './actionTypes';
// @ts-ignore
-import { notifyKickedOut } from './actions';
+import { dismissCalendarNotification, notifyKickedOut } from './actions';
-let intervalId: any;
+
+let intervalID: any;
MiddlewareRegistry.register(store => next => action => {
@@ -72,10 +74,11 @@ MiddlewareRegistry.register(store => next => action => {
break;
}
+ case DISMISS_CALENDAR_NOTIFICATION:
case CONFERENCE_LEFT:
case CONFERENCE_FAILED: {
- clearInterval(intervalId);
- intervalId = null;
+ clearInterval(intervalID);
+ intervalID = null;
break;
}
@@ -146,8 +149,8 @@ function _conferenceJoined({ dispatch, getState }: IStore) {
getState
});
- if (!intervalId) {
- intervalId = setInterval(() =>
+ if (!intervalID) {
+ intervalID = setInterval(() =>
_maybeDisplayCalendarNotification({
dispatch,
getState
@@ -232,20 +235,20 @@ function _calendarNotification({ dispatch, getState }: IStore, eventToShow: any)
return;
}
- const customActionNameKey = [ 'notify.joinMeeting' ];
- const customActionType = [ BUTTON_TYPES.PRIMARY ];
+ const customActionNameKey = [ 'notify.joinMeeting', 'notify.dontRemindMe' ];
+ const customActionType = [ BUTTON_TYPES.PRIMARY, BUTTON_TYPES.DESTRUCTIVE ];
const customActionHandler = [ () => batch(() => {
dispatch(hideNotification(CALENDAR_NOTIFICATION_ID));
if (eventToShow?.url && (eventToShow.url !== currentConferenceURL)) {
dispatch(appNavigate(eventToShow.url));
}
- }) ];
+ }), () => dispatch(dismissCalendarNotification()) ];
const description
= getLocalizedDateFormatter(eventToShow.startDate).fromNow();
const icon = NOTIFICATION_ICON.WARNING;
const title = (eventToShow.startDate < now) && (eventToShow.endDate > now)
- ? i18n.t('calendarSync.ongoingMeeting')
- : i18n.t('calendarSync.nextMeeting');
+ ? `${i18n.t('calendarSync.ongoingMeeting')}: ${eventToShow.title}`
+ : `${i18n.t('calendarSync.nextMeeting')}: ${eventToShow.title}`;
const uid = CALENDAR_NOTIFICATION_ID;
dispatch(showNotification({