Android: small fixes

This commit is contained in:
Pieter Vander Vennet 2025-01-22 02:26:02 +01:00
parent 7ebccfafd0
commit a71994859e
3 changed files with 18 additions and 17 deletions

@ -1 +1 @@
Subproject commit 891edcc0a354e55fd96e84bea93741a78f5c3dde Subproject commit 58f2e79ef0494ce39208007fe272cf86761172b0

View file

@ -64,20 +64,18 @@
use:set_placeholder={placeholder} use:set_placeholder={placeholder}
use:ariaLabel={placeholder} use:ariaLabel={placeholder}
/> />
{#if !isAndroid} <!-- Show a 'clear field' icon in the searchbar. The android-build already provides this for us, hence the outer if -->
<!-- Show a 'clear field' icon in the searchbar. The android-build already provides this for us, hence the outer if --> {#if !$isAndroid $value.length > 0}
{#if $value.length > 0} <Backspace
<Backspace on:click={(e) => {
on:click={(e) => {
value.set("") value.set("")
e.preventDefault() e.preventDefault()
}} }}
color="var(--button-background)" color="var(--button-background)"
class="mr-3 h-6 w-6 cursor-pointer" class="mr-3 h-6 w-6 cursor-pointer"
/> />
{:else} {:else}
<div class="mr-3 w-6" /> <div class="mr-3 w-6" />
{/if}
{/if} {/if}
</label> </label>
</form> </form>

View file

@ -5,6 +5,7 @@
import Tr from "../Base/Tr.svelte" import Tr from "../Base/Tr.svelte"
import Translations from "../i18n/Translations" import Translations from "../i18n/Translations"
import Marker from "../Map/Marker.svelte" import Marker from "../Map/Marker.svelte"
import { AndroidPolyfill } from "../../Logic/Web/AndroidPolyfill"
export let theme: MinimalThemeInformation & { isOfficial?: boolean } export let theme: MinimalThemeInformation & { isOfficial?: boolean }
let isCustom: boolean = theme.id.startsWith("https://") || theme.id.startsWith("http://") let isCustom: boolean = theme.id.startsWith("https://") || theme.id.startsWith("http://")
@ -16,11 +17,12 @@
) )
$: description = Translations.T(theme.shortDescription) $: description = Translations.T(theme.shortDescription)
function createUrl( function createUrlDirect(
layout: { id: string; definition?: string }, layout: { id: string; definition?: string },
isCustom: boolean, isCustom: boolean,
isAndroid: boolean,
state?: { layoutToUse?: { id } } state?: { layoutToUse?: { id } }
): Store<string> { ): string {
if (layout === undefined) { if (layout === undefined) {
return undefined return undefined
} }
@ -43,9 +45,10 @@
let linkPrefix = `${path}/${layout.id.toLowerCase()}.html?` let linkPrefix = `${path}/${layout.id.toLowerCase()}.html?`
if ( if (
!isAndroid && (
location.hostname === "localhost" || location.hostname === "localhost" ||
location.hostname === "127.0.0.1" || location.hostname === "127.0.0.1" ||
location.port === "1234" location.port === "1234")
) { ) {
// Redirect to 'theme.html?layout=* instead of 'layout.html'. This is probably a debug run, where the routing does not work // Redirect to 'theme.html?layout=* instead of 'layout.html'. This is probably a debug run, where the routing does not work
linkPrefix = `${path}/theme.html?layout=${layout.id}&` linkPrefix = `${path}/theme.html?layout=${layout.id}&`
@ -60,10 +63,10 @@
hash = "#" + btoa(JSON.stringify(layout.definition)) hash = "#" + btoa(JSON.stringify(layout.definition))
} }
return new ImmutableStore<string>(`${linkPrefix}${hash}`) return `${linkPrefix}${hash}`
} }
let href = createUrl(theme, isCustom, state) let href = AndroidPolyfill.inAndroid.map(isAndroid => createUrlDirect(theme, isCustom, isAndroid, state))
</script> </script>
<a class="low-interaction my-1 flex w-full items-center text-ellipsis rounded p-1" href={$href}> <a class="low-interaction my-1 flex w-full items-center text-ellipsis rounded p-1" href={$href}>