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">
{{ .Content }}
</div>
<p class="warning d-none" id="warningiOS">{{ i18n "warningIOS" }}</p>
<p class="warning d-none" id="warningAndroid">{{ i18n "warningAndroid" }}</p>
<h1 class="headline headline-heavy d-none" id="infoiOS">{{ i18n "infoIOS" }}</h1>
<h1 class="headline headline-heavy d-none" id="infoAndroid">{{ i18n "infoAndroid" }}</h1>
<p class="warning d-none" id="warning-ios">{{ i18n "warningIOS" }}</p>
<p class="warning d-none" id="warning-android">{{ i18n "warningAndroid" }}</p>
<h1 class="headline headline-heavy d-none" id="info-ios">{{ i18n "infoIOS" }}</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="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>
const Platforms = { "Android": "Android", "iOS": "iOS", "Unsupported": "Unsupported" };
const Platforms = { "android": "android", "ios": "ios", "Unsupported": "Unsupported" };
Object.freeze(Platforms);
const DirectLinkingCompatibility = { "Full": "Full", "Manual": "Manual", "None": "None" };
Object.freeze(DirectLinkingCompatibility);
@ -50,7 +50,7 @@
let platform;
if (Platforms.hasOwnProperty(parser.getOS().name))
platform = parser.getOS().name;
platform = parser.getOS().name.toLowerCase();
else
platform = Platforms.Unsupported;
@ -58,13 +58,13 @@
console.log("Detected browser: ", parser.getBrowser().name);
const directLinkingCompatibility = {
"Android": parser.getBrowser().name === "Chrome" ?
"android": parser.getBrowser().name === "Chrome" ?
DirectLinkingCompatibility.Full :
(parser.getBrowser().name === "Firefox" ?
DirectLinkingCompatibility.Manual :
DirectLinkingCompatibility.None),
"iOS": parser.getBrowser().name === "Mobile Safari" ?
"ios": parser.getBrowser().name === "Mobile Safari" ?
DirectLinkingCompatibility.Manual :
DirectLinkingCompatibility.None,
@ -91,13 +91,13 @@
directUrlElement.href = directUrl;
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("headline").classList.add("d-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("headline").classList.add("d-none");
}
@ -110,10 +110,10 @@
}
switch (platform) {
case Platforms.iOS:
document.getElementById("store_android").classList.add("d-none");
case Platforms.ios:
document.getElementById("store_google").classList.add("d-none");
break;
case Platforms.Android:
case Platforms.android:
document.getElementById("store_apple").classList.add("d-none");
break;
case Platforms.Unsupported: