forked from MapComplete/MapComplete
		
	Android: small fixes
This commit is contained in:
		
							parent
							
								
									7ebccfafd0
								
							
						
					
					
						commit
						a71994859e
					
				
					 3 changed files with 18 additions and 17 deletions
				
			
		
							
								
								
									
										2
									
								
								android
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								android
									
										
									
									
									
								
							|  | @ -1 +1 @@ | |||
| Subproject commit 891edcc0a354e55fd96e84bea93741a78f5c3dde | ||||
| Subproject commit 58f2e79ef0494ce39208007fe272cf86761172b0 | ||||
|  | @ -64,20 +64,18 @@ | |||
|       use:set_placeholder={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 --> | ||||
|       {#if $value.length > 0} | ||||
|         <Backspace | ||||
|           on:click={(e) => { | ||||
|     <!-- 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} | ||||
|       <Backspace | ||||
|         on:click={(e) => { | ||||
|           value.set("") | ||||
|           e.preventDefault() | ||||
|         }} | ||||
|           color="var(--button-background)" | ||||
|           class="mr-3 h-6 w-6 cursor-pointer" | ||||
|         /> | ||||
|       {:else} | ||||
|         <div class="mr-3 w-6" /> | ||||
|       {/if} | ||||
|         color="var(--button-background)" | ||||
|         class="mr-3 h-6 w-6 cursor-pointer" | ||||
|       /> | ||||
|     {:else} | ||||
|       <div class="mr-3 w-6" /> | ||||
|     {/if} | ||||
|   </label> | ||||
| </form> | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
|   import Tr from "../Base/Tr.svelte" | ||||
|   import Translations from "../i18n/Translations" | ||||
|   import Marker from "../Map/Marker.svelte" | ||||
|   import { AndroidPolyfill } from "../../Logic/Web/AndroidPolyfill" | ||||
| 
 | ||||
|   export let theme: MinimalThemeInformation & { isOfficial?: boolean } | ||||
|   let isCustom: boolean = theme.id.startsWith("https://") || theme.id.startsWith("http://") | ||||
|  | @ -16,11 +17,12 @@ | |||
|   ) | ||||
|   $: description = Translations.T(theme.shortDescription) | ||||
| 
 | ||||
|   function createUrl( | ||||
|   function createUrlDirect( | ||||
|     layout: { id: string; definition?: string }, | ||||
|     isCustom: boolean, | ||||
|     isAndroid: boolean, | ||||
|     state?: { layoutToUse?: { id } } | ||||
|   ): Store<string> { | ||||
|   ): string { | ||||
|     if (layout === undefined) { | ||||
|       return undefined | ||||
|     } | ||||
|  | @ -43,9 +45,10 @@ | |||
| 
 | ||||
|     let linkPrefix = `${path}/${layout.id.toLowerCase()}.html?` | ||||
|     if ( | ||||
|       !isAndroid && ( | ||||
|       location.hostname === "localhost" || | ||||
|       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 | ||||
|       linkPrefix = `${path}/theme.html?layout=${layout.id}&` | ||||
|  | @ -60,10 +63,10 @@ | |||
|       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> | ||||
| 
 | ||||
| <a class="low-interaction my-1 flex w-full items-center text-ellipsis rounded p-1" href={$href}> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue