<commit_before>import React, { useCallback, useEffect } from "react";

import Button from "@agir/front/genericComponents/Button";
import FeatherIcon from "@agir/front/genericComponents/FeatherIcon";
import styled from "styled-components";
import style from "@agir/front/genericComponents/_variables.scss";
import logo from "@agir/front/genericComponents/logos/action-populaire_primary_mini.svg";

import { useMobileApp } from "@agir/front/app/hooks.js";
import { CONFIG } from "@agir/front/genericComponents/AppStore.js";
import { getMobileOS } from "@agir/front/authentication/common.js";

import {
  useDispatch,
  useSelector,
} from "@agir/front/globalContext/GlobalContext";
import {
  setBannerDownload,
  clearBannerDownload,
} from "@agir/front/globalContext/actions";
import { getIsBannerDownload } from "@agir/front/globalContext/reducers";

const StyledContainer = styled.div`
  display: flex;
  align-items: center;
  background-color: ${style.primary500};
  color: #fff;
  justify-content: space-evenly;
`;

const Title = styled.div``;
const Description = styled.div``;

const Content = styled.div`
  display: flex;
  flex-direction: column;
  padding: 12px;

  ${Title} {
    color: ${style.secondary500};
    font-weight: 700;
    font-size: 15px;
  }

  ${Description} {
    color: #fff;
    font-size: 12px;
    flex-wrap: wrap;
  }
`;

const DownloadMinus = styled(Button)`
  border-radius: 50px;
  background-color: #fff;
  width: 52px;
  height: 52px;
  color: ${style.primary500};
  font-size: 13px;
  font-weight: 700;
  justify-content: center;

  @media (min-width: 380px) {
    display: none;
  }
`;

const Download = styled(Button)`
  background-color: #fff;
  color: ${style.primary500};
  font-size: 13px;
  font-weight: 700;
  justify-content: center;

  @media (max-width: 380px) {
    display: none;
  }
`;

const InlineBlock = styled.span`
  display: inline-block;
`;

const StyledFeatherIcon = styled(FeatherIcon)`
  &:hover {
    cursor: pointer;
  }
`;

const OS = getMobileOS();
const BANNER_ID = "BANNER_download_closed";

export const DownloadApp = () => {
  const { isMobileApp } = useMobileApp();

  const dispatch = useDispatch();
  const isBannerDownload = useSelector(getIsBannerDownload);

  const closeDownload = useCallback(() => {
    dispatch(clearBannerDownload());
    window.localStorage.setItem(BANNER_ID, 1);
  }, [dispatch]);

  useEffect(() => {
    let bannerClosed = window.localStorage.getItem(BANNER_ID);
    bannerClosed = !isNaN(parseInt(bannerClosed)) ? parseInt(bannerClosed) : 0;
    let visitCount = window.localStorage.getItem("AP_vcount");
    visitCount = !isNaN(parseInt(visitCount)) ? parseInt(visitCount) : 0;

    if (visitCount % 2 === 0) {
      window.localStorage.setItem(BANNER_ID, 0);
      dispatch(setBannerDownload());
    } else {
      if (!bannerClosed) {
        dispatch(setBannerDownload());
      }
    }
  }, []);<commit_msg>fix: update counter page to 25<commit_after>import React, { useCallback, useEffect } from "react";

import Button from "@agir/front/genericComponents/Button";
import FeatherIcon from "@agir/front/genericComponents/FeatherIcon";
import styled from "styled-components";
import style from "@agir/front/genericComponents/_variables.scss";
import logo from "@agir/front/genericComponents/logos/action-populaire_primary_mini.svg";

import { useMobileApp } from "@agir/front/app/hooks.js";
import { CONFIG } from "@agir/front/genericComponents/AppStore.js";
import { getMobileOS } from "@agir/front/authentication/common.js";

import {
  useDispatch,
  useSelector,
} from "@agir/front/globalContext/GlobalContext";
import {
  setBannerDownload,
  clearBannerDownload,
} from "@agir/front/globalContext/actions";
import { getIsBannerDownload } from "@agir/front/globalContext/reducers";

const StyledContainer = styled.div`
  display: flex;
  align-items: center;
  background-color: ${style.primary500};
  color: #fff;
  justify-content: space-evenly;
`;

const Title = styled.div``;
const Description = styled.div``;

const Content = styled.div`
  display: flex;
  flex-direction: column;
  padding: 12px;

  ${Title} {
    color: ${style.secondary500};
    font-weight: 700;
    font-size: 15px;
  }

  ${Description} {
    color: #fff;
    font-size: 12px;
    flex-wrap: wrap;
  }
`;

const DownloadMinus = styled(Button)`
  border-radius: 50px;
  background-color: #fff;
  width: 52px;
  height: 52px;
  color: ${style.primary500};
  font-size: 13px;
  font-weight: 700;
  justify-content: center;

  @media (min-width: 380px) {
    display: none;
  }
`;

const Download = styled(Button)`
  background-color: #fff;
  color: ${style.primary500};
  font-size: 13px;
  font-weight: 700;
  justify-content: center;

  @media (max-width: 380px) {
    display: none;
  }
`;

const InlineBlock = styled.span`
  display: inline-block;
`;

const StyledFeatherIcon = styled(FeatherIcon)`
  &:hover {
    cursor: pointer;
  }
`;

const OS = getMobileOS();
const BANNER_ID = "BANNER_download_closed";

export const DownloadApp = () => {
  const { isMobileApp } = useMobileApp();

  const dispatch = useDispatch();
  const isBannerDownload = useSelector(getIsBannerDownload);

  const closeDownload = useCallback(() => {
    dispatch(clearBannerDownload());
    window.localStorage.setItem(BANNER_ID, 1);
  }, [dispatch]);

  useEffect(() => {
    let bannerClosed = window.localStorage.getItem(BANNER_ID);
    bannerClosed = !isNaN(parseInt(bannerClosed)) ? parseInt(bannerClosed) : 0;
    let visitCount = window.localStorage.getItem("AP_vcount");
    visitCount = !isNaN(parseInt(visitCount)) ? parseInt(visitCount) : 0;

    if (visitCount % 25 === 0) {
      window.localStorage.setItem(BANNER_ID, 0);
      dispatch(setBannerDownload());
    } else {
      if (!bannerClosed) {
        dispatch(setBannerDownload());
      }
    }
  }, []);
{'fraction_non_alphanumeric': 0.14043790626069108, 'fraction_numerical': 0.017276770441327402, 'mean_word_length': 4.229874776386405, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4735907', 'n_tokens_mistral': 2054, 'n_tokens_neox': 1944, 'n_words': 401}