better android detection
This commit is contained in:
@@ -276,23 +276,17 @@ function initAppPromotion() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function detectPlatform() {
|
function isAndroidDevice() {
|
||||||
const ua = navigator.userAgent || navigator.vendor || window.opera || "";
|
return /android/i.test(navigator.userAgent || "");
|
||||||
|
|
||||||
const isAndroid = /android/i.test(ua);
|
|
||||||
|
|
||||||
const isIOS =
|
|
||||||
/iphone|ipad|ipod/i.test(ua) ||
|
|
||||||
(navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1);
|
|
||||||
|
|
||||||
return { isAndroid, isIOS, ua };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderAndroidPromo() {
|
function renderAndroidPromo() {
|
||||||
const promo = document.getElementById("app-promo");
|
const promo = document.getElementById("app-promo");
|
||||||
if (!promo) return;
|
if (!promo) return;
|
||||||
|
|
||||||
const ua = navigator.userAgent.toLowerCase();
|
const isAndroid = isAndroidDevice();
|
||||||
const isAndroid = /android/.test(ua);
|
|
||||||
|
console.log("Android detected:", isAndroid);
|
||||||
|
|
||||||
if (!isAndroid || !CONFIG.ANDROID_PACKAGE_NAME) {
|
if (!isAndroid || !CONFIG.ANDROID_PACKAGE_NAME) {
|
||||||
promo.classList.add("hidden");
|
promo.classList.add("hidden");
|
||||||
|
|||||||
Reference in New Issue
Block a user