Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth: Fix login page flickering when there is no account #2537

Merged
merged 2 commits into from
Sep 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ import org.microg.gms.auth.credentials.FEATURES
import org.microg.gms.auth.signin.CLIENT_PACKAGE_NAME
import org.microg.gms.auth.signin.GOOGLE_SIGN_IN_OPTIONS
import org.microg.gms.auth.signin.performSignOut
import org.microg.gms.common.Constants
import org.microg.gms.common.GmsService
import org.microg.gms.fido.core.ui.AuthenticatorActivity
import org.microg.gms.fido.core.ui.AuthenticatorActivity.Companion.KEY_OPTIONS
import org.microg.gms.fido.core.ui.AuthenticatorActivity.Companion.KEY_SERVICE
import org.microg.gms.fido.core.ui.AuthenticatorActivity.Companion.KEY_SOURCE
Expand Down Expand Up @@ -76,6 +74,12 @@ class IdentitySignInServiceImpl(private val context: Context, private val client
Log.d(TAG, "method 'beginSignIn' called")
Log.d(TAG, "request-> $request")
if (request.googleIdTokenRequestOptions.isSupported) {
val accounts = AccountManager.get(context).getAccountsByType(AuthConstants.DEFAULT_ACCOUNT_TYPE)
if (accounts.isEmpty()) {
Log.d(TAG, "accounts is empty, return CANCELED ")
callback.onResult(Status.CANCELED, null)
return
}
if (request.googleIdTokenRequestOptions.serverClientId.isNullOrEmpty()) {
Log.d(TAG, "serverClientId is empty, return CANCELED ")
callback.onResult(Status.CANCELED, null)
Expand Down