@@ -581,6 +581,22 @@ function isConsecutiveActionMadeByPreviousActor(reportActions: ReportAction[] |
581
581
return currentAction . actorAccountID === previousAction . actorAccountID ;
582
582
}
583
583
584
+ function isChronosAutomaticTimerAction ( reportAction : OnyxInputOrEntry < ReportAction > , isChronosReport : boolean ) : boolean {
585
+ const isAutomaticStartTimerAction = ( ) => / s t a r t (?: e d | i n g ) ? (?: \s n o w ) ? / i. test ( getReportActionText ( reportAction ) ) ;
586
+ const isAutomaticStopTimerAction = ( ) => / s t o p (?: p e d | p i n g ) ? (?: \s n o w ) ? / i. test ( getReportActionText ( reportAction ) ) ;
587
+ return isChronosReport && ( isAutomaticStartTimerAction ( ) || isAutomaticStopTimerAction ( ) ) ;
588
+ }
589
+
590
+ /**
591
+ * If the user sends consecutive actions to Chronos to automatically start/stop the timer,
592
+ * then detect that and show each individually so that the user can easily see when they were sent.
593
+ */
594
+ function isConsecutiveChronosAutomaticTimerAction ( reportActions : ReportAction [ ] , actionIndex : number , isChronosReport : boolean ) : boolean {
595
+ const previousAction = findPreviousAction ( reportActions , actionIndex ) ;
596
+ const currentAction = reportActions ?. at ( actionIndex ) ;
597
+ return isChronosAutomaticTimerAction ( currentAction , isChronosReport ) && isChronosAutomaticTimerAction ( previousAction , isChronosReport ) ;
598
+ }
599
+
584
600
/**
585
601
* Checks if a reportAction is deprecated.
586
602
*/
@@ -1834,6 +1850,7 @@ export {
1834
1850
isChronosOOOListAction ,
1835
1851
isClosedAction ,
1836
1852
isConsecutiveActionMadeByPreviousActor ,
1853
+ isConsecutiveChronosAutomaticTimerAction ,
1837
1854
isCreatedAction ,
1838
1855
isCreatedTaskReportAction ,
1839
1856
isCurrentActionUnread ,
0 commit comments