Skip to content
Snippets Groups Projects
Commit d3b38cfd authored by Yoan VALLET's avatar Yoan VALLET
Browse files

feat: send firstConnection event

parent 883b9a3a
1 merge request!348Features/create aggregation usage service
......@@ -68,9 +68,6 @@ const SplashRoot = ({
splashStart: false,
})
const [error, setError] = useState<Error | null>(null)
const { isFirstConnection } = useSelector(
(state: AppStore) => state.ecolyo.profile
)
const dispatch: Dispatch<
| ChallengeActionTypes
| ChartActionTypes
......@@ -198,16 +195,18 @@ const SplashRoot = ({
}
}
}
await UsageEventService.addEvent(client, {
type: isFirstConnection
? UsageEventType.FIRST_CONNECTION_EVENT
: UsageEventType.CONNECTION_EVENT,
context: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent
)
? 'mobile'
: 'desktop',
})
if (profile) {
await UsageEventService.addEvent(client, {
type: profile.isFirstConnection
? UsageEventType.FIRST_CONNECTION_EVENT
: UsageEventType.CONNECTION_EVENT,
context: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent
)
? 'mobile'
: 'desktop',
})
}
setState(prev => ({
...prev,
splashStart: true,
......@@ -220,7 +219,7 @@ const SplashRoot = ({
return () => {
subscribed = false
}
}, [client, dispatch, setValidExploration, isFirstConnection])
}, [client, dispatch, setValidExploration])
return (
<>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment