forked from MapComplete/MapComplete
Android: WIP
This commit is contained in:
parent
2e5ab74114
commit
e7eb4bde18
5 changed files with 45 additions and 1 deletions
2
android
2
android
|
@ -1 +1 @@
|
|||
Subproject commit 653a12bb198e50191ea4496ddbacf468e4ba963c
|
||||
Subproject commit 9102d6ef876bf50bae9fd5c6ffec251e4d44276f
|
|
@ -39,6 +39,7 @@
|
|||
<a rel="me" href="https://en.osm.town/@MapComplete" class="hidden">Mastodon</a>
|
||||
|
||||
<div id="main"></div>
|
||||
<script src="./src/Logic/Web/AndroidPolyfill.ts" type="module"></script>
|
||||
<script type="module" src="./src/all_themes_index.ts"></script>
|
||||
<script async data-goatcounter="https://pietervdvn.goatcounter.com/count" src="https://gc.zgo.at/count.js" crossorigin="anonymous"
|
||||
integrity="sha384-QfJMxHNngbaF6IXH2kBwubsLYh7GVSFmJOX1O1YKJBq+zv1VVypB9BysTzyG1D1U"></script>
|
||||
|
|
38
src/Logic/Web/AndroidPolyfill.ts
Normal file
38
src/Logic/Web/AndroidPolyfill.ts
Normal file
|
@ -0,0 +1,38 @@
|
|||
/**
|
||||
* The Android Polyfill will attempt to communicate with the Anrdoid Shell.
|
||||
* If this is successful, it will patch some webAPIs
|
||||
*/
|
||||
import { registerPlugin } from "@capacitor/core"
|
||||
|
||||
export class AndroidPolyfill {
|
||||
private readonly databridgePlugin: DatabridgePlugin
|
||||
|
||||
constructor() {
|
||||
this.databridgePlugin = registerPlugin<DatabridgePlugin>("Databridge", {
|
||||
web: () => {
|
||||
return <DatabridgePlugin>{
|
||||
async request(options: { key: string }): Promise<{ value: string }> {
|
||||
return { value: "web" }
|
||||
},
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
public async init(){
|
||||
const shell = await this.databridgePlugin.request({ key: "meta" })
|
||||
if(shell.value === "web"){
|
||||
console.log("Not initing Android polyfill; web detected")
|
||||
return
|
||||
}
|
||||
console.log("Detected shell:", shell.value)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export interface DatabridgePlugin {
|
||||
request(options: { key: string }): Promise<{ value: string }>;
|
||||
}
|
||||
|
||||
new AndroidPolyfill().init()
|
4
src/assets/svg/Mapcomplete_logo_centered.svelte
Normal file
4
src/assets/svg/Mapcomplete_logo_centered.svelte
Normal file
File diff suppressed because one or more lines are too long
|
@ -91,6 +91,7 @@
|
|||
|
||||
<div aria-hidden="true" id="belowmap" class="absolute top-0 left-0 -z-10">Below</div>
|
||||
<script src="./src/UI/RemoveOtherLanguages.ts" type="module"></script>
|
||||
<script src="./src/Logic/Web/AndroidPolyfill.ts" type="module"></script>
|
||||
<script async src="./src/InstallServiceWorker.ts" type="module"></script>
|
||||
<script defer src="./src/index.ts" type="module"></script>
|
||||
<script async data-goatcounter="https://pietervdvn.goatcounter.com/count" src="https://gc.zgo.at/count.js" crossorigin="anonymous" integrity="sha384-QfJMxHNngbaF6IXH2kBwubsLYh7GVSFmJOX1O1YKJBq+zv1VVypB9BysTzyG1D1U"></script>
|
||||
|
|
Loading…
Add table
Reference in a new issue