diff --git a/app.js b/app.js index 52eca37..4591324 100644 --- a/app.js +++ b/app.js @@ -5,11 +5,10 @@ let messageData = {}; document.addEventListener("DOMContentLoaded", () => { initAppUI(); initTabs(); + initAppPromotion(); loadData(); - setInterval(loadData, CONFIG.REFRESH_INTERVAL); }); - function initAppUI() { const fullTitle = `${CONFIG.EVENT_NAME} – Rennplan & Ergebnisse`; @@ -264,4 +263,57 @@ function formatDateTime(dateString) { hour: "2-digit", minute: "2-digit" }); +} + +function initAppPromotion() { + if (CONFIG.IOS_APP_ID) { + const meta = document.createElement("meta"); + meta.name = "apple-itunes-app"; + meta.content = `app-id=${CONFIG.IOS_APP_ID}`; + document.head.appendChild(meta); + } + renderAndroidPromo(); +} + + +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 renderAndroidPromo() { + const promo = document.getElementById("app-promo"); + if (!promo) return; + + const ua = navigator.userAgent.toLowerCase(); + const isAndroid = /android/.test(ua); + + if (!isAndroid || !CONFIG.ANDROID_PACKAGE_NAME) { + promo.classList.add("hidden"); + return; + } + + const playStoreUrl = + `https://play.google.com/store/apps/details?id=${CONFIG.ANDROID_PACKAGE_NAME}`; + + promo.innerHTML = ` +