浏览代码

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

* feat(conference): created action that dismisses calendar notification
factor2
Calinteodor 2 年前
父节点
当前提交
238def34cf
没有帐户链接到提交者的电子邮件

+ 1
- 0
lang/main.json 查看文件

@@ -675,6 +675,7 @@
675 675
         "dataChannelClosedDescription": "The bridge channel has been disconnected and thus video quality is limited to its lowest setting.",
676 676
         "disconnected": "disconnected",
677 677
         "displayNotifications": "Display notifications for",
678
+        "dontRemindMe": "Do not remind me",
678 679
         "focus": "Conference focus",
679 680
         "focusFail": "{{component}} not available - retry in {{ms}} sec",
680 681
         "gifsMenu": "GIPHY",

+ 8
- 0
react/features/conference/actionTypes.ts 查看文件

@@ -0,0 +1,8 @@
1
+/**
2
+ * The type of (redux) action which dismisses calendar notification.
3
+ *
4
+ * {
5
+ *     type: DISMISS_CALENDAR_NOTIFICATION
6
+ * }
7
+ */
8
+export const DISMISS_CALENDAR_NOTIFICATION = 'DISMISS_CALENDAR_NOTIFICATION';

+ 14
- 0
react/features/conference/actions.native.ts 查看文件

@@ -5,6 +5,9 @@ import { openDialog } from '../base/dialog/actions';
5 5
 import { AlertDialog } from '../base/dialog/components/native';
6 6
 import { getParticipantDisplayName } from '../base/participants/functions';
7 7
 
8
+import { DISMISS_CALENDAR_NOTIFICATION } from './actionTypes';
9
+
10
+
8 11
 /**
9 12
  * Notify that we've been kicked out of the conference.
10 13
  *
@@ -32,3 +35,14 @@ export function notifyKickedOut(participant: any, submit?: Function) {
32 35
         }));
33 36
     };
34 37
 }
38
+
39
+/**
40
+ * Dismisses calendar notification about next or ongoing event.
41
+ *
42
+ * @returns {Object}
43
+ */
44
+export function dismissCalendarNotification() {
45
+    return {
46
+        type: DISMISS_CALENDAR_NOTIFICATION
47
+    };
48
+}

+ 13
- 0
react/features/conference/actions.web.ts 查看文件

@@ -3,6 +3,8 @@ import { getParticipantDisplayName } from '../base/participants/functions';
3 3
 import { showNotification } from '../notifications/actions';
4 4
 import { NOTIFICATION_TIMEOUT_TYPE, NOTIFICATION_TYPE } from '../notifications/constants';
5 5
 
6
+import { DISMISS_CALENDAR_NOTIFICATION } from './actionTypes';
7
+
6 8
 /**
7 9
  * Notify that we've been kicked out of the conference.
8 10
  *
@@ -32,3 +34,14 @@ export function notifyKickedOut(participant: any, _?: Function) {
32 34
         }, NOTIFICATION_TIMEOUT_TYPE.STICKY));
33 35
     };
34 36
 }
37
+
38
+/**
39
+ * Dismisses calendar notification about next or ongoing event.
40
+ *
41
+ * @returns {Object}
42
+ */
43
+export function dismissCalendarNotification() {
44
+    return {
45
+        type: DISMISS_CALENDAR_NOTIFICATION
46
+    };
47
+}

+ 14
- 11
react/features/conference/middleware.ts 查看文件

@@ -36,10 +36,12 @@ import {
36 36
 import { showSalesforceNotification } from '../salesforce/actions';
37 37
 import { setToolboxEnabled } from '../toolbox/actions.any';
38 38
 
39
+import { DISMISS_CALENDAR_NOTIFICATION } from './actionTypes';
39 40
 // @ts-ignore
40
-import { notifyKickedOut } from './actions';
41
+import { dismissCalendarNotification, notifyKickedOut } from './actions';
41 42
 
42
-let intervalId: any;
43
+
44
+let intervalID: any;
43 45
 
44 46
 
45 47
 MiddlewareRegistry.register(store => next => action => {
@@ -72,10 +74,11 @@ MiddlewareRegistry.register(store => next => action => {
72 74
         break;
73 75
     }
74 76
 
77
+    case DISMISS_CALENDAR_NOTIFICATION:
75 78
     case CONFERENCE_LEFT:
76 79
     case CONFERENCE_FAILED: {
77
-        clearInterval(intervalId);
78
-        intervalId = null;
80
+        clearInterval(intervalID);
81
+        intervalID = null;
79 82
 
80 83
         break;
81 84
     }
@@ -146,8 +149,8 @@ function _conferenceJoined({ dispatch, getState }: IStore) {
146 149
         getState
147 150
     });
148 151
 
149
-    if (!intervalId) {
150
-        intervalId = setInterval(() =>
152
+    if (!intervalID) {
153
+        intervalID = setInterval(() =>
151 154
             _maybeDisplayCalendarNotification({
152 155
                 dispatch,
153 156
                 getState
@@ -232,20 +235,20 @@ function _calendarNotification({ dispatch, getState }: IStore, eventToShow: any)
232 235
         return;
233 236
     }
234 237
 
235
-    const customActionNameKey = [ 'notify.joinMeeting' ];
236
-    const customActionType = [ BUTTON_TYPES.PRIMARY ];
238
+    const customActionNameKey = [ 'notify.joinMeeting', 'notify.dontRemindMe' ];
239
+    const customActionType = [ BUTTON_TYPES.PRIMARY, BUTTON_TYPES.DESTRUCTIVE ];
237 240
     const customActionHandler = [ () => batch(() => {
238 241
         dispatch(hideNotification(CALENDAR_NOTIFICATION_ID));
239 242
         if (eventToShow?.url && (eventToShow.url !== currentConferenceURL)) {
240 243
             dispatch(appNavigate(eventToShow.url));
241 244
         }
242
-    }) ];
245
+    }), () => dispatch(dismissCalendarNotification()) ];
243 246
     const description
244 247
         = getLocalizedDateFormatter(eventToShow.startDate).fromNow();
245 248
     const icon = NOTIFICATION_ICON.WARNING;
246 249
     const title = (eventToShow.startDate < now) && (eventToShow.endDate > now)
247
-        ? i18n.t('calendarSync.ongoingMeeting')
248
-        : i18n.t('calendarSync.nextMeeting');
250
+        ? `${i18n.t('calendarSync.ongoingMeeting')}: ${eventToShow.title}`
251
+        : `${i18n.t('calendarSync.nextMeeting')}: ${eventToShow.title}`;
249 252
     const uid = CALENDAR_NOTIFICATION_ID;
250 253
 
251 254
     dispatch(showNotification({

正在加载...
取消
保存