Stabilize login (esp on Chrome)
This commit is contained in:
parent
5404e60179
commit
6e31aff823
2 changed files with 4 additions and 1 deletions
|
@ -48,7 +48,7 @@ public class Databridge extends Plugin {
|
||||||
public void request(PluginCall call) {
|
public void request(PluginCall call) {
|
||||||
String key = call.getString("key");
|
String key = call.getString("key");
|
||||||
Log.i("databridge", "Got a call: " + key);
|
Log.i("databridge", "Got a call: " + key);
|
||||||
var c = this.responders.get(key);
|
var c = responders.get(key);
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
c.accept(call);
|
c.accept(call);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -46,7 +46,10 @@ public class MainActivity extends BridgeActivity {
|
||||||
Databridge.sendAnswerTo(pluginCall, "" + permission);
|
Databridge.sendAnswerTo(pluginCall, "" + permission);
|
||||||
});
|
});
|
||||||
Databridge.addResponder("request:login", pluginCall -> {
|
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;
|
this.authRequest = pluginCall;
|
||||||
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://app.mapcomplete.org/land.html"));
|
||||||
|
startActivity(browserIntent);
|
||||||
if (this.loginToken != null) {
|
if (this.loginToken != null) {
|
||||||
pluginCall.resolve(this.loginToken);
|
pluginCall.resolve(this.loginToken);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue