calidion
09/27/2023, 7:07 AMActivityResultLauncher<Intent> vpnLauncher = registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
new ActivityResultCallback<ActivityResult>() {
@Override
public void onActivityResult(ActivityResult result) {
if (result.getResultCode() != Activity.RESULT_OK) {
app.startProxyService();
}
}
});
You can see how ugly this api is: redundant, repetitive, vague to understand.
Obviously It can be simplified like this:
Launcher<Intent> vpnLaucher = new Launcher().onResult((Result result) { .... })Ian Lake
09/27/2023, 5:06 PMlaunch
is intentional and necessary: https://kotlinlang.slack.com/archives/C0B8M7BUY/p1694440647301139?thread_ts=1694438126.574999&cid=C0B8M7BUYcalidion
09/27/2023, 7:30 PMcalidion
09/27/2023, 7:32 PM