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