1- import React , { Suspense , useEffect , useState } from 'react'
1+ import React , { Suspense , useEffect , useLayoutEffect , useState } from 'react'
22import 'react-contexify/dist/ReactContexify.css'
33import 'src/assets/App.css'
44import { Footer , Header } from 'src/components/Layout'
55import { BookmarksSidebar } from 'src/features/bookmarks'
66import { MarketingBanner } from 'src/features/MarketingBanner'
77import { setupAnalytics , setupIdentification , trackPageView } from 'src/lib/analytics'
88import { useUserPreferences } from 'src/stores/preferences'
9+ import { diffBetweenTwoDatesInDays } from 'src/utils/DateUtils'
910import { AppContentLayout , ScrollCardsNavigator } from './components/Layout'
1011import { isWebOrExtensionVersion } from './utils/Environment'
12+ import { getAppVersion } from './utils/Os'
1113
1214const OnboardingModal = React . lazy ( ( ) =>
1315 import ( 'src/features/onboarding' ) . then ( ( module ) => ( { default : module . OnboardingModal } ) )
@@ -17,7 +19,17 @@ function App() {
1719 const [ showSideBar , setShowSideBar ] = useState ( false )
1820 const [ showSettings , setShowSettings ] = useState ( false )
1921 const [ showOnboarding , setShowOnboarding ] = useState ( true )
20- const { onboardingCompleted } = useUserPreferences ( )
22+ const { onboardingCompleted, firstSeenDate, markOnboardingAsCompleted } = useUserPreferences ( )
23+
24+ useLayoutEffect ( ( ) => {
25+ if ( ! onboardingCompleted && getAppVersion ( ) <= '1.15.9' ) {
26+ const usageDays = diffBetweenTwoDatesInDays ( firstSeenDate , Date . now ( ) )
27+ if ( usageDays > 0 ) {
28+ markOnboardingAsCompleted ( null )
29+ }
30+ }
31+ // eslint-disable-next-line react-hooks/exhaustive-deps
32+ } , [ onboardingCompleted , firstSeenDate ] )
2133
2234 useEffect ( ( ) => {
2335 setupAnalytics ( )
0 commit comments