Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(time-timer): React Native port of the meeting-pace timer (#17690)
David Szabo8e3741c82358
diff --git a/ios/Podfile.lock b/ios/Podfile.lockindex 453877fd51..edce7551fc 100644--- a/ios/Podfile.lock+++ b/ios/Podfile.lock@@ -2202,6 +2202,8 @@ PODS:- ReactCommon/turbomodule/core- SocketRocket- Yoga+ - react-native-screen-corner-radius (0.2.3):+ - React- react-native-slider (5.1.2):- boost- DoubleConversion@@ -3289,6 +3291,7 @@ DEPENDENCIES:- react-native-pager-view (from `../node_modules/react-native-pager-view`)- react-native-performance (from `../node_modules/react-native-performance`)- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)+ - react-native-screen-corner-radius (from `../node_modules/react-native-screen-corner-radius`)- "react-native-slider (from `../node_modules/@react-native-community/slider`)"- react-native-video (from `../node_modules/react-native-video`)- react-native-webrtc (from `../node_modules/react-native-webrtc`)@@ -3474,6 +3477,8 @@ EXTERNAL SOURCES::path: "../node_modules/react-native-performance"react-native-safe-area-context::path: "../node_modules/react-native-safe-area-context"+ react-native-screen-corner-radius:+ :path: "../node_modules/react-native-screen-corner-radius"react-native-slider::path: "../node_modules/@react-native-community/slider"react-native-video:@@ -3650,6 +3655,7 @@ SPEC CHECKSUMS:react-native-pager-view: f8f63370fc0f4174f7510863b4812b8e034d2d0dreact-native-performance: b48d1aba7501a54af5e1a7efb0dab1ab25dc734freact-native-safe-area-context: c6e2edd1c1da07bdce287fa9d9e60c5f7b514616+ react-native-screen-corner-radius: ebd0d3258fcc894571b41d25ee3db7569d375153react-native-slider: 34064ca1a6864d7b263e44dd76a2d794e8d26744react-native-video: ce907959c67ad2abaa0411082db621036944737areact-native-webrtc: da75ba1f85a36981cbcb3fdae7dfbab7ad63c040diff --git a/package-lock.json b/package-lock.jsonindex 0ac35d6662..dae0069477 100644--- a/package-lock.json+++ b/package-lock.json@@ -98,6 +98,7 @@"react-native-paper": "5.14.5","react-native-performance": "6.0.0","react-native-safe-area-context": "5.6.1",+ "react-native-screen-corner-radius": "0.2.3","react-native-screens": "4.17.1","react-native-sound": "https://github.com/jitsi/react-native-sound.git#bc92152667a628120374c1324fc9e44f697c3192","react-native-splash-view": "0.0.18",@@ -22257,6 +22258,16 @@"react-native": "*"}},+ "node_modules/react-native-screen-corner-radius": {+ "version": "0.2.3",+ "resolved": "https://registry.npmjs.org/react-native-screen-corner-radius/-/react-native-screen-corner-radius-0.2.3.tgz",+ "integrity": "sha512-8JgiHI/S2Xf6swquEjopHW//wI4a/nV/dEImJMR8YXQVWVdnjbhcMi0NGk1s1cW8xuunwlFT173PozsS3Gvgxg==",+ "license": "MIT",+ "peerDependencies": {+ "react": "*",+ "react-native": "*"+ }+ },"node_modules/react-native-screens": {"version": "4.17.1","resolved": "https://registry.npmjs.org/react-native-screens/-/react-native-screens-4.17.1.tgz",@@ -42460,6 +42471,11 @@"resolved": "https://registry.npmjs.org/react-native-safe-area-context/-/react-native-safe-area-context-5.6.1.tgz","integrity": "sha512-/wJE58HLEAkATzhhX1xSr+fostLsK8Q97EfpfMDKo8jlOc1QKESSX/FQrhk7HhQH/2uSaox4Y86sNaI02kteiA=="},+ "react-native-screen-corner-radius": {+ "version": "0.2.3",+ "resolved": "https://registry.npmjs.org/react-native-screen-corner-radius/-/react-native-screen-corner-radius-0.2.3.tgz",+ "integrity": "sha512-8JgiHI/S2Xf6swquEjopHW//wI4a/nV/dEImJMR8YXQVWVdnjbhcMi0NGk1s1cW8xuunwlFT173PozsS3Gvgxg=="+ },"react-native-screens": {"version": "4.17.1","resolved": "https://registry.npmjs.org/react-native-screens/-/react-native-screens-4.17.1.tgz",diff --git a/package.json b/package.jsonindex 3a64cc4015..0e981b94ff 100644--- a/package.json+++ b/package.json@@ -104,6 +104,7 @@"react-native-paper": "5.14.5","react-native-performance": "6.0.0","react-native-safe-area-context": "5.6.1",+ "react-native-screen-corner-radius": "0.2.3","react-native-screens": "4.17.1","react-native-sound": "https://github.com/jitsi/react-native-sound.git#bc92152667a628120374c1324fc9e44f697c3192","react-native-splash-view": "0.0.18",diff --git a/react/features/app/middlewares.any.ts b/react/features/app/middlewares.any.tsindex 33844f65ce..232fdf0e19 100644--- a/react/features/app/middlewares.any.ts+++ b/react/features/app/middlewares.any.ts@@ -47,6 +47,7 @@ import '../room-lock/middleware';import '../rtcstats/middleware';import '../speaker-stats/middleware';import '../subtitles/middleware';+import '../time-timer/middleware';import '../transcribing/middleware';import '../video-layout/middleware';import '../video-quality/middleware';diff --git a/react/features/app/middlewares.web.ts b/react/features/app/middlewares.web.tsindex 829671adb0..19fd8db9fb 100644--- a/react/features/app/middlewares.web.ts+++ b/react/features/app/middlewares.web.ts@@ -26,7 +26,6 @@ import '../talk-while-muted/middleware';import '../toolbox/middleware';import '../face-landmarks/middleware';import '../gifs/middleware';-import '../time-timer/middleware.web';import '../whiteboard/middleware.web';import '../file-sharing/middleware.web';import '../custom-panel/middleware.web';diff --git a/react/features/app/reducers.native.ts b/react/features/app/reducers.native.tsindex 2d84940c90..902547b0b8 100644--- a/react/features/app/reducers.native.ts+++ b/react/features/app/reducers.native.ts@@ -3,6 +3,7 @@ import '../mobile/background/reducer';import '../mobile/call-integration/reducer';import '../mobile/external-api/reducer';import '../share-room/reducer';+import '../time-timer/reducer';import './reducer.native';diff --git a/react/features/base/ui/Tokens.ts b/react/features/base/ui/Tokens.tsindex 4e181d67ea..8c4c1056fe 100644--- a/react/features/base/ui/Tokens.ts+++ b/react/features/base/ui/Tokens.ts@@ -386,6 +386,21 @@ export const colorMap = {conferenceRaisedHandLabelText: 'uiBackground', // Raised hands count label textconferenceRaisedHandLabelIcon: 'surface01', // Raised hands count label icon+ // Time-timer pill+ timeTimerNameSegmentBackground: 'timeTimerNameSegment',+ timeTimerTimerSegmentBackground: 'timeTimerTimerSegment',+ timeTimerElapsedText: 'timeTimerElapsedText',+ timeTimerDisk: 'timeTimerDisk',+ timeTimerWarning: 'timeTimerWarning',+ timeTimerWarningNameSegmentBackground: 'timeTimerWarningNameSegment',+ timeTimerWarningTimerSegmentBackground: 'timeTimerWarningTimerSegment',+ timeTimerExpiredText: 'timeTimerExpiredText',+ timeTimerExpiredNameSegmentBackground: 'timeTimerExpiredNameSegment',+ timeTimerExpiredTimerSegmentBackground: 'timeTimerExpiredTimerSegment',+ timeTimerExpiredDisk: 'timeTimerExpiredDisk',+ timeTimerExpiredOverrunEdge: 'timeTimerExpiredOverrunEdge',+ timeTimerExpiredNotificationText: 'timeTimerExpiredNotificationText',+// Subtitle MessagessubtitleMessageBackground: 'ui02', // Subtitle message backgroundsubtitleMessageText: 'text01', // Subtitle message textdiff --git a/react/features/base/ui/tokens.json b/react/features/base/ui/tokens.jsonindex 7139d9d4c8..dcb719f118 100644--- a/react/features/base/ui/tokens.json+++ b/react/features/base/ui/tokens.json@@ -179,6 +179,20 @@"textColor09": "#000000","textColor10": "#E7E3FF",+ "timeTimerDisk": "#1084FE",+ "timeTimerElapsedText": "#82C3FE",+ "timeTimerExpiredDisk": "#F24D5F",+ "timeTimerExpiredNameSegment": "#4F2627",+ "timeTimerExpiredNotificationText": "#D83848",+ "timeTimerExpiredOverrunEdge": "#8E2530",+ "timeTimerExpiredText": "#FF9DA0",+ "timeTimerExpiredTimerSegment": "#3E1D1E",+ "timeTimerNameSegment": "#1F3057",+ "timeTimerTimerSegment": "#1A2542",+ "timeTimerWarning": "#F8AE1A",+ "timeTimerWarningNameSegment": "#3C2E1D",+ "timeTimerWarningTimerSegment": "#302417",+"ui01": "#666666","ui02": "#3D3D3D","ui03": "#858585",diff --git a/react/features/base/ui/types.ts b/react/features/base/ui/types.tsindex 5c3e809330..3494db94ef 100644--- a/react/features/base/ui/types.ts+++ b/react/features/base/ui/types.ts@@ -185,6 +185,19 @@ export interface IPalette {thumbnailRaisedHandIcon: string;thumbnailTintBackground: string;thumbnailVideoBackground: string;+ timeTimerDisk: string;+ timeTimerElapsedText: string;+ timeTimerExpiredDisk: string;+ timeTimerExpiredNameSegmentBackground: string;+ timeTimerExpiredNotificationText: string;+ timeTimerExpiredOverrunEdge: string;+ timeTimerExpiredText: string;+ timeTimerExpiredTimerSegmentBackground: string;+ timeTimerNameSegmentBackground: string;+ timeTimerTimerSegmentBackground: string;+ timeTimerWarning: string;+ timeTimerWarningNameSegmentBackground: string;+ timeTimerWarningTimerSegmentBackground: string;toolbarButton: string;toolbarButtonActive: string;toolbarButtonHover: string;diff --git a/react/features/calendar-sync/components/CalendarListContent.native.tsx b/react/features/calendar-sync/components/CalendarListContent.native.tsxindex b5d3008d10..e467b01715 100644--- a/react/features/calendar-sync/components/CalendarListContent.native.tsx+++ b/react/features/calendar-sync/components/CalendarListContent.native.tsx@@ -9,6 +9,8 @@ import { IReduxState, IStore } from '../../app/types';import { getLocalizedDateFormatter } from '../../base/i18n/dateUtil';import { translate } from '../../base/i18n/functions';import NavigateSectionList from '../../base/react/components/native/NavigateSectionList';+import { setCalendarTimerDuration } from '../../time-timer/actions';+import { computeCalendarTimerDuration } from '../../time-timer/functions';import { openUpdateCalendarEventDialog, refreshCalendar } from '../actions.native';@@ -111,6 +113,25 @@ class CalendarListContent extends Component<IProps> {_onPress(url: string, analyticsEventName = 'meeting.tile') {sendAnalytics(createCalendarClickedEvent(analyticsEventName));+ // Find the event being joined and, if it has a parseable start + end,+ // record its duration for the time-timer keyed to this URL. The+ // middleware only applies it when the joined conference matches that+ // URL, so opening a meeting and bailing out cannot leak its duration+ // into a different meeting joined afterwards.+ const event = this.props._eventList?.find((e: any) => e.url === url);+ const duration = computeCalendarTimerDuration(event);++ if (duration) {+ this.props.dispatch(setCalendarTimerDuration(+ duration.durationSeconds,+ {+ startTimeUnix: duration.startTimeUnix,+ url+ }));+ } else {+ this.props.dispatch(setCalendarTimerDuration(undefined));+ }+this.props.dispatch(appNavigate(url));}diff --git a/react/features/calendar-sync/components/CalendarListContent.web.tsx b/react/features/calendar-sync/components/CalendarListContent.web.tsxindex 5c18644fd9..1c5a87f97a 100644--- a/react/features/calendar-sync/components/CalendarListContent.web.tsx+++ b/react/features/calendar-sync/components/CalendarListContent.web.tsx@@ -7,19 +7,23 @@ import { appNavigate } from '../../app/actions.web';import { IReduxState, IStore } from '../../app/types';import MeetingsList from '../../base/react/components/web/MeetingsList';import { setCalendarTimerDuration } from '../../time-timer/actions';+import { computeCalendarTimerDuration } from '../../time-timer/functions';import AddMeetingUrlButton from './AddMeetingUrlButton.web';import JoinButton from './JoinButton.web';/*** A calendar event, limited to the fields this component reads. Mirrors the- * shape stored in {@code features/calendar-sync}: the dates are ISO strings.+ * shape stored in {@code features/calendar-sync}: {@code startDate}/+ * {@code endDate} are already epoch-millisecond numbers by the time an event+ * reaches redux (parsed by {@code _parseCalendarEntry} in+ * calendar-sync/functions.any.ts), not ISO strings.*/interface ICalendarEvent {calendarId?: string;- endDate?: string;+ endDate?: number;id?: string;- startDate?: string;+ startDate?: number;title?: string;url?: string;}@@ -138,14 +142,13 @@ class CalendarListContent extends Component<IProps> {// URL, so opening a meeting and bailing at prejoin cannot leak its// duration into a different meeting joined afterwards.const event: ICalendarEvent | undefined = this.props._eventList?.find(e => e.url === url);- const startUnix = event?.startDate ? Date.parse(event.startDate) : NaN;- const endUnix = event?.endDate ? Date.parse(event.endDate) : NaN;+ const duration = computeCalendarTimerDuration(event);- if (!isNaN(startUnix) && !isNaN(endUnix) && endUnix > startUnix) {+ if (duration) {this.props.dispatch(setCalendarTimerDuration(- Math.round((endUnix - startUnix) / 1000),+ duration.durationSeconds,{- startTimeUnix: startUnix,+ startTimeUnix: duration.startTimeUnix,url}));} else {diff --git a/react/features/conference/components/native/AlwaysOnLabels.tsx b/react/features/conference/components/native/AlwaysOnLabels.tsxindex 45d5b8696e..e29d1e48e3 100644--- a/react/features/conference/components/native/AlwaysOnLabels.tsx+++ b/react/features/conference/components/native/AlwaysOnLabels.tsx@@ -12,6 +12,7 @@ import { isLiveStreamingRunning } from '../../../recording/functions';import VisitorsCountLabel from '../../../visitors/components/native/VisitorsCountLabel';import RaisedHandsCountLabel from './RaisedHandsCountLabel';+import TimeTimerLabel from './TimeTimerLabel';import {LABEL_ID_AUDIO_TRANSLATION,LABEL_ID_RAISED_HANDS_COUNT,@@ -56,6 +57,7 @@ const AlwaysOnLabels = ({ createOnPress }: IProps) => {onPress = { createOnPress(LABEL_ID_TRANSCRIBING) } ><TranscribingLabel /></TouchableOpacity>+ <TimeTimerLabel /><TouchableOpacityhitSlop = { LabelHitSlop }onPress = { openHighlightDialogCallback }>diff --git a/react/features/conference/components/native/Conference.tsx b/react/features/conference/components/native/Conference.tsxindex 8d98c8add0..b1f83c0448 100644--- a/react/features/conference/components/native/Conference.tsx+++ b/react/features/conference/components/native/Conference.tsx@@ -36,6 +36,7 @@ import { getIsLobbyVisible } from '../../../lobby/functions';import { screen } from '../../../mobile/navigation/routes';import { isPipEnabled, setPictureInPictureEnabled } from '../../../mobile/picture-in-picture/functions';import Captions from '../../../subtitles/components/native/Captions';+import { isTimeTimerExpiredUnacknowledged } from '../../../time-timer/functions.native';import { setToolboxVisible } from '../../../toolbox/actions.native';import Toolbox from '../../../toolbox/components/native/Toolbox';import { isToolboxVisible } from '../../../toolbox/functions.native';@@ -132,6 +133,12 @@ interface IProps extends AbstractProps {*/_startCarMode: boolean;+ /**+ * Whether the meeting has run past its scheduled end and the timer-ended+ * notification has not been dismissed yet — drives the red expired frame.+ */+ _timerExpired: boolean;+/*** The indicator which determines whether the Toolbox is visible.*/@@ -368,6 +375,7 @@ class Conference extends AbstractConference<IProps, State> {_largeVideoParticipantId,_reducedUI,_shouldDisplayTileView,+ _timerExpired,_toolboxVisible} = this.props;@@ -387,6 +395,11 @@ class Conference extends AbstractConference<IProps, State> {}+ const FALLBACK_RADIUS = 24;+ const nativeRadius = NativeModules.ScreenCornerRadius?.cornerRadius;+ const SCREEN_CORNER_RADIUS+ = typeof nativeRadius === 'number' && nativeRadius > 0 ? nativeRadius : FALLBACK_RADIUS;+return (<>{/*@@ -480,6 +493,16 @@ class Conference extends AbstractConference<IProps, State> {<Toolbox /></>}++ {+ _timerExpired+ && <View+ pointerEvents = 'none'+ style = { [+ styles.timerExpiredFrame as ViewStyle,+ { borderRadius: SCREEN_CORNER_RADIUS }+ ] } />+ }</>);}@@ -588,6 +611,7 @@ function _mapStateToProps(state: IReduxState, _ownProps: any) {_reducedUI: reducedUI,_showLobby: getIsLobbyVisible(state),_startCarMode: startCarMode,+ _timerExpired: isTimeTimerExpiredUnacknowledged(state),_toolboxVisible: isToolboxVisible(state)};}diff --git a/react/features/conference/components/native/TimeTimerLabel.tsx b/react/features/conference/components/native/TimeTimerLabel.tsxnew file mode 100644index 0000000000..0af805cdae--- /dev/null+++ b/react/features/conference/components/native/TimeTimerLabel.tsx@@ -0,0 +1,98 @@+import React, { useEffect, useRef } from 'react';+import { Animated, Text, TextStyle, View, ViewStyle } from 'react-native';+import { useSelector } from 'react-redux';++import { IReduxState } from '../../../app/types';+import { getLocalizedDurationFormatter } from '../../../base/i18n/dateUtil';+import BaseTheme from '../../../base/ui/components/BaseTheme.native';+import Disk from '../../../time-timer/components/native/Disk';+import { getTimerVisualState, isTimeTimerEnabled } from '../../../time-timer/functions';++import styles, { TIME_TIMER_COLLAPSE_DURATION, TIME_TIMER_DISK } from './styles';++/**+ * Native two-segment time-timer pill: scheduled duration | elapsed + a progress+ * {@code Disk}. Colours come from the shared {@code getTimerVisualState}. When+ * the toolbox hides, it retracts to a disk-only chip.+ *+ * @returns {ReactElement|null}+ */+const TimeTimerLabel = () => {+ const timerState = useSelector((state: IReduxState) => state['features/time-timer']);+ const timerEnabled = useSelector(isTimeTimerEnabled);++ // Raw `visible` flag, not isToolboxVisible — that selector forces true for+ // a solo participant, which would stop the pill collapsing when alone.+ const toolboxVisible = useSelector((state: IReduxState) => state['features/toolbox'].visible);++ const collapsed = !toolboxVisible;+ const opacity = useRef(new Animated.Value(1)).current;++ // Fade out then in on collapse/expand so the swap reads as a morph.+ useEffect(() => {+ opacity.setValue(0);+ Animated.timing(opacity, {+ duration: TIME_TIMER_COLLAPSE_DURATION / 2,+ toValue: 1,+ useNativeDriver: true+ }).start();+ }, [ collapsed, opacity ]);++ if (!timerEnabled || !timerState.running) {+ return null;+ }++ const { elapsedSeconds, fillColor, fraction, overrunArcEndDeg, warning } = getTimerVisualState(timerState);+ const { expired } = timerState;+ const scheduled = getLocalizedDurationFormatter(timerState.durationSeconds * 1000);+ const elapsed = getLocalizedDurationFormatter(elapsedSeconds * 1000);++ // Expired wins over warning.+ let scheduledSegmentBg = BaseTheme.palette.timeTimerNameSegmentBackground;+ let timerSegmentBg = BaseTheme.palette.timeTimerTimerSegmentBackground;+ let elapsedColor = BaseTheme.palette.timeTimerElapsedText;++ if (expired) {+ scheduledSegmentBg = BaseTheme.palette.timeTimerExpiredNameSegmentBackground;+ timerSegmentBg = BaseTheme.palette.timeTimerExpiredTimerSegmentBackground;+ elapsedColor = BaseTheme.palette.timeTimerExpiredText;+ } else if (warning) {+ scheduledSegmentBg = BaseTheme.palette.timeTimerWarningNameSegmentBackground;+ timerSegmentBg = BaseTheme.palette.timeTimerWarningTimerSegmentBackground;+ elapsedColor = BaseTheme.palette.timeTimerWarning;+ }++ const disk = (+ <Disk+ color = { fillColor }+ fraction = { fraction }+ overrunArcEndDeg = { overrunArcEndDeg }+ size = { TIME_TIMER_DISK } />+ );++ // Collapsed: just the disk in a fully-rounded chip (web's retracted state).+ if (collapsed) {+ return (+ <Animated.View+ style = { [ styles.timeTimerCollapsedChip as ViewStyle, { backgroundColor: timerSegmentBg, opacity } ] }>+ { disk }+ </Animated.View>+ );+ }++ return (+ <Animated.View style = { [ styles.timeTimerContainer as ViewStyle, { opacity } ] }>+ <View style = { [ styles.timeTimerScheduledSegment as ViewStyle, { backgroundColor: scheduledSegmentBg } ] }>+ <Text style = { styles.timeTimerScheduledText as TextStyle }>({ scheduled })</Text>+ </View>+ <View style = { [ styles.timeTimerTimerSegment as ViewStyle, { backgroundColor: timerSegmentBg } ] }>+ <Text style = { [ styles.timeTimerElapsedText as TextStyle, { color: elapsedColor } ] }>+ { elapsed }+ </Text>+ { disk }+ </View>+ </Animated.View>+ );+};++export default TimeTimerLabel;diff --git a/react/features/conference/components/native/TitleBar.tsx b/react/features/conference/components/native/TitleBar.tsxindex 0328253159..61f87df48b 100644--- a/react/features/conference/components/native/TitleBar.tsx+++ b/react/features/conference/components/native/TitleBar.tsx@@ -3,10 +3,9 @@ import { Text, View, ViewStyle } from 'react-native';import { connect } from 'react-redux';import { IReduxState } from '../../../app/types';-import { getConferenceName, getConferenceTimestamp } from '../../../base/conference/functions';+import { getConferenceName } from '../../../base/conference/functions';import {AUDIO_DEVICE_BUTTON_ENABLED,- CONFERENCE_TIMER_ENABLED,TOGGLE_CAMERA_BUTTON_ENABLED} from '../../../base/flags/constants';import { getFeatureFlag } from '../../../base/flags/functions';@@ -17,7 +16,6 @@ import { isParticipantsPaneEnabled } from '../../../participants-pane/functions'import { isRoomNameEnabled } from '../../../prejoin/functions.native';import ToggleCameraButton from '../../../toolbox/components/native/ToggleCameraButton';import { isToolboxVisible } from '../../../toolbox/functions.native';-import ConferenceTimer from '../ConferenceTimer';import Labels from './Labels';import styles from './styles';@@ -30,11 +28,6 @@ interface IProps {*/_audioDeviceButtonEnabled: boolean;- /**- * Whether displaying the current conference timer is enabled or not.- */- _conferenceTimerEnabled: boolean;-/*** Creates a function to be invoked when the onPress of the touchables are* triggered.@@ -90,12 +83,6 @@ const TitleBar = (props: IProps) => {<ViewpointerEvents = 'box-none'style = { styles.roomNameWrapper as ViewStyle }>- {- props._conferenceTimerEnabled- && <View style = { styles.roomTimerView as ViewStyle }>- <ConferenceTimer textStyle = { styles.roomTimer } />- </View>- }{props._roomNameEnabled&& <View style = { styles.roomNameView as ViewStyle }>@@ -139,13 +126,8 @@ const TitleBar = (props: IProps) => {* @returns {IProps}*/function _mapStateToProps(state: IReduxState) {- const { hideConferenceTimer } = state['features/base/config'];- const startTimestamp = getConferenceTimestamp(state);-return {_audioDeviceButtonEnabled: getFeatureFlag(state, AUDIO_DEVICE_BUTTON_ENABLED, true),- _conferenceTimerEnabled:- Boolean(getFeatureFlag(state, CONFERENCE_TIMER_ENABLED, true) && !hideConferenceTimer && startTimestamp),_isParticipantsPaneEnabled: isParticipantsPaneEnabled(state),_meetingName: getConferenceName(state),_roomNameEnabled: isRoomNameEnabled(state),diff --git a/react/features/conference/components/native/styles.ts b/react/features/conference/components/native/styles.tsindex 61051fd8ce..2949de7355 100644--- a/react/features/conference/components/native/styles.ts+++ b/react/features/conference/components/native/styles.ts@@ -1,9 +1,17 @@+import { LABEL_SIZE } from '../../../base/label/components/native/styles';import BaseTheme from '../../../base/ui/components/BaseTheme.native';export const INSECURE_ROOM_NAME_LABEL_COLOR = BaseTheme.palette.actionDanger;const TITLE_BAR_BUTTON_SIZE = 24;+export const TIME_TIMER_COLLAPSE_DURATION = 600;++// Sized to match the Record/Transcribe chips.+const TIME_TIMER_DISK_SIZE = 20;+const TIME_TIMER_RADIUS = 3;+const TIME_TIMER_PAD_X = BaseTheme.spacing[2];+/*** The styles of the safe area view that contains the title bar.@@ -208,5 +216,67 @@ export default {raisedHandsCountLabelText: {color: BaseTheme.palette.uiBackground,paddingLeft: BaseTheme.spacing[2]+ },++ timerExpiredFrame: {+ borderColor: BaseTheme.palette.timeTimerExpiredDisk,+ borderCurve: 'circular',+ borderWidth: 3,+ bottom: 0,+ left: 0,+ position: 'absolute',+ right: 0,+ top: 0,+ zIndex: 1000+ },++ timeTimerContainer: {+ alignItems: 'center',+ flexDirection: 'row',+ height: LABEL_SIZE,+ marginBottom: 0,+ marginRight: BaseTheme.spacing[1]+ },++ timeTimerScheduledSegment: {+ alignItems: 'center',+ alignSelf: 'stretch',+ borderBottomLeftRadius: TIME_TIMER_RADIUS,+ borderTopLeftRadius: TIME_TIMER_RADIUS,+ flexDirection: 'row',+ justifyContent: 'center',+ paddingHorizontal: TIME_TIMER_PAD_X+ },++ timeTimerScheduledText: {+ ...BaseTheme.typography.labelRegular,+ color: BaseTheme.palette.text01+ },++ timeTimerTimerSegment: {+ alignItems: 'center',+ alignSelf: 'stretch',+ borderBottomRightRadius: TIME_TIMER_RADIUS,+ borderTopRightRadius: TIME_TIMER_RADIUS,+ flexDirection: 'row',+ justifyContent: 'center',+ paddingHorizontal: TIME_TIMER_PAD_X+ },++ timeTimerElapsedText: {+ ...BaseTheme.typography.labelRegular,+ marginRight: BaseTheme.spacing[2]+ },++ timeTimerCollapsedChip: {+ alignItems: 'center',+ borderRadius: TIME_TIMER_RADIUS,+ height: LABEL_SIZE,+ justifyContent: 'center',+ marginBottom: 0,+ marginRight: BaseTheme.spacing[1],+ paddingHorizontal: TIME_TIMER_PAD_X}};++export const TIME_TIMER_DISK = TIME_TIMER_DISK_SIZE;diff --git a/react/features/time-timer/components/native/Disk.tsx b/react/features/time-timer/components/native/Disk.tsxnew file mode 100644index 0000000000..bfc7b791be--- /dev/null+++ b/react/features/time-timer/components/native/Disk.tsx@@ -0,0 +1,219 @@+import React from 'react';+import Svg, { Circle, Path } from 'react-native-svg';++import BaseTheme from '../../../base/ui/components/BaseTheme.native';++/**+ * Native SVG disk for {@code TimeTimerLabel}: a ring with a wedge growing+ * clockwise from 12 o'clock. Since react-native-svg has no conic gradient, the+ * lap-2+ overrun sweep is drawn as thin angular slices whose colours+ * interpolate the same gradient web renders with CSS.+ */++const CX = 50;+const CY = 50;+const RADIUS = 46;++// Number of thin angular slices used to emulate web's conic gradient across+// the swept region. 60 keeps each slice ≤ a few degrees, so the banding is+// imperceptible at the pill's disk size while staying cheap to render.+const OVERRUN_SLICES = 60;++/**+ * Converts a polar coordinate (clock angle in degrees, 0 = 12 o'clock) to+ * cartesian coordinates on the disk. Identical to web's {@code Disk}.+ *+ * @param {number} angleDeg - Angle in degrees, clockwise from the top.+ * @param {number} r - Radius.+ * @returns {{ x: number, y: number }}+ */+function polarToCartesian(angleDeg: number, r: number) {+ const rad = ((angleDeg - 90) * Math.PI) / 180;++ return {+ x: CX + (r * Math.cos(rad)),+ y: CY + (r * Math.sin(rad))+ };+}++/**+ * Builds an SVG path for a filled pie wedge covering the given fraction of+ * the disk, drawn clockwise from the top. Identical to web's {@code Disk}.+ *+ * @param {number} fraction - Fraction of the disk to fill (0..1).+ * @returns {string}+ */+function wedgePath(fraction: number): string {+ const clamped = Math.max(0, Math.min(1, fraction));++ if (clamped <= 0) {+ return '';+ }+ if (clamped >= 1) {+ const top = polarToCartesian(0, RADIUS);+ const bottom = polarToCartesian(180, RADIUS);++ return [+ `M ${top.x} ${top.y}`,+ `A ${RADIUS} ${RADIUS} 0 0 1 ${bottom.x} ${bottom.y}`,+ `A ${RADIUS} ${RADIUS} 0 0 1 ${top.x} ${top.y}`,+ 'Z'+ ].join(' ');+ }++ const endAngle = clamped * 360;+ const start = polarToCartesian(0, RADIUS);+ const end = polarToCartesian(endAngle, RADIUS);+ const largeArc = endAngle > 180 ? 1 : 0;++ return [+ `M ${CX} ${CY}`,+ `L ${start.x} ${start.y}`,+ `A ${RADIUS} ${RADIUS} 0 ${largeArc} 1 ${end.x} ${end.y}`,+ 'Z'+ ].join(' ');+}+++/**+ * Linearly interpolates between two #rrggbb hex colours.+ *+ * @param {string} from - Start colour (#rrggbb).+ * @param {string} to - End colour (#rrggbb).+ * @param {number} t - Interpolation factor, 0..1.+ * @returns {string}+ */+function lerpHexColor(from: string, to: string, t: number): string {+ const f = parseInt(from.slice(1), 16);+ const g = parseInt(to.slice(1), 16);+ const fr = (f >> 16) & 0xff, fg = (f >> 8) & 0xff, fb = f & 0xff;+ const gr = (g >> 16) & 0xff, gg = (g >> 8) & 0xff, gb = g & 0xff;+ const r = Math.round(fr + ((gr - fr) * t));+ const gc = Math.round(fg + ((gg - fg) * t));+ const b = Math.round(fb + ((gb - fb) * t));++ return `#${((1 << 24) + (r << 16) + (gc << 8) + b).toString(16).slice(1)}`;+}++/**+ * Builds a filled pie-wedge path spanning [startDeg, endDeg] clockwise from+ * the 12 o'clock origin. Used to emulate the conic gradient one thin slice at+ * a time.+ *+ * @param {number} startDeg - Start angle in degrees.+ * @param {number} endDeg - End angle in degrees.+ * @returns {string}+ */+function slicePath(startDeg: number, endDeg: number): string {+ const start = polarToCartesian(startDeg, RADIUS);+ const end = polarToCartesian(endDeg, RADIUS);+ const largeArc = endDeg - startDeg > 180 ? 1 : 0;++ return [+ `M ${CX} ${CY}`,+ `L ${start.x} ${start.y}`,+ `A ${RADIUS} ${RADIUS} 0 ${largeArc} 1 ${end.x} ${end.y}`,+ 'Z'+ ].join(' ');+}++interface IProps {++ /**+ * Fill colour for the disk (blue / amber / red per timer state).+ */+ color: string;++ /**+ * Fraction of the disk to fill (0..1).+ */+ fraction: number;++ /**+ * Angular position (degrees, clockwise from the top) of the leading edge+ * of the overrun sweep during lap 2 and onward. When provided, the+ * conic-gradient sweep (base colour → darker edge colour) is drawn from+ * the origin to this angle over the fully filled disk.+ */+ overrunArcEndDeg?: number;++ /**+ * Rendered size (width and height) of the disk in points.+ */+ size: number;+}++/**+ * Renders the time-timer disk as a ring with an optional filled wedge, plus a+ * stroked overrun arc during lap 2+.+ *+ * @param {IProps} props - Component props.+ * @returns {ReactElement}+ */+const Disk = ({ color, fraction, overrunArcEndDeg, size }: IProps) => {+ const showOverrun = typeof overrunArcEndDeg === 'number';+ const wedge = wedgePath(fraction);++ // Reproduce web's conic gradient over the swept region [0, deg]: base+ // colour at the origin fading to the darker edge colour at the leading+ // edge, matched slice-by-slice. The remainder of the disk stays the base+ // colour (already painted by the full wedge below).+ let overrunSlices: React.ReactElement[] = [];++ if (showOverrun) {+ const deg = Math.max(0, Math.min(360, overrunArcEndDeg ?? 0));+ const step = deg / OVERRUN_SLICES;++ overrunSlices = Array.from({ length: OVERRUN_SLICES }, (_, i) => {+ const a0 = i * step;+ const a1 = (i + 1) * step;++ // Colour the gradient would have at the middle of this slice.+ const t = deg > 0 ? ((a0 + a1) / 2) / deg : 0;++ return (+ <Path+ d = { slicePath(a0, a1) }+ fill = { lerpHexColor(+ BaseTheme.palette.timeTimerExpiredDisk,+ BaseTheme.palette.timeTimerExpiredOverrunEdge,+ t) }+ key = { i } />+ );+ });+ }++ return (+ <Svg+ height = { size }+ viewBox = '0 0 100 100'+ width = { size }>+ {/*+ * Faint 5% white fill behind the wedge so the unfilled portion+ * reads as a subtle lighter shape against the navy chip+ * background. Drawn FIRST so the wedge paints over it.+ */}+ <Circle+ cx = { CX }+ cy = { CY }+ fill = '#FFFFFF'+ fillOpacity = { 0.05 }+ r = { RADIUS } />+ <Circle+ cx = { CX }+ cy = { CY }+ fill = 'none'+ r = { RADIUS }+ stroke = { color }+ strokeWidth = { 6 } />+ { wedge !== '' && (+ <Path+ d = { wedge }+ fill = { color } />+ ) }+ { overrunSlices }+ </Svg>+ );+};++export default Disk;diff --git a/react/features/time-timer/components/web/Disk.tsx b/react/features/time-timer/components/web/Disk.tsxindex d20276f173..603c43cf83 100644--- a/react/features/time-timer/components/web/Disk.tsx+++ b/react/features/time-timer/components/web/Disk.tsx@@ -1,7 +1,7 @@import React from 'react';import { makeStyles } from 'tss-react/mui';-import { EXPIRED_DISK_COLOR, EXPIRED_OVERRUN_EDGE_COLOR } from '../../functions';+import BaseTheme from '../../../base/ui/components/BaseTheme.web';/*** SVG disk renderer used by {@code TimeTimerPill}. Draws a ring with an@@ -122,9 +122,10 @@ const useStyles = makeStyles<{ size: number; }>()((_theme, { size }) => {* @returns {string}*/function overrunGradient(deg: number): string {- return `conic-gradient(from 0deg, ${EXPIRED_DISK_COLOR} 0deg, `- + `${EXPIRED_OVERRUN_EDGE_COLOR} ${deg}deg, `- + `${EXPIRED_DISK_COLOR} ${deg}deg, ${EXPIRED_DISK_COLOR} 360deg)`;+ const base = BaseTheme.palette.timeTimerExpiredDisk;+ const edge = BaseTheme.palette.timeTimerExpiredOverrunEdge;++ return `conic-gradient(from 0deg, ${base} 0deg, ${edge} ${deg}deg, ${base} ${deg}deg, ${base} 360deg)`;}/**diff --git a/react/features/time-timer/components/web/TimeTimerEndedDescription.tsx b/react/features/time-timer/components/web/TimeTimerEndedDescription.tsxindex b2b46bb79f..0e211db058 100644--- a/react/features/time-timer/components/web/TimeTimerEndedDescription.tsx+++ b/react/features/time-timer/components/web/TimeTimerEndedDescription.tsx@@ -4,14 +4,11 @@ import { useSelector } from 'react-redux';import { IReduxState } from '../../../app/types';import { getLocalizedDurationFormatter } from '../../../base/i18n/dateUtil';-import { EXPIRED_NOTIFICATION_TEXT_COLOR } from '../../functions';+import BaseTheme from '../../../base/ui/components/BaseTheme.web';/**- * Description for the sticky "Timer ended" notification. Subscribes to the- * timer's overrun counter directly so only this text node re-renders each- * second — the notification itself is dispatched once at expiry and never- * touched again. This keeps middleware free of React-element construction and- * avoids re-pushing the notification through its reducer every tick.+ * Description for the sticky "Timer ended" notification. Re-renders every+ * second as the overrun counter ticks.** @returns {ReactElement}*/@@ -19,10 +16,8 @@ function TimeTimerEndedDescription() {const { t } = useTranslation();const overSeconds = useSelector((state: IReduxState) => state['features/time-timer'].overSeconds);- // The localized string carries a {{time}} placeholder; we split on a- // unique sentinel so we can colour the time span without inventing a new- // translation key. The time uses the same formatter as the pill so the- // two never disagree (e.g. 1:15:03, not 75:03).+ // Split on a sentinel so the time span can be coloured without a new+ // translation key.const TIME_PLACEHOLDER = '__TIME__';const raw = t('timeTimer.endedOver', { time: TIME_PLACEHOLDER });const [ pre, post ] = raw.split(TIME_PLACEHOLDER);@@ -30,7 +25,7 @@ function TimeTimerEndedDescription() {return (<span>{pre}- <span style = {{ color: EXPIRED_NOTIFICATION_TEXT_COLOR }}>+ <span style = {{ color: BaseTheme.palette.timeTimerExpiredNotificationText }}>{getLocalizedDurationFormatter(overSeconds * 1000)}</span>{post}diff --git a/react/features/time-timer/components/web/TimeTimerPill.tsx b/react/features/time-timer/components/web/TimeTimerPill.tsxindex 65b022e602..242cec973e 100644--- a/react/features/time-timer/components/web/TimeTimerPill.tsx+++ b/react/features/time-timer/components/web/TimeTimerPill.tsx@@ -5,17 +5,9 @@ import { makeStyles } from 'tss-react/mui';import { IReduxState } from '../../../app/types';import { getConferenceName } from '../../../base/conference/functions';import { getLocalizedDurationFormatter } from '../../../base/i18n/dateUtil';+import BaseTheme from '../../../base/ui/components/BaseTheme.web';import { isToolboxVisible } from '../../../toolbox/functions.web';-import {- EXPIRED_NAME_SEGMENT_BG,- EXPIRED_PILL_TEXT_COLOR,- EXPIRED_TIMER_SEGMENT_BG,- WARNING_COLOR,- WARNING_NAME_SEGMENT_BG,- WARNING_TIMER_SEGMENT_BG,- getTimerVisualState,- isTimeTimerEnabled-} from '../../functions';+import { getTimerVisualState, isTimeTimerEnabled } from '../../functions';import Disk from './Disk';@@ -165,38 +157,30 @@ const useStyles = makeStyles()(theme => {whiteSpace: 'nowrap'},- // During the final minutes (warning window) the elapsed digits go- // amber to match the disk colour change.+ // Warning state (amber).elapsedWarning: {- color: WARNING_COLOR+ color: BaseTheme.palette.timeTimerWarning},- // Warning-state segment backgrounds — same lighter-left /- // deeper-right pattern as the blue baseline, but in warm browns.nameSegmentWarning: {- backgroundColor: WARNING_NAME_SEGMENT_BG+ backgroundColor: BaseTheme.palette.timeTimerWarningNameSegmentBackground},timerSegmentWarning: {- backgroundColor: WARNING_TIMER_SEGMENT_BG+ backgroundColor: BaseTheme.palette.timeTimerWarningTimerSegmentBackground},- // Expired-state segment backgrounds — warm wine tones with the same- // lighter-left / deeper-right pattern. More urgent than warning;- // expired overrides warning when both could apply (though in- // practice they're mutually exclusive).+ // Expired state (wine red); overrides warning.nameSegmentExpired: {- backgroundColor: EXPIRED_NAME_SEGMENT_BG+ backgroundColor: BaseTheme.palette.timeTimerExpiredNameSegmentBackground},timerSegmentExpired: {- backgroundColor: EXPIRED_TIMER_SEGMENT_BG+ backgroundColor: BaseTheme.palette.timeTimerExpiredTimerSegmentBackground},- // Once the timer has expired, the elapsed value shifts to a soft- // pink to flag that the meeting is now over schedule.elapsedExpired: {- color: EXPIRED_PILL_TEXT_COLOR+ color: BaseTheme.palette.timeTimerExpiredText},textHidden: {diff --git a/react/features/time-timer/functions.any.ts b/react/features/time-timer/functions.any.tsnew file mode 100644index 0000000000..131c5d8768--- /dev/null+++ b/react/features/time-timer/functions.any.ts@@ -0,0 +1,133 @@+import { IReduxState } from '../app/types';+import BaseTheme from '../base/ui/components/BaseTheme';++import { WARNING_THRESHOLD_SECONDS } from './constants';+import { ITimeTimerState } from './reducer';+import { ICalendarTimerEvent, ITimerVisualState } from './types';++// Minimum visible red disk fraction at expiry, so the wedge isn't invisible.+const EXPIRED_WEDGE_FLOOR = 0.02;++/**+ * Derives the disk's visual state (colour, fill fraction, elapsed seconds)+ * from the timer reducer state.+ *+ * @param {ITimeTimerState} state - The current time-timer reducer state.+ * @returns {ITimerVisualState}+ */+export function getTimerVisualState(state: ITimeTimerState): ITimerVisualState {+ const { durationSeconds, remainingSeconds, overSeconds, expired } = state;++ // Time elapsed since the calendar event's scheduled start. Before the+ // scheduled end this is `duration - remaining` (which already accounts+ // for late joiners via `defaultRemaining`). After the scheduled end the+ // timer keeps ticking via `overSeconds`, so total elapsed =+ // duration + overrun.+ const elapsedSeconds = Math.max(+ 0,+ (durationSeconds - remainingSeconds) + overSeconds+ );++ // Warning state: within the last `WARNING_THRESHOLD_SECONDS` of the+ // scheduled duration but not yet expired. Used both for the amber+ // colouring and (in middleware) to trigger the one-time bar-expand.+ const warning = !expired && remainingSeconds > 0 && remainingSeconds <= WARNING_THRESHOLD_SECONDS;++ let fillColor = BaseTheme.palette.timeTimerDisk;+ let fraction = durationSeconds > 0+ ? (durationSeconds - remainingSeconds) / durationSeconds+ : 0;++ if (warning) {+ fillColor = BaseTheme.palette.timeTimerWarning;+ }++ let overrunArcEndDeg: number | undefined;++ if (expired) {+ fillColor = BaseTheme.palette.timeTimerExpiredDisk;++ if (durationSeconds > 0) {+ // Treat overrun as a series of laps, each one+ // `durationSeconds` long — the disk fills exactly once over+ // the first lap (matching the original scheduled duration),+ // then stays solid red while a glowing arc sweeps subsequent+ // laps to convey ongoing motion.+ const lapIndex = Math.floor(overSeconds / durationSeconds);+ const lapFraction = (overSeconds % durationSeconds) / durationSeconds;++ if (lapIndex === 0) {+ // Lap 1: standard growing wedge, with a small visible+ // floor right at expiry so the red slice is never invisible.+ fraction = Math.max(EXPIRED_WEDGE_FLOOR, lapFraction);+ } else {+ // Lap 2+: disk fully filled. The leading edge of the+ // current lap is rendered separately as a glowing+ // comet-tail arc (see Disk component).+ fraction = 1;+ overrunArcEndDeg = lapFraction * 360;+ }+ } else {+ fraction = EXPIRED_WEDGE_FLOOR;+ }+ }++ return { elapsedSeconds, fillColor, fraction, overrunArcEndDeg, warning };+}++/**+ * Computes the {@code setCalendarTimerDuration} arguments for a calendar+ * event the user is about to join, or {@code undefined} when the event has+ * no parseable start/end (so the caller should clear any stale duration+ * instead). Shared by web's and native's calendar list `_onPress`, so both+ * platforms record the same duration/start-time the same way.+ *+ * @param {ICalendarTimerEvent} [event] - The calendar event being joined.+ * @returns {{ durationSeconds: number, startTimeUnix: number }|undefined}+ */+export function computeCalendarTimerDuration(event?: ICalendarTimerEvent) {+ const startUnix = typeof event?.startDate === 'number'+ ? event.startDate+ : Date.parse(event?.startDate ?? '');+ const endUnix = typeof event?.endDate === 'number'+ ? event.endDate+ : Date.parse(event?.endDate ?? '');++ if (!isNaN(startUnix) && !isNaN(endUnix) && endUnix > startUnix) {+ return {+ durationSeconds: Math.round((endUnix - startUnix) / 1000),+ startTimeUnix: startUnix+ };+ }++ return undefined;+}++/**+ * Whether the time-timer is enabled. It is enabled by default — only an+ * explicit {@code timeTimer.enabled === false} turns it off. The timer+ * renders nothing until a duration is known, so being on by default is+ * harmless and lets calendar / iframe-API deployments see it with no extra+ * config. This is the single source of truth for the enabled rule; use it+ * everywhere (middleware, components) rather than reading the config inline.+ *+ * @param {IReduxState} state - The redux state.+ * @returns {boolean}+ */+export function isTimeTimerEnabled(state: IReduxState): boolean {+ return state['features/base/config']?.timeTimer?.enabled !== false;+}++/**+ * Whether the meeting has run past its scheduled end and the user has not yet+ * dismissed the timer-ended notification. Drives the red border around the+ * conference grid.+ *+ * @param {IReduxState} state - The redux state.+ * @returns {boolean}+ */+export function isTimeTimerExpiredUnacknowledged(state: IReduxState): boolean {+ const { acknowledged, expired } = state['features/time-timer'];++ return expired && !acknowledged;+}diff --git a/react/features/time-timer/functions.native.ts b/react/features/time-timer/functions.native.tsnew file mode 100644index 0000000000..8db751be9c--- /dev/null+++ b/react/features/time-timer/functions.native.ts@@ -0,0 +1,17 @@+import { getLocalizedDurationFormatter } from '../base/i18n/dateUtil';+import i18next from '../base/i18n/i18next';++export * from './functions.any';++/**+ * Description for the "Timer ended" notification on native: a plain string.+ * The middleware re-posts it each tick so the overrun counter stays live.+ *+ * @param {number} overSeconds - Seconds over the scheduled end.+ * @returns {string}+ */+export function buildTimerEndedDescription(overSeconds: number) {+ return i18next.t('timeTimer.endedOver', {+ time: getLocalizedDurationFormatter(overSeconds * 1000)+ });+}diff --git a/react/features/time-timer/functions.ts b/react/features/time-timer/functions.tsdeleted file mode 100644index ae9718759f..0000000000--- a/react/features/time-timer/functions.ts+++ /dev/null@@ -1,207 +0,0 @@-import { IReduxState } from '../app/types';--import { WARNING_THRESHOLD_SECONDS } from './constants';-import { ITimeTimerState } from './reducer';--/**- * Minimum visible fraction of the disk drawn in red right after the timer- * expires. Without this floor, the wedge would start at ~0 and be invisible- * for the first several minutes of overrun; a small floor keeps the red- * slice visible from the moment the timer ends. Real overrun catches up- * once `overSeconds / durationSeconds` exceeds this floor.- */-const EXPIRED_WEDGE_FLOOR = 0.02;--/**- * Soft pink/rose used for the elapsed-time digits in the pill once the- * meeting is over schedule. Reads well on the pill's dark background.- */-export const EXPIRED_PILL_TEXT_COLOR = '#FF9DA0';--/**- * Amber used for the disk fill and the remaining-time digits during the- * final {@code WARNING_THRESHOLD_SECONDS} of the meeting. Matches the- * Figma amber-state spec.- */-export const WARNING_COLOR = '#F8AE1A';--/**- * Background colours for the amber/warning state — mirror the blue baseline- * pattern (right segment is the deeper one).- */-export const WARNING_NAME_SEGMENT_BG = '#3C2E1D';-export const WARNING_TIMER_SEGMENT_BG = '#302417';--/**- * Background colours for the red/expired state — same lighter-left /- * deeper-right pattern as the other states, in warm wine tones.- */-export const EXPIRED_NAME_SEGMENT_BG = '#4F2627';-export const EXPIRED_TIMER_SEGMENT_BG = '#3E1D1E';--/**- * Coral-red used for the disk fill once the meeting is over schedule —- * matches Figma's expired-state spec. Stronger / warmer than the previous- * `theme.palette.iconError`.- */-export const EXPIRED_DISK_COLOR = '#F24D5F';--/**- * Deep wine red the overrun lap-2+ sweep darkens toward at its leading- * edge. Once the disk is fully filled (lap 1 complete), each subsequent- * lap is drawn as a continuous conic gradient running from- * {@code EXPIRED_DISK_COLOR} at the 12 o'clock origin to this darker tone- * at the current leading edge — conveying ongoing motion without leaving- * the red family. See {@code TimeTimerPill} / {@code Disk}.- */-export const EXPIRED_OVERRUN_EDGE_COLOR = '#8E2530';--/**- * Bright 8x8 blue used for the disk in the normal/running state — matches- * the Figma spec for the time-timer pill baseline.- */-export const DISK_BLUE = '#1084FE';--/**- * Disk-red used for the overrun-time text in the "Timer ended" notification.- * Matches the colour of the disk's expired wedge — same hex as- * `theme.palette.iconError` resolves to in the current Jitsi theme — and- * reads with stronger contrast on the notification's white background.- */-export const EXPIRED_NOTIFICATION_TEXT_COLOR = '#D83848';--export interface ITimerVisualState {-- /**- * Time elapsed since the calendar event's scheduled start, in seconds.- * Derived so that every participant sees the same value regardless of- * when they joined.- */- elapsedSeconds: number;-- /**- * Fill colour for the disk (white during the meeting, amber during the- * final {@code WARNING_THRESHOLD_SECONDS}, red once over schedule).- */- fillColor: string;-- /**- * Fraction of the disk to fill (0..1).- */- fraction: number;-- /**- * Angular position (degrees, clockwise from the top / 12 o'clock) of- * the leading edge of the overrun sweep during lap 2 and onward — once- * the disk has filled once, subsequent overrun laps draw a continuous- * conic gradient (base red → darker red at this angle) over the solid- * disk to make the ongoing motion visible. `undefined` during normal- * running, warning and the first overrun lap (which still uses the- * standard growing wedge).- */- overrunArcEndDeg?: number;-- /**- * True during the warning window — the final- * {@code WARNING_THRESHOLD_SECONDS} before scheduled end. Drives the- * amber colour treatment in the pill (disk + elapsed digits).- */- warning: boolean;-}--/**- * Derives the visual state of the time-timer disk (color + fill fraction +- * elapsed seconds) from the timer reducer state. Consumed by- * {@code TimeTimerPill}.- *- * @param {ITimeTimerState} state - The current time-timer reducer state.- * @returns {ITimerVisualState}- */-export function getTimerVisualState(state: ITimeTimerState): ITimerVisualState {- const { durationSeconds, remainingSeconds, overSeconds, expired } = state;-- // Time elapsed since the calendar event's scheduled start. Before the- // scheduled end this is `duration - remaining` (which already accounts- // for late joiners via `defaultRemaining`). After the scheduled end the- // timer keeps ticking via `overSeconds`, so total elapsed =- // duration + overrun.- const elapsedSeconds = Math.max(- 0,- (durationSeconds - remainingSeconds) + overSeconds- );-- // Warning state: within the last `WARNING_THRESHOLD_SECONDS` of the- // scheduled duration but not yet expired. Used both for the amber- // colouring and (in middleware) to trigger the one-time bar-expand.- const warning = !expired && remainingSeconds > 0 && remainingSeconds <= WARNING_THRESHOLD_SECONDS;-- let fillColor = DISK_BLUE; // Bright blue during normal running state.- let fraction = durationSeconds > 0- ? (durationSeconds - remainingSeconds) / durationSeconds- : 0;-- if (warning) {- fillColor = WARNING_COLOR;- }-- let overrunArcEndDeg: number | undefined;-- if (expired) {- fillColor = EXPIRED_DISK_COLOR;-- if (durationSeconds > 0) {- // Treat overrun as a series of laps, each one- // `durationSeconds` long — the disk fills exactly once over- // the first lap (matching the original scheduled duration),- // then stays solid red while a glowing arc sweeps subsequent- // laps to convey ongoing motion.- const lapIndex = Math.floor(overSeconds / durationSeconds);- const lapFraction = (overSeconds % durationSeconds) / durationSeconds;-- if (lapIndex === 0) {- // Lap 1: standard growing wedge, with a small visible- // floor right at expiry so the red slice is never invisible.- fraction = Math.max(EXPIRED_WEDGE_FLOOR, lapFraction);- } else {- // Lap 2+: disk fully filled. The leading edge of the- // current lap is rendered separately as a glowing- // comet-tail arc (see Disk component).- fraction = 1;- overrunArcEndDeg = lapFraction * 360;- }- } else {- fraction = EXPIRED_WEDGE_FLOOR;- }- }-- return { elapsedSeconds, fillColor, fraction, overrunArcEndDeg, warning };-}--/**- * Whether the time-timer is enabled. It is enabled by default — only an- * explicit {@code timeTimer.enabled === false} turns it off. The timer- * renders nothing until a duration is known, so being on by default is- * harmless and lets calendar / iframe-API deployments see it with no extra- * config. This is the single source of truth for the enabled rule; use it- * everywhere (middleware, components) rather than reading the config inline.- *- * @param {IReduxState} state - The redux state.- * @returns {boolean}- */-export function isTimeTimerEnabled(state: IReduxState): boolean {- return state['features/base/config']?.timeTimer?.enabled !== false;-}--/**- * Whether the meeting has run past its scheduled end and the user has not yet- * dismissed the timer-ended notification. Drives the red border around the- * conference grid.- *- * @param {IReduxState} state - The redux state.- * @returns {boolean}- */-export function isTimeTimerExpiredUnacknowledged(state: IReduxState): boolean {- const { acknowledged, expired } = state['features/time-timer'];-- return expired && !acknowledged;-}diff --git a/react/features/time-timer/functions.web.ts b/react/features/time-timer/functions.web.tsnew file mode 100644index 0000000000..821d0c02cb--- /dev/null+++ b/react/features/time-timer/functions.web.ts@@ -0,0 +1,16 @@+import React from 'react';++import TimeTimerEndedDescription from './components/web/TimeTimerEndedDescription';+export * from './functions.any';++/**+ * Description for the "Timer ended" notification on web: a component that+ * subscribes to `overSeconds` and ticks the overrun counter itself.+ *+ * @param {number} _overSeconds - Unused on web; kept for signature parity with+ * native.+ * @returns {React.ReactElement}+ */+export function buildTimerEndedDescription(_overSeconds: number) {+ return React.createElement(TimeTimerEndedDescription);+}diff --git a/react/features/time-timer/middleware.ts b/react/features/time-timer/middleware.tsnew file mode 100644index 0000000000..7e3e0c3f41--- /dev/null+++ b/react/features/time-timer/middleware.ts@@ -0,0 +1,195 @@+import { IStore } from '../app/types';+import { CONFERENCE_JOINED, CONFERENCE_LEFT } from '../base/conference/actionTypes';+import { getRoomName } from '../base/conference/functions';+import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';+import { parseURIString } from '../base/util/uri';+import { HIDE_NOTIFICATION } from '../notifications/actionTypes';+import { showNotification } from '../notifications/actions';+import { NOTIFICATION_ICON, NOTIFICATION_TIMEOUT_TYPE, NOTIFICATION_TYPE } from '../notifications/constants';+import { showToolbox } from '../toolbox/actions';++import { START_TIME_TIMER, STOP_TIME_TIMER, TICK_TIME_TIMER } from './actionTypes';+import {+ setTimeTimerAcknowledged,+ setTimeTimerExpired,+ setTimeTimerWarningTriggered,+ startTimeTimer,+ stopTimeTimer,+ tickTimeTimer+} from './actions';+import {+ TIME_TIMER_NOTIFICATION_ID,+ WARNING_THRESHOLD_SECONDS+} from './constants';+import { buildTimerEndedDescription, isTimeTimerEnabled } from './functions';+import logger from './logger';++let _tickInterval: ReturnType<typeof setInterval> | undefined;++// True once the "ended" notification has been posted for the current timer,+// so it fires exactly once. Reset when a timer starts or stops.+let _notifiedExpiry = false;++// A string description (native) can't update itself, so the middleware+// re-posts it each tick to keep the overrun counter live. A React element+// (web) ticks itself, so a single post is enough.+const _descriptionSelfTicks = typeof buildTimerEndedDescription(0) !== 'string';++/**+ * Clears the per-second tick interval if one is running.+ *+ * @returns {void}+ */+function _clearTick() {+ if (_tickInterval !== undefined) {+ clearInterval(_tickInterval);+ _tickInterval = undefined;+ }+}++/**+ * (Re)posts the sticky "Timer ended" notification. The shared uid replaces any+ * existing entry in place, so this is safe to call repeatedly.+ *+ * @param {IStore} store - The redux store.+ * @returns {void}+ */+function _postExpiredNotification({ dispatch, getState }: IStore) {+ const { overSeconds } = getState()['features/time-timer'];++ dispatch(showNotification({+ appearance: NOTIFICATION_TYPE.NORMAL,+ description: buildTimerEndedDescription(overSeconds),+ icon: NOTIFICATION_ICON.ERROR,+ titleKey: 'timeTimer.endedTitle',+ uid: TIME_TIMER_NOTIFICATION_ID+ }, NOTIFICATION_TIMEOUT_TYPE.STICKY));+}++/**+ * Posts the "Timer ended" notification the first time the timer expires.+ *+ * @param {IStore} store - The redux store.+ * @returns {void}+ */+function _notifyExpiredOnce(store: IStore) {+ if (_notifiedExpiry) {+ return;+ }+ _notifiedExpiry = true;++ _postExpiredNotification(store);+}++MiddlewareRegistry.register((store: IStore) => (next: Function) => (action: any) => {+ const result = next(action);+ const { dispatch, getState } = store;++ switch (action.type) {+ case CONFERENCE_JOINED: {+ // Enabled by default; a deployment opts out via timeTimer.enabled=false.+ if (isTimeTimerEnabled(getState())) {+ const { calendarDurationSeconds, calendarStartTimeUnix, calendarUrl }+ = getState()['features/time-timer'];++ // Only start from a calendar duration recorded for the room being+ // joined — otherwise a duration from a meeting bailed on at prejoin+ // could leak in. Match by room name (case-insensitive), not raw URL.+ // The iframe-API path drives the timer separately, later.+ const calendarRoom = calendarUrl ? parseURIString(calendarUrl)?.room?.toLowerCase() : undefined;+ const joinedRoom = getRoomName(getState())?.toLowerCase();+ const calendarMatchesRoom = !calendarRoom || calendarRoom === joinedRoom;++ if (calendarMatchesRoom+ && typeof calendarDurationSeconds === 'number' && calendarDurationSeconds > 0) {+ // Elapsed since the event's scheduled start (not since join),+ // so the time matches for everyone. May be negative (joined+ // early) or past the duration (joined late); the reducer+ // handles both. No start time falls back to 0 (count from now).+ const elapsed = typeof calendarStartTimeUnix === 'number'+ ? Math.round((Date.now() - calendarStartTimeUnix) / 1000)+ : 0;++ dispatch(startTimeTimer(calendarDurationSeconds, elapsed));+ }+ }+ break;+ }+ case CONFERENCE_LEFT: {+ // Reset so the next meeting never inherits a stale pill or red border.+ _clearTick();+ dispatch(stopTimeTimer());+ break;+ }+ case START_TIME_TIMER: {+ logger.info(`Timer started: duration=${action.durationSeconds}s elapsed=${action.elapsedSeconds}s`);+ _clearTick();+ _notifiedExpiry = false;+ _tickInterval = setInterval(() => {+ dispatch(tickTimeTimer());+ }, 1000);++ // A timer that starts already expired never hits the live-crossing+ // branch below, so post its notification here.+ if (getState()['features/time-timer'].expired) {+ _notifyExpiredOnce(store);+ }+ break;+ }+ case STOP_TIME_TIMER: {+ _clearTick();+ _notifiedExpiry = false;++ // Clear the notification so it doesn't outlive the timer.+ dispatch({+ type: HIDE_NOTIFICATION,+ uid: TIME_TIMER_NOTIFICATION_ID+ });+ break;+ }+ case TICK_TIME_TIMER: {+ const { acknowledged, expired, remainingSeconds, running, warningTriggered }+ = getState()['features/time-timer'];++ if (!running) {+ break;+ }++ // Entering the warning window: fire the one-time bar-expand. `<=`+ // (not `===`) survives a background tab that jumps several seconds.+ if (!warningTriggered && !expired && remainingSeconds <= WARNING_THRESHOLD_SECONDS) {+ dispatch(setTimeTimerWarningTriggered());+ dispatch(showToolbox());+ }++ // Crossing the scheduled end: flag expired and expand the bar once.+ if (remainingSeconds <= 0 && !expired) {+ dispatch(setTimeTimerExpired());+ dispatch(showToolbox());+ }++ // While expired: post once, then (native only) re-post each tick so+ // the static-string overrun counter keeps climbing — but not after the+ // user dismisses it. Web's description self-ticks, so one post suffices.+ if (remainingSeconds <= 0) {+ if (_notifiedExpiry) {+ if (!_descriptionSelfTicks && !acknowledged) {+ _postExpiredNotification(store);+ }+ } else {+ _notifyExpiredOnce(store);+ }+ }+ break;+ }+ case HIDE_NOTIFICATION: {+ // Closing the notification acknowledges it, clearing the red border.+ if (action.uid === TIME_TIMER_NOTIFICATION_ID) {+ dispatch(setTimeTimerAcknowledged());+ }+ break;+ }+ }++ return result;+});diff --git a/react/features/time-timer/middleware.web.ts b/react/features/time-timer/middleware.web.tsdeleted file mode 100644index 29e9c2ac47..0000000000--- a/react/features/time-timer/middleware.web.ts+++ /dev/null@@ -1,215 +0,0 @@-import React from 'react';--import { IStore } from '../app/types';-import { CONFERENCE_JOINED, CONFERENCE_LEFT } from '../base/conference/actionTypes';-import { getRoomName } from '../base/conference/functions';-import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';-import { parseURIString } from '../base/util/uri';-import { HIDE_NOTIFICATION } from '../notifications/actionTypes';-import { showNotification } from '../notifications/actions';-import { NOTIFICATION_ICON, NOTIFICATION_TIMEOUT_TYPE, NOTIFICATION_TYPE } from '../notifications/constants';-import { showToolbox } from '../toolbox/actions.web';--import { START_TIME_TIMER, STOP_TIME_TIMER, TICK_TIME_TIMER } from './actionTypes';-import {- setTimeTimerAcknowledged,- setTimeTimerExpired,- setTimeTimerWarningTriggered,- startTimeTimer,- stopTimeTimer,- tickTimeTimer-} from './actions';-import TimeTimerEndedDescription from './components/web/TimeTimerEndedDescription';-import {- TIME_TIMER_NOTIFICATION_ID,- WARNING_THRESHOLD_SECONDS-} from './constants';-import { isTimeTimerEnabled } from './functions';-import logger from './logger';--let _tickInterval: ReturnType<typeof setInterval> | undefined;--// True once the sticky "ended" notification has been posted for the current-// timer, so it is posted exactly once whether the meeting crosses the end-// live or starts already past it (e.g. a late joiner / an embedder pushing an-// already-overrun timer). Reset whenever a timer starts or stops.-let _notifiedExpiry = false;--/**- * Clears the per-second tick interval if one is running.- *- * @returns {void}- */-function _clearTick() {- if (_tickInterval !== undefined) {- clearInterval(_tickInterval);- _tickInterval = undefined;- }-}--/**- * Posts the sticky "Timer ended" notification once per timer. Its description- * is a connected component that subscribes to `overSeconds`, so the live- * counter ticks via that component's own re-renders — the notification itself- * is never re-dispatched.- *- * @param {Function} dispatch - The redux dispatch.- * @returns {void}- */-function _notifyExpiredOnce(dispatch: IStore['dispatch']) {- if (_notifiedExpiry) {- return;- }- _notifiedExpiry = true;-- dispatch(showNotification({- appearance: NOTIFICATION_TYPE.NORMAL,- description: React.createElement(TimeTimerEndedDescription),- icon: NOTIFICATION_ICON.ERROR,- titleKey: 'timeTimer.endedTitle',- uid: TIME_TIMER_NOTIFICATION_ID- }, NOTIFICATION_TIMEOUT_TYPE.STICKY));-}--MiddlewareRegistry.register((store: IStore) => (next: Function) => (action: any) => {- const result = next(action);- const { dispatch, getState } = store;-- switch (action.type) {- case CONFERENCE_JOINED: {- // Enabled by default (see isTimeTimerEnabled). A deployment opts out- // with `timeTimer: { enabled: false }` to hide it even when a- // duration is available (e.g. calendar users who don't want it).- if (isTimeTimerEnabled(getState())) {- const { calendarDurationSeconds, calendarStartTimeUnix, calendarUrl }- = getState()['features/time-timer'];-- // A real meeting duration must come from a source: a native- // calendar event, or the `setMeetingTimer` iframe API command at- // runtime. With nothing here we DON'T start the timer — there is- // no meaningful countdown to show for a meeting we have no- // schedule for. The iframe-API path drives the timer later, on- // its own, independent of this join-time check.- //- // The calendar duration is only honoured when it was recorded for- // the room actually being joined — otherwise a duration left over- // from a meeting the user opened but bailed on at prejoin would- // leak into a different meeting. Compare by room name (robust to- // differing URL forms) rather than raw URL equality, and- // case-insensitively since room names are normalised to lowercase- // while a calendar URL may preserve the original casing.- const calendarRoom = calendarUrl ? parseURIString(calendarUrl)?.room?.toLowerCase() : undefined;- const joinedRoom = getRoomName(getState())?.toLowerCase();- const calendarMatchesRoom = !calendarRoom || calendarRoom === joinedRoom;-- if (calendarMatchesRoom- && typeof calendarDurationSeconds === 'number' && calendarDurationSeconds > 0) {- // Elapsed-since-SCHEDULED-START is the single source of truth,- // anchored to the calendar event's absolute start time — never- // to when this particular participant joined. That keeps the- // displayed time identical for everyone at a given wall-clock- // moment, regardless of who joins early (including the- // organizer). It MAY be negative (joined before the scheduled- // start) or exceed the duration (joined after the scheduled- // end); the reducer pins the scheduled end from it and derives- // the rest. A negative value naturally shows 00:00 / full- // duration until the start arrives, then counts up. With no- // start time we fall back to 0 (start counting from now).- const elapsed = typeof calendarStartTimeUnix === 'number'- ? Math.round((Date.now() - calendarStartTimeUnix) / 1000)- : 0;-- dispatch(startTimeTimer(calendarDurationSeconds, elapsed));- }- }- break;- }- case CONFERENCE_LEFT: {- // Stop the interval and fully reset the timer so the next meeting- // never inherits a frozen / expired pill or a lingering red border.- // `stopTimeTimer` resets the running state; the calendar inputs are- // cleared separately on the next selection.- _clearTick();- dispatch(stopTimeTimer());- break;- }- case START_TIME_TIMER: {- logger.info(`Timer started: duration=${action.durationSeconds}s elapsed=${action.elapsedSeconds}s`);- _clearTick();- _notifiedExpiry = false;- _tickInterval = setInterval(() => {- dispatch(tickTimeTimer());- }, 1000);-- // The reducer derives `expired` synchronously from the start values, so- // a timer that begins already past its end (late joiner / an embedder- // pushing an overrun timer) is expired from tick zero and would never- // hit the live "crossing" branch below. Post the notification here in- // that case; _notifyExpiredOnce keeps it to a single notification.- if (getState()['features/time-timer'].expired) {- _notifyExpiredOnce(dispatch);- }- break;- }- case STOP_TIME_TIMER: {- _clearTick();- _notifiedExpiry = false;-- // The timer (and thus its sticky "ended" notification) is gone — clear- // the notification so it does not outlive the timer that produced it.- dispatch({- type: HIDE_NOTIFICATION,- uid: TIME_TIMER_NOTIFICATION_ID- });- break;- }- case TICK_TIME_TIMER: {- const { expired, remainingSeconds, running, warningTriggered }- = getState()['features/time-timer'];-- if (!running) {- break;- }-- // Warning crossing — fire the one-time attention-grab the moment we- // enter the final `WARNING_THRESHOLD_SECONDS`. Using `<=` (rather than- // an exact match) keeps it robust to a throttled background tab that- // snaps several seconds forward in a single tick. `warningTriggered`- // is one-shot and is also pre-set at start when joining mid-warning,- // so the animation is suppressed in that case.- if (!warningTriggered && !expired && remainingSeconds <= WARNING_THRESHOLD_SECONDS) {- dispatch(setTimeTimerWarningTriggered());- dispatch(showToolbox());- }-- // First moment we cross the scheduled end live: flag expired and give- // the bar the same one-time attention-grab expand we use at the- // warning threshold. The `!expired` guard runs this only on the- // transition tick.- if (remainingSeconds <= 0 && !expired) {- dispatch(setTimeTimerExpired());- dispatch(showToolbox());- }-- // Post the sticky "ended" notification while expired. _notifyExpiredOnce- // makes it fire exactly once per timer — covering both the live- // crossing above and the already-expired-at-start case handled in- // START_TIME_TIMER.- if (remainingSeconds <= 0) {- _notifyExpiredOnce(dispatch);- }- break;- }- case HIDE_NOTIFICATION: {- // The user (or anything else) closed our timer-ended notification —- // treat that as acknowledgment, which clears the red border around- // the conference grid (Conference.tsx reads expired && !acknowledged).- if (action.uid === TIME_TIMER_NOTIFICATION_ID) {- dispatch(setTimeTimerAcknowledged());- }- break;- }- }-- return result;-});diff --git a/react/features/time-timer/types.ts b/react/features/time-timer/types.tsnew file mode 100644index 0000000000..8ae199a075--- /dev/null+++ b/react/features/time-timer/types.ts@@ -0,0 +1,49 @@+/**+ * Visual state of the time-timer disk, derived from the reducer state by+ * {@code getTimerVisualState} and consumed by the pill/disk components.+ */+export interface ITimerVisualState {++ /**+ * Time elapsed since the calendar event's scheduled start, in seconds.+ * Derived so every participant sees the same value regardless of when+ * they joined.+ */+ elapsedSeconds: number;++ /**+ * Disk fill colour (blue running, amber in the warning window, red once+ * over schedule).+ */+ fillColor: string;++ /**+ * Fraction of the disk to fill (0..1).+ */+ fraction: number;++ /**+ * Leading-edge angle (degrees clockwise from 12 o'clock) of the overrun+ * sweep during lap 2+, once the disk has filled once. `undefined` while+ * running, warning, and the first overrun lap (a plain growing wedge).+ */+ overrunArcEndDeg?: number;++ /**+ * True during the warning window — the final+ * {@code WARNING_THRESHOLD_SECONDS} before scheduled end.+ */+ warning: boolean;+}++/**+ * A calendar event, limited to the fields {@code computeCalendarTimerDuration}+ * reads. {@code startDate}/{@code endDate} are already epoch-ms numbers by the+ * time an event reaches redux (see {@code _parseCalendarEntry}); a string is+ * also accepted and coerced in case a raw ISO event is ever passed in directly.+ */+export interface ICalendarTimerEvent {+ endDate?: number | string;+ startDate?: number | string;+ url?: string;+}