From 8ba4a0dfefb23cd07df1d4c9b0492b9436d69b0d Mon Sep 17 00:00:00 2001 From: Justice Arthur Date: Mon, 18 Jul 2022 18:09:01 +0000 Subject: [PATCH 1/3] fix app version check error --- src/libs/Environment/betaChecker/index.android.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libs/Environment/betaChecker/index.android.js b/src/libs/Environment/betaChecker/index.android.js index 22cfd024bdce..7a75fedaabc4 100644 --- a/src/libs/Environment/betaChecker/index.android.js +++ b/src/libs/Environment/betaChecker/index.android.js @@ -11,11 +11,16 @@ function isBetaBuild() { fetch(CONST.PLAY_STORE_URL) .then(res => res.text()) .then((text) => { - const productionVersionMatch = text.match(/]+class="htlgb"[^>]*>([-\d.]+)<\/span>/); + const productionVersionMatch = text.match(/\[\[\[\"\d+\.\d+\.\d+/); + if (!productionVersionMatch) { + resolve(false); + } + + const productionVersion = productionVersionMatch[0].match(/\d+\.\d+\.\d+/); // If we have a match for the production version regex and the current version is not the same // as the production version, we are on a beta build - const isBeta = productionVersionMatch && productionVersionMatch[1].trim() !== version; + const isBeta = productionVersion && productionVersionMatch[0].trim() !== version; resolve(isBeta); }) .catch(() => { From 39eafc84c0cfc4ca91a07ad22b7c1ccf5c3511b1 Mon Sep 17 00:00:00 2001 From: Justice Arthur Date: Mon, 18 Jul 2022 18:31:52 +0000 Subject: [PATCH 2/3] remove useless escape --- src/libs/Environment/betaChecker/index.android.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Environment/betaChecker/index.android.js b/src/libs/Environment/betaChecker/index.android.js index 7a75fedaabc4..4e6fc8cc7f4d 100644 --- a/src/libs/Environment/betaChecker/index.android.js +++ b/src/libs/Environment/betaChecker/index.android.js @@ -11,7 +11,7 @@ function isBetaBuild() { fetch(CONST.PLAY_STORE_URL) .then(res => res.text()) .then((text) => { - const productionVersionMatch = text.match(/\[\[\[\"\d+\.\d+\.\d+/); + const productionVersionMatch = text.match(/\[\[\["\d+\.\d+\.\d+/); if (!productionVersionMatch) { resolve(false); } From f676775b9ee2d11866336081d7ae0a76b6c47b84 Mon Sep 17 00:00:00 2001 From: Justice Arthur Date: Tue, 19 Jul 2022 20:31:07 +0000 Subject: [PATCH 3/3] change variable name --- src/libs/Environment/betaChecker/index.android.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libs/Environment/betaChecker/index.android.js b/src/libs/Environment/betaChecker/index.android.js index 4e6fc8cc7f4d..733f431e1553 100644 --- a/src/libs/Environment/betaChecker/index.android.js +++ b/src/libs/Environment/betaChecker/index.android.js @@ -11,16 +11,16 @@ function isBetaBuild() { fetch(CONST.PLAY_STORE_URL) .then(res => res.text()) .then((text) => { - const productionVersionMatch = text.match(/\[\[\["\d+\.\d+\.\d+/); - if (!productionVersionMatch) { + const productionVersionSearch = text.match(/\[\[\["\d+\.\d+\.\d+/); + if (!productionVersionSearch) { resolve(false); } - const productionVersion = productionVersionMatch[0].match(/\d+\.\d+\.\d+/); + const productionVersion = productionVersionSearch[0].match(/\d+\.\d+\.\d+/); // If we have a match for the production version regex and the current version is not the same // as the production version, we are on a beta build - const isBeta = productionVersion && productionVersionMatch[0].trim() !== version; + const isBeta = productionVersion && productionVersionSearch[0].trim() !== version; resolve(isBeta); }) .catch(() => {