Fix: some platform issues
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Dorian Zedler 2022-08-06 22:21:36 +02:00
parent b5939743db
commit 7d09399f00
Signed by: dorian
GPG key ID: 989DE36109AFA354

View file

@ -12,10 +12,10 @@
<div class="lead d-none" id="lead"> <div class="lead d-none" id="lead">
{{ .Content }} {{ .Content }}
</div> </div>
<p class="warning d-none" id="warningiOS">{{ i18n "warningIOS" }}</p> <p class="warning d-none" id="warning-ios">{{ i18n "warningIOS" }}</p>
<p class="warning d-none" id="warningAndroid">{{ i18n "warningAndroid" }}</p> <p class="warning d-none" id="warning-android">{{ i18n "warningAndroid" }}</p>
<h1 class="headline headline-heavy d-none" id="infoiOS">{{ i18n "infoIOS" }}</h1> <h1 class="headline headline-heavy d-none" id="info-ios">{{ i18n "infoIOS" }}</h1>
<h1 class="headline headline-heavy d-none" id="infoAndroid">{{ i18n "infoAndroid" }}</h1> <h1 class="headline headline-heavy d-none" id="info-android">{{ i18n "infoAndroid" }}</h1>
<a class="d-none originalUrl" id="directUrl" href="" target="_blank" rel="noopener noreferrer">{{ i18n "directUrl" site.Params.appName }}</a> <a class="d-none originalUrl" id="directUrl" href="" target="_blank" rel="noopener noreferrer">{{ i18n "directUrl" site.Params.appName }}</a>
<a class="d-none originalUrl" id="alternativeUrl" href="" target="_blank" rel="noopener noreferrer">{{ default (i18n "alternativeUrl") .Page.Params.alternativeUrlDescription }}</a> <a class="d-none originalUrl" id="alternativeUrl" href="" target="_blank" rel="noopener noreferrer">{{ default (i18n "alternativeUrl") .Page.Params.alternativeUrlDescription }}</a>
@ -40,7 +40,7 @@
<script src="{{site.BaseURL}}/assets/js/ua-parser.pack.js"></script> <script src="{{site.BaseURL}}/assets/js/ua-parser.pack.js"></script>
<script> <script>
const Platforms = { "Android": "Android", "iOS": "iOS", "Unsupported": "Unsupported" }; const Platforms = { "android": "android", "ios": "ios", "Unsupported": "Unsupported" };
Object.freeze(Platforms); Object.freeze(Platforms);
const DirectLinkingCompatibility = { "Full": "Full", "Manual": "Manual", "None": "None" }; const DirectLinkingCompatibility = { "Full": "Full", "Manual": "Manual", "None": "None" };
Object.freeze(DirectLinkingCompatibility); Object.freeze(DirectLinkingCompatibility);
@ -50,7 +50,7 @@
let platform; let platform;
if (Platforms.hasOwnProperty(parser.getOS().name)) if (Platforms.hasOwnProperty(parser.getOS().name))
platform = parser.getOS().name; platform = parser.getOS().name.toLowerCase();
else else
platform = Platforms.Unsupported; platform = Platforms.Unsupported;
@ -58,13 +58,13 @@
console.log("Detected browser: ", parser.getBrowser().name); console.log("Detected browser: ", parser.getBrowser().name);
const directLinkingCompatibility = { const directLinkingCompatibility = {
"Android": parser.getBrowser().name === "Chrome" ? "android": parser.getBrowser().name === "Chrome" ?
DirectLinkingCompatibility.Full : DirectLinkingCompatibility.Full :
(parser.getBrowser().name === "Firefox" ? (parser.getBrowser().name === "Firefox" ?
DirectLinkingCompatibility.Manual : DirectLinkingCompatibility.Manual :
DirectLinkingCompatibility.None), DirectLinkingCompatibility.None),
"iOS": parser.getBrowser().name === "Mobile Safari" ? "ios": parser.getBrowser().name === "Mobile Safari" ?
DirectLinkingCompatibility.Manual : DirectLinkingCompatibility.Manual :
DirectLinkingCompatibility.None, DirectLinkingCompatibility.None,
@ -91,13 +91,13 @@
directUrlElement.href = directUrl; directUrlElement.href = directUrl;
if (directLinkingCompatibility === DirectLinkingCompatibility.Manual) if (directLinkingCompatibility === DirectLinkingCompatibility.Manual)
document.getElementById("info" + platform).classList.remove("d-none"); document.getElementById("info-" + platform).classList.remove("d-none");
document.getElementById("downloadInfo").classList.remove("d-none"); document.getElementById("downloadInfo").classList.remove("d-none");
document.getElementById("headline").classList.add("d-none"); document.getElementById("headline").classList.add("d-none");
} }
else if (directUrl && platform !== Platforms.Unsupported && directLinkingCompatibility === DirectLinkingCompatibility.None) { else if (directUrl && platform !== Platforms.Unsupported && directLinkingCompatibility === DirectLinkingCompatibility.None) {
document.getElementById("warning" + platform).classList.remove("d-none"); document.getElementById("warning-" + platform).classList.remove("d-none");
document.getElementById("downloadInfo").classList.remove("d-none"); document.getElementById("downloadInfo").classList.remove("d-none");
document.getElementById("headline").classList.add("d-none"); document.getElementById("headline").classList.add("d-none");
} }
@ -110,10 +110,10 @@
} }
switch (platform) { switch (platform) {
case Platforms.iOS: case Platforms.ios:
document.getElementById("store_android").classList.add("d-none"); document.getElementById("store_google").classList.add("d-none");
break; break;
case Platforms.Android: case Platforms.android:
document.getElementById("store_apple").classList.add("d-none"); document.getElementById("store_apple").classList.add("d-none");
break; break;
case Platforms.Unsupported: case Platforms.Unsupported: