diff --git a/src/Logic/Osm/OsmConnection.ts b/src/Logic/Osm/OsmConnection.ts index 9e5160e14..9c1ef7b74 100644 --- a/src/Logic/Osm/OsmConnection.ts +++ b/src/Logic/Osm/OsmConnection.ts @@ -619,7 +619,7 @@ export class OsmConnection { return } const tokenPromise = AndroidPolyfill.requestLoginCodes() - console.trace("Opening login page") + console.trace("Opening login page for android") await AndroidPolyfill.openLoginPage() const token = await tokenPromise console.log("Got login token!", token) diff --git a/src/Logic/Web/AndroidPolyfill.ts b/src/Logic/Web/AndroidPolyfill.ts index 00c41f6f8..1c54ae5e3 100644 --- a/src/Logic/Web/AndroidPolyfill.ts +++ b/src/Logic/Web/AndroidPolyfill.ts @@ -4,7 +4,6 @@ */ import { registerPlugin } from "@capacitor/core" import { Store, UIEventSource } from "../UIEventSource" -import { OsmConnection } from "../Osm/OsmConnection" export interface DatabridgePlugin { request(options: { @@ -70,9 +69,19 @@ export class AndroidPolyfill { AndroidPolyfill.backfillGeolocation(AndroidPolyfill.databridgePlugin) } - public static async openLoginPage() { - await DatabridgePluginSingleton.request<{ oauth_token: string }>({ key: "open:login" }) + /** + * Actually opens the login page + * Note that the actual token is handled by requestLoginCodes + */ + public static async openLoginPage(): Promise { + await DatabridgePluginSingleton.request({ key: "open:login" }) } + + /** + * Installs a callback that might eventually get the login token. + * It requests the login codes to the shell, not to the user. + * This method can be called without bothering the user. + */ public static async requestLoginCodes() { const result = await DatabridgePluginSingleton.request<{ oauth_token: string }>({ key: "request:login",