Stabilize login (esp on Chrome)

This commit is contained in:
Pieter Vander Vennet 2025-02-05 14:25:08 +01:00
parent 5404e60179
commit 6e31aff823
2 changed files with 4 additions and 1 deletions

View file

@ -48,7 +48,7 @@ public class Databridge extends Plugin {
public void request(PluginCall call) {
String key = call.getString("key");
Log.i("databridge", "Got a call: " + key);
var c = this.responders.get(key);
var c = responders.get(key);
if (c != null) {
c.accept(call);
} else {

View file

@ -46,7 +46,10 @@ public class MainActivity extends BridgeActivity {
Databridge.sendAnswerTo(pluginCall, "" + permission);
});
Databridge.addResponder("request:login", pluginCall -> {
// We got a request - open the browser on 'app.mapcomplete.org/land' to login in the browser, then pass the token along
this.authRequest = pluginCall;
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://app.mapcomplete.org/land.html"));
startActivity(browserIntent);
if (this.loginToken != null) {
pluginCall.resolve(this.loginToken);
}