Chore: update name suggestion index
This commit is contained in:
parent
917fe6a0f9
commit
5eed378cb9
1 changed files with 31 additions and 3 deletions
|
@ -4,14 +4,16 @@ import android.content.Intent;
|
|||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.ContactsContract;
|
||||
import android.util.Log;
|
||||
import android.window.OnBackInvokedDispatcher;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.getcapacitor.BridgeActivity;
|
||||
import com.getcapacitor.JSObject;
|
||||
import com.getcapacitor.Plugin;
|
||||
import com.getcapacitor.PluginCall;
|
||||
|
||||
import java.util.Objects;
|
||||
|
@ -20,6 +22,7 @@ public class MainActivity extends BridgeActivity {
|
|||
|
||||
private PluginCall locationRequest = null;
|
||||
private PluginCall authRequest = null;
|
||||
private PluginCall backbutton = null;
|
||||
|
||||
private JSObject loginToken = null;
|
||||
|
||||
|
@ -33,11 +36,28 @@ public class MainActivity extends BridgeActivity {
|
|||
});
|
||||
Databridge.addResponder("request:login", pluginCall -> {
|
||||
this.authRequest = pluginCall;
|
||||
if(this.loginToken != null){
|
||||
if (this.loginToken != null) {
|
||||
pluginCall.resolve(this.loginToken);
|
||||
}
|
||||
});
|
||||
|
||||
Databridge.addResponder("backbutton", responder -> {
|
||||
System.out.println("Received back button responder");
|
||||
this.backbutton = responder;
|
||||
responder.setKeepAlive(true);
|
||||
});
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
getOnBackInvokedDispatcher().registerOnBackInvokedCallback(OnBackInvokedDispatcher.PRIORITY_OVERLAY,
|
||||
() -> {
|
||||
System.out.println("Back button pressed");
|
||||
if(this.backbutton != null){
|
||||
Databridge.sendAnswerTo(this.backbutton, "backbutton pressed");
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private void requestPermission() {
|
||||
|
@ -75,7 +95,7 @@ public class MainActivity extends BridgeActivity {
|
|||
res.put("value", obj);
|
||||
Log.i("main", "Resolving auth call, param is " + token);
|
||||
this.loginToken = res;
|
||||
if(this.authRequest != null){
|
||||
if (this.authRequest != null) {
|
||||
this.authRequest.resolve(res);
|
||||
}
|
||||
return;
|
||||
|
@ -84,6 +104,14 @@ public class MainActivity extends BridgeActivity {
|
|||
System.out.println("Intercepted URL: " + url);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public OnBackInvokedDispatcher getOnBackInvokedDispatcher() {
|
||||
|
||||
return super.getOnBackInvokedDispatcher();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(
|
||||
int requestCode,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue