@@ -12,6 +12,7 @@ import {useSearchRouterContext} from '@components/Search/SearchRouter/SearchRout
12
12
import SearchRouterModal from '@components/Search/SearchRouter/SearchRouterModal' ;
13
13
import TestToolsModal from '@components/TestToolsModal' ;
14
14
import useActiveWorkspace from '@hooks/useActiveWorkspace' ;
15
+ import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails' ;
15
16
import useOnboardingFlowRouter from '@hooks/useOnboardingFlow' ;
16
17
import usePermissions from '@hooks/usePermissions' ;
17
18
import useResponsiveLayout from '@hooks/useResponsiveLayout' ;
@@ -235,6 +236,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie
235
236
const rootNavigatorOptions = useRootNavigatorOptions ( ) ;
236
237
const { canUseDefaultRooms} = usePermissions ( ) ;
237
238
const { activeWorkspaceID} = useActiveWorkspace ( ) ;
239
+ const currentUserPersonalDetails = useCurrentUserPersonalDetails ( ) ;
238
240
const { toggleSearch} = useSearchRouterContext ( ) ;
239
241
240
242
const modal = useRef < OnyxTypes . Modal > ( { } ) ;
@@ -406,6 +408,32 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie
406
408
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
407
409
} , [ ] ) ;
408
410
411
+ const clearStatus = ( ) => {
412
+ User . clearCustomStatus ( ) ;
413
+ User . clearDraftCustomStatus ( ) ;
414
+ } ;
415
+ useEffect ( ( ) => {
416
+ if ( ! currentUserPersonalDetails . status ?. clearAfter ) {
417
+ return ;
418
+ }
419
+ const currentTime = new Date ( ) ;
420
+ const clearAfterTime = new Date ( currentUserPersonalDetails . status . clearAfter ) ;
421
+ if ( Number . isNaN ( clearAfterTime . getTime ( ) ) ) {
422
+ return ;
423
+ }
424
+ const subMilisecondsTime = clearAfterTime . getTime ( ) - currentTime . getTime ( ) ;
425
+ if ( subMilisecondsTime > 0 ) {
426
+ const timeoutID = setTimeout ( ( ) => {
427
+ clearStatus ( ) ;
428
+ } , subMilisecondsTime ) ;
429
+ return ( ) => {
430
+ clearTimeout ( timeoutID ) ;
431
+ } ;
432
+ }
433
+
434
+ clearStatus ( ) ;
435
+ } , [ currentUserPersonalDetails . status ?. clearAfter ] ) ;
436
+
409
437
const CentralPaneScreenOptions : PlatformStackNavigationOptions = {
410
438
...hideKeyboardOnSwipe ,
411
439
headerShown : false ,
0 commit comments