Skip to content

Commit

Permalink
feat: force latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud AMBROSELLI committed May 28, 2024
1 parent fe22590 commit 732aa9b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions api/src/middlewares/versionCheck.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
const { he } = require("date-fns/locale");

const MINIMUM_MOBILE_APP_VERSION = 75;
const MINIMUM_MOBILE_APP_VERSION = 273;

module.exports = ({ headers: { appversion, appdevice } }, res, next) => {
if (appdevice && !appversion) return res.status(403).send({ ok: false, sendInApp: ["Veuillez mettre à jour votre application!"] });
if (appdevice && Number(appversion) < MINIMUM_MOBILE_APP_VERSION)
if (appdevice && Number(appversion) < MINIMUM_MOBILE_APP_VERSION) {
const iosLink = "https://apps.apple.com/fr/app/oz-ensemble/id1498190343";
const androidLink = "https://play.google.com/store/apps/details?id=fr.gouv.ozensemble";

return res.status(403).send({
ok: false,
sendInApp: [
"Votre application n'est pas à jour !",
"Vous pouvez la mettre à jour en cliquant sur le lien ci-dessous",
[{ text: "Mettre à jour", link: "https://ozensemble.fabrique.social.gouv.fr" }],
[{ text: "Mettre à jour", link: appdevice === "ios" ? iosLink : androidLink }],
{ cancelable: true },
],
});
}
return next();
};

0 comments on commit 732aa9b

Please sign in to comment.