Skip to content

Commit

Permalink
Change version check : android - 48 and ios 60 (#497)
Browse files Browse the repository at this point in the history
  • Loading branch information
Charlesdoiron authored Mar 27, 2024
1 parent 1c4007b commit 457472b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions api-node/src/middlewares/version-check.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type express from 'express';

const MINIMUM_MOBILE_APP_VERSION = 20;

export default function (
{
headers: { appversion, appbuild, appdevice, currentroute, authorization },
Expand Down Expand Up @@ -29,14 +27,17 @@ export default function (
const ANDROID_URL = `https://play.google.com/store/apps/details?id=${ANDROID_APP_ID}`;
const IOS_URL = `https://apps.apple.com/fr/app/id${IOS_APP_ID}`;

const storeLink = appdevice === 'ios' ? IOS_URL : ANDROID_URL;
const deviceIsIOS = appdevice === 'ios';
const storeLink = deviceIsIOS ? IOS_URL : ANDROID_URL;

const MINIMUM_MOBILE_APP_VERSION = deviceIsIOS ? 48 : 60;

if (Number(appbuild) < MINIMUM_MOBILE_APP_VERSION) {
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',
'Nouvelle version disponible',
"Nous avons corrigé des bugs et ajouté de nouvelles fonctionnalités qui nécessite une mise à jour de l'application.",
[{ text: 'Mettre à jour', link: storeLink }],
{ cancelable: true },
],
Expand Down

0 comments on commit 457472b

Please sign in to comment.