|
@@ -143,6 +143,9 @@ import androidx.fragment.app.DialogFragment;
|
|
import androidx.fragment.app.Fragment;
|
|
import androidx.fragment.app.Fragment;
|
|
import androidx.fragment.app.FragmentManager;
|
|
import androidx.fragment.app.FragmentManager;
|
|
import androidx.fragment.app.FragmentTransaction;
|
|
import androidx.fragment.app.FragmentTransaction;
|
|
|
|
+import androidx.lifecycle.Lifecycle;
|
|
|
|
+import androidx.lifecycle.LifecycleEventObserver;
|
|
|
|
+import androidx.lifecycle.ProcessLifecycleOwner;
|
|
import de.cotech.hw.fido.WebViewFidoBridge;
|
|
import de.cotech.hw.fido.WebViewFidoBridge;
|
|
import de.cotech.hw.fido.ui.FidoDialogOptions;
|
|
import de.cotech.hw.fido.ui.FidoDialogOptions;
|
|
import de.cotech.hw.fido2.WebViewWebauthnBridge;
|
|
import de.cotech.hw.fido2.WebViewWebauthnBridge;
|
|
@@ -360,10 +363,18 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
}
|
|
}
|
|
|
|
|
|
initServerPreFragment(savedInstanceState);
|
|
initServerPreFragment(savedInstanceState);
|
|
|
|
+ ProcessLifecycleOwner.get().getLifecycle().addObserver(lifecycleEventObserver);
|
|
|
|
|
|
// webViewUtil.checkWebViewVersion();
|
|
// webViewUtil.checkWebViewVersion();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private final LifecycleEventObserver lifecycleEventObserver = ((lifecycleOwner, event) -> {
|
|
|
|
+ if (event == Lifecycle.Event.ON_START && token != null) {
|
|
|
|
+ Log_OC.d(TAG, "Start poolLogin");
|
|
|
|
+ poolLogin(clientFactory.createPlainClient());
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
private void deleteCookies() {
|
|
private void deleteCookies() {
|
|
try {
|
|
try {
|
|
CookieSyncManager.createInstance(this);
|
|
CookieSyncManager.createInstance(this);
|
|
@@ -403,7 +414,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
String loginUrl = login;
|
|
String loginUrl = login;
|
|
runOnUiThread(() -> {
|
|
runOnUiThread(() -> {
|
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(loginUrl));
|
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(loginUrl));
|
|
- loginFlowResultLauncher.launch(intent);
|
|
|
|
|
|
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
|
+ startActivity(intent);
|
|
});
|
|
});
|
|
|
|
|
|
token = jsonObject.getAsJsonObject("poll").get("token").getAsString();
|
|
token = jsonObject.getAsJsonObject("poll").get("token").getAsString();
|
|
@@ -412,9 +424,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
thread.start();
|
|
thread.start();
|
|
}
|
|
}
|
|
|
|
|
|
- private final ActivityResultLauncher<Intent> loginFlowResultLauncher = registerForActivityResult(
|
|
|
|
- new ActivityResultContracts.StartActivityForResult(), result -> poolLogin(clientFactory.createPlainClient()));
|
|
|
|
-
|
|
|
|
private static String getWebLoginUserAgent() {
|
|
private static String getWebLoginUserAgent() {
|
|
return Build.MANUFACTURER.substring(0, 1).toUpperCase(Locale.getDefault()) +
|
|
return Build.MANUFACTURER.substring(0, 1).toUpperCase(Locale.getDefault()) +
|
|
Build.MANUFACTURER.substring(1).toLowerCase(Locale.getDefault()) + " " + Build.MODEL + " (Android)";
|
|
Build.MANUFACTURER.substring(1).toLowerCase(Locale.getDefault()) + " " + Build.MODEL + " (Android)";
|
|
@@ -828,6 +837,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
mOperationsServiceBinder = null;
|
|
mOperationsServiceBinder = null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ Log_OC.d(TAG, "AuthenticatorActivity onDestroy called");
|
|
|
|
+
|
|
super.onDestroy();
|
|
super.onDestroy();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1039,6 +1050,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
|
|
|
cancelButton.setOnClickListener(v -> {
|
|
cancelButton.setOnClickListener(v -> {
|
|
loginFlowExecutorService.shutdown();
|
|
loginFlowExecutorService.shutdown();
|
|
|
|
+ ProcessLifecycleOwner.get().getLifecycle().removeObserver(lifecycleEventObserver);
|
|
recreate();
|
|
recreate();
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -1638,7 +1650,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
private boolean isRedirectedToTheDefaultBrowser = false;
|
|
private boolean isRedirectedToTheDefaultBrowser = false;
|
|
|
|
|
|
private void poolLogin(PlainClient client) {
|
|
private void poolLogin(PlainClient client) {
|
|
- loginFlowExecutorService.scheduleAtFixedRate(() -> {
|
|
|
|
|
|
+ loginFlowExecutorService.scheduleWithFixedDelay(() -> {
|
|
if (!isLoginProcessCompleted) {
|
|
if (!isLoginProcessCompleted) {
|
|
performLoginFlowV2(client);
|
|
performLoginFlowV2(client);
|
|
}
|
|
}
|
|
@@ -1694,6 +1706,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
|
|
|
checkOcServer();
|
|
checkOcServer();
|
|
loginFlowExecutorService.shutdown();
|
|
loginFlowExecutorService.shutdown();
|
|
|
|
+ ProcessLifecycleOwner.get().getLifecycle().removeObserver(lifecycleEventObserver);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|