Unverified Commit b102d48a authored by benguedj's avatar benguedj Committed by GitHub
Browse files

fix: 馃悰 Corrige le nombre d'envoie des stats pour Matomo (#551)

parent 44a7c761
......@@ -3,7 +3,7 @@ import { useMatomo } from "matomo-tracker-react-native";
import type { FC } from "react";
import * as React from "react";
// eslint-disable-next-line @typescript-eslint/no-duplicate-imports
import { useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { Dimensions, ScrollView, StyleSheet } from "react-native";
import { SwiperFlatList } from "react-native-swiper-flatlist";
......@@ -48,7 +48,6 @@ interface SlideView {
const Onboarding: FC<Props> = ({ navigation }) => {
const { trackScreenView } = useMatomo();
trackScreenView(TrackerUtils.TrackingEvent.ONBOARDING);
const slideViews: SlideView[] = [
{
description: Labels.onboarding.slidesText[0].description,
......@@ -70,6 +69,10 @@ const Onboarding: FC<Props> = ({ navigation }) => {
const [swiperCurrentIndex, setSwiperCurrentIndex] = useState(0);
const swiperRef = useRef<SwiperFlatList>(null);
useEffect(() => {
trackScreenView(TrackerUtils.TrackingEvent.ONBOARDING);
}, []);
const navigateToProfile = () => {
void StorageUtils.storeObjectValue(
StorageKeysConstants.isFirstLaunchKey,
......
......@@ -41,7 +41,6 @@ interface Props {
const Profile: FC<Props> = ({ navigation }) => {
const { trackScreenView } = useMatomo();
trackScreenView(TrackerUtils.TrackingEvent.PROFILE);
const image = <ProfileImage />;
const defaultUserContext: UserContext = {
childBirthday: null,
......@@ -96,6 +95,7 @@ const Profile: FC<Props> = ({ navigation }) => {
const [datePickerIsReady, setDatePickerIsReady] = useState(false);
useEffect(() => {
trackScreenView(TrackerUtils.TrackingEvent.PROFILE);
const initDataWithStorageValue = async () => {
const userSituationsStored = (await StorageUtils.getObjectValue(
StorageKeysConstants.userSituationsKey
......
......@@ -29,13 +29,16 @@ interface Props {
const TabCalendarScreen: FC<Props> = ({ navigation }) => {
const { trackScreenView } = useMatomo();
trackScreenView(TrackerUtils.TrackingEvent.CALENDAR);
const [childBirthday, setChildBirthday] = React.useState("");
const [eventsCalcFromBirthday, setEventsCalcFromBirthday] =
React.useState("");
const [events, setEvents] = React.useState<Event[]>([]);
const [loadingEvents, setLoadingEvents] = React.useState(false);
useEffect(() => {
trackScreenView(TrackerUtils.TrackingEvent.CALENDAR);
}, []);
const ALL_EVENTS = gql`
query GetEvents {
evenements {
......
......@@ -35,7 +35,7 @@ interface Props {
const TabHomeScreen: FC<Props> = ({ navigation }) => {
const { trackScreenView } = useMatomo();
trackScreenView(TrackerUtils.TrackingEvent.HOME);
const ALL_STEPS = gql`
query GetAllSteps {
etapes(sort: "id") {
......@@ -109,6 +109,7 @@ const TabHomeScreen: FC<Props> = ({ navigation }) => {
};
useEffect(() => {
trackScreenView(TrackerUtils.TrackingEvent.HOME);
// Permet de forcer le refresh de la page lorsque l'on arrive dessus
const unsubscribe = navigation.addListener("focus", () => {
void init();
......
......@@ -40,7 +40,6 @@ import SlidingUpPanelAddressesList from "./slidingUpPanelAddressesList.component
const TabAroundMeScreen: React.FC = () => {
const { trackScreenView } = useMatomo();
trackScreenView(TrackerUtils.TrackingEvent.CARTO);
const mapRef = useRef<MapView>();
const [postalCodeInput, setPostalCodeInput] = useState("");
const [postalCodeInvalid, setPostalCodeInvalid] = useState(false);
......@@ -81,6 +80,7 @@ const TabAroundMeScreen: React.FC = () => {
const currentUserLocatioIcon = require("../../assets/images/carto/current_location.png");
useEffect(() => {
trackScreenView(TrackerUtils.TrackingEvent.CARTO);
const checkIfSavedRegion = async () => {
const savedRegion: Region | undefined = await StorageUtils.getObjectValue(
StorageKeysConstants.cartoSavedRegion
......
......@@ -19,11 +19,11 @@ import EpdsSurveyContent from "./epdsSurveyContent.component";
const EpdsSurveyScreen: FC = () => {
const { trackScreenView } = useMatomo();
trackScreenView(TrackerUtils.TrackingEvent.EPDS);
const [onboardingIsDone, setOnboardingIsDone] = useState(false);
const [genderIsEntered, setGenderIsEntered] = useState(false);
useEffect(() => {
trackScreenView(TrackerUtils.TrackingEvent.EPDS);
const getGenderFromStorage = async () => {
const genderValue = await StorageUtils.getStringValue(
StorageKeysConstants.epdsGenderKey
......
......@@ -51,15 +51,17 @@ const ETAPE_ENFANT_3_PREMIERS_MOIS = 6;
const ListArticles: FC<Props> = ({ navigation, route }) => {
const { trackScreenView } = useMatomo();
trackScreenView(
`${TrackerUtils.TrackingEvent.ARTICLE_LIST} : ${route.params.step.nom}`
);
const screenTitle = route.params.step.nom;
const description = route.params.step.description;
const stepIsFirstThreeMonths =
route.params.step.id == ETAPE_ENFANT_3_PREMIERS_MOIS;
useEffect(() => {
trackScreenView(
`${TrackerUtils.TrackingEvent.ARTICLE_LIST} : ${route.params.step.nom}`
);
}, []);
const [filteredArticles, setFilteredArticles] = React.useState<Article[]>([]);
const STEP_ARTICLES = gql`
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment