-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Arnaud AMBROSELLI
committed
May 28, 2024
1 parent
fe22590
commit 732aa9b
Showing
1 changed file
with
7 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}; |