Configurable ending time and alert values

This commit is contained in:
Lucas Zawacki 2020-06-17 21:08:36 +00:00
parent a586c7db55
commit 3f16d894c3
4 changed files with 28 additions and 15 deletions

View File

@ -83,7 +83,8 @@ export default injectNotify(injectIntl(withTracker(({
notify, notify,
messageDuration, messageDuration,
timeEndedMessage, timeEndedMessage,
alertMessageUnderOneMinute, alertMessage,
alertUnderMinutes,
}) => { }) => {
const data = {}; const data = {};
if (breakoutRoom) { if (breakoutRoom) {
@ -104,7 +105,9 @@ export default injectNotify(injectIntl(withTracker(({
if (timeRemaining >= 0 && timeRemainingInterval) { if (timeRemaining >= 0 && timeRemainingInterval) {
if (timeRemaining > 0) { if (timeRemaining > 0) {
const time = getTimeRemaining(); const time = getTimeRemaining();
if (time === (1 * 60) && alertMessageUnderOneMinute) notify(alertMessageUnderOneMinute, 'info', 'rooms'); if (time === (alertUnderMinutes * 60) && alertMessage) {
notify(alertMessage, 'info', 'rooms');
}
data.message = intl.formatMessage(messageDuration, { 0: humanizeSeconds(time) }); data.message = intl.formatMessage(messageDuration, { 0: humanizeSeconds(time) });
} else { } else {
clearInterval(timeRemainingInterval); clearInterval(timeRemainingInterval);

View File

@ -30,6 +30,7 @@ const ENABLE_NETWORK_MONITORING = Meteor.settings.public.networkMonitoring.enabl
const HELP_LINK = METEOR_SETTINGS_APP.helpLink; const HELP_LINK = METEOR_SETTINGS_APP.helpLink;
const REMAINING_TIME_THRESHOLD = METEOR_SETTINGS_APP.remainingTimeThreshold; const REMAINING_TIME_THRESHOLD = METEOR_SETTINGS_APP.remainingTimeThreshold;
const REMAINING_TIME_ALERT_THRESHOLD = METEOR_SETTINGS_APP.remainingTimeAlertThreshold;
const intlMessages = defineMessages({ const intlMessages = defineMessages({
failedMessage: { failedMessage: {
@ -68,13 +69,13 @@ const intlMessages = defineMessages({
id: 'app.meeting.meetingTimeHasEnded', id: 'app.meeting.meetingTimeHasEnded',
description: 'Message that tells time has ended and meeting will close', description: 'Message that tells time has ended and meeting will close',
}, },
alertMeetingEndsUnderOneMinute: { alertMeetingEndsUnderMinutes: {
id: 'app.meeting.alertMeetingEndsUnderOneMinute', id: 'app.meeting.alertMeetingEndsUnderMinutes',
description: 'Alert that tells that the meeting end under a minute', description: 'Alert that tells that the meeting ends under x minutes',
}, },
alertBreakoutEndsUnderOneMinute: { alertBreakoutEndsUnderMinutes: {
id: 'app.meeting.alertBreakoutEndsUnderOneMinute', id: 'app.meeting.alertBreakoutEndsUnderMinutes',
description: 'Alert that tells that the breakout end under a minute', description: 'Alert that tells that the breakout ends under x minutes',
}, },
slowEffectiveConnectionDetected: { slowEffectiveConnectionDetected: {
id: 'app.network.connection.effective.slow', id: 'app.network.connection.effective.slow',
@ -183,6 +184,8 @@ export default injectIntl(withTracker(({ intl }) => {
const meetingId = Auth.meetingID; const meetingId = Auth.meetingID;
const breakouts = breakoutService.getBreakouts(); const breakouts = breakoutService.getBreakouts();
const msg = { id: `${intlMessages.alertBreakoutEndsUnderMinutes.id}${REMAINING_TIME_ALERT_THRESHOLD == 1 ? 'Singular' : 'Plural'}` };
if (breakouts.length > 0) { if (breakouts.length > 0) {
const currentBreakout = breakouts.find(b => b.breakoutId === meetingId); const currentBreakout = breakouts.find(b => b.breakoutId === meetingId);
@ -192,9 +195,10 @@ export default injectIntl(withTracker(({ intl }) => {
breakoutRoom={currentBreakout} breakoutRoom={currentBreakout}
messageDuration={intlMessages.breakoutTimeRemaining} messageDuration={intlMessages.breakoutTimeRemaining}
timeEndedMessage={intlMessages.breakoutWillClose} timeEndedMessage={intlMessages.breakoutWillClose}
alertMessageUnderOneMinute={ alertMessage={
intl.formatMessage(intlMessages.alertBreakoutEndsUnderOneMinute) intl.formatMessage(msg, {0: REMAINING_TIME_ALERT_THRESHOLD})
} }
alertUnderMinutes={REMAINING_TIME_ALERT_THRESHOLD}
/> />
); );
} }
@ -209,15 +213,18 @@ export default injectIntl(withTracker(({ intl }) => {
const { isBreakout } = Meeting.meetingProp; const { isBreakout } = Meeting.meetingProp;
const underThirtyMin = timeRemaining && timeRemaining <= (REMAINING_TIME_THRESHOLD * 60); const underThirtyMin = timeRemaining && timeRemaining <= (REMAINING_TIME_THRESHOLD * 60);
const msg = { id: `${intlMessages.alertMeetingEndsUnderMinutes.id}${REMAINING_TIME_ALERT_THRESHOLD == 1 ? 'Singular' : 'Plural'}` };
if (underThirtyMin && !isBreakout) { if (underThirtyMin && !isBreakout) {
data.message = ( data.message = (
<BreakoutRemainingTime <BreakoutRemainingTime
breakoutRoom={meetingTimeRemaining} breakoutRoom={meetingTimeRemaining}
messageDuration={intlMessages.meetingTimeRemaining} messageDuration={intlMessages.meetingTimeRemaining}
timeEndedMessage={intlMessages.meetingWillClose} timeEndedMessage={intlMessages.meetingWillClose}
alertMessageUnderOneMinute={ alertMessage={
intl.formatMessage(intlMessages.alertMeetingEndsUnderOneMinute) intl.formatMessage(msg, {0: REMAINING_TIME_ALERT_THRESHOLD})
} }
alertUnderMinutes={REMAINING_TIME_ALERT_THRESHOLD}
/> />
); );
} }

View File

@ -25,7 +25,8 @@ public:
ipv4FallbackDomain: "" ipv4FallbackDomain: ""
allowLogout: true allowLogout: true
allowFullscreen: true allowFullscreen: true
remainingTimeThreshold: 5 remainingTimeThreshold: 30
remainingTimeAlertThreshold: 1
defaultSettings: defaultSettings:
application: application:
animations: true animations: true

View File

@ -126,8 +126,10 @@
"app.meeting.meetingTimeRemaining": "Meeting time remaining: {0}", "app.meeting.meetingTimeRemaining": "Meeting time remaining: {0}",
"app.meeting.meetingTimeHasEnded": "Time ended. Meeting will close soon", "app.meeting.meetingTimeHasEnded": "Time ended. Meeting will close soon",
"app.meeting.endedMessage": "You will be forwarded back to the home screen", "app.meeting.endedMessage": "You will be forwarded back to the home screen",
"app.meeting.alertMeetingEndsUnderOneMinute": "Meeting is closing in a minute.", "app.meeting.alertMeetingEndsUnderMinutesSingular": "Meeting is closing in one minute.",
"app.meeting.alertBreakoutEndsUnderOneMinute": "Breakout is closing in a minute.", "app.meeting.alertMeetingEndsUnderMinutesPlural": "Meeting is closing in {0} minutes.",
"app.meeting.alertBreakoutEndsUnderMinutesSingular": "Breakout is closing in {0} minutes.",
"app.meeting.alertBreakoutEndsUnderMinutesPlural": "Breakout is closing in one minute.",
"app.presentation.hide": "Hide presentation", "app.presentation.hide": "Hide presentation",
"app.presentation.notificationLabel": "Current presentation", "app.presentation.notificationLabel": "Current presentation",
"app.presentation.slideContent": "Slide Content", "app.presentation.slideContent": "Slide Content",