Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: on rend l'application mano inaccessible #1856

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 9 additions & 23 deletions api/src/middleware/versionCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,13 @@ module.exports = ({ headers: { version, platform } }, res, next) => {
return next();
}

// now platform is react native app
if (!version) return res.status(403).send({ ok: false, message: "Veuillez mettre à jour votre application!" });

const appVer = version.split(".").map((d) => parseInt(d));

for (let i = 0; i < 3; i++) {
if (appVer[i] > MINIMUM_MOBILE_APP_VERSION[i]) {
return next();
} else if (appVer[i] < MINIMUM_MOBILE_APP_VERSION[i]) {
return res.status(403).send({
ok: false,
message: "Veuillez mettre à jour votre application!",
inAppMessage: [
`Veuillez mettre à jour votre application\u00A0!`,
`Les fonctionnalités de cette nouvelle version sont\u00A0:
- Compatibilité de l 'historique des actions, consultations, traitements et dossier médical (seulement consultable sur navigateur)`,
[{ text: "Télécharger la dernière version", link: `https://mano-app.fabrique.social.gouv.fr/download?ts=${Date.now()}` }],
],
});
}
}

next();
// On doit forcer les utilisateurs à télécharger à nouveau Mano
return res.status(403).send({
ok: false,
message: "Veuillez mettre à jour votre application!",
inAppMessage: [
`Mano a quitté la fabrique pour rejoindre le groupement d'intérêt public SESAN. Pour continuer à utiliser Mano, vous devez mettre à jour votre application mobile.`,
[{ text: "Télécharger la dernière version", link: `https://mano.sesan.fr/download?ts=${Date.now()}` }],
],
});
};
Loading