Android: more android development, working version

This commit is contained in:
Pieter Vander Vennet 2025-02-13 22:07:45 +01:00
parent 6224ff2c09
commit 770a4bab55
6 changed files with 11 additions and 3 deletions

@ -1 +1 @@
Subproject commit 5404e60179044de90ad1b3d98e5e45e0efe5820a
Subproject commit 5ca477e3fb53129803fffb631d5465206fccc1c4

View file

@ -4,6 +4,7 @@ import { Utils } from "../src/Utils"
import { UIEventSource } from "../src/Logic/UIEventSource"
import { VariableUiElement } from "../src/UI/Base/VariableUIElement"
import Combine from "../src/UI/Base/Combine"
import { QueryParameters } from "../src/Logic/Web/QueryParameters"
console.log("Authorizing...")
const key = Constants.osmAuthConfig.url + "oauth2_state"
@ -36,6 +37,7 @@ connection.finishLogin(async () => {
debug.set(dbg)
if (attempt > 10) {
QueryParameters.ClearAll()
window.location.reload()
}
} while (!token)

View file

@ -154,7 +154,7 @@
"#": "Android development",
"android:prepare": "./scripts/prepareAndroid.sh",
"android:build": "./scripts/buildAndroid.sh",
"android:upload": "scp ./android/app/build/outputs/apk/release/app-release.apk hetzner:apk/mapcomplete-latest.apk && scp ./android/app/build/outputs/apk/release/app-release-unsigned.apk hetzner:app/mapcomplete-latest.apk",
"android:upload": "scp ./android/app/build/outputs/apk/release/app-release.apk hetzner:apk/mapcomplete-latest.apk && scp ./android/app/build/outputs/apk/release/app-release.apk hetzner:app/mapcomplete-latest.apk",
"android:uninstall": "adb shell pm uninstall org.mapcomplete"
},
"keywords": [

Binary file not shown.

After

(image error) Size: 990 KiB

View file

@ -589,7 +589,10 @@ export class OsmConnection {
// We are probably already logged in
return
}
const token = await AndroidPolyfill.requestLoginCodes()
const tokenPromise = AndroidPolyfill.requestLoginCodes()
console.trace("Opening login page")
await AndroidPolyfill.openLoginPage()
const token = await tokenPromise
console.log("Got login token!", token)
localStorage.setItem(key, token)
if (this.auth.authenticated()) {

View file

@ -70,6 +70,9 @@ export class AndroidPolyfill {
AndroidPolyfill.backfillGeolocation(AndroidPolyfill.databridgePlugin)
}
public static async openLoginPage(){
await DatabridgePluginSingleton.request<{ oauth_token: string }>({ key: "open:login" })
}
public static async requestLoginCodes() {
const result = await DatabridgePluginSingleton.request<{ oauth_token: string }>({
key: "request:login",