Search in sources :

Example 6 with RestrictTo

use of androidx.annotation.RestrictTo in project FirebaseUI-Android by firebase.

the class IdpResponse method from.

@NonNull
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public static IdpResponse from(@NonNull Exception e) {
    if (e instanceof FirebaseUiException) {
        return new IdpResponse((FirebaseUiException) e);
    } else if (e instanceof FirebaseAuthAnonymousUpgradeException) {
        return ((FirebaseAuthAnonymousUpgradeException) e).getResponse();
    } else if (e instanceof FirebaseUiUserCollisionException) {
        FirebaseUiUserCollisionException collisionException = (FirebaseUiUserCollisionException) e;
        // Lint complains about providerId not being
        // in the pre-defined set of constants
        @SuppressLint("WrongConstant") User user = new User.Builder(collisionException.getProviderId(), collisionException.getEmail()).build();
        return new IdpResponse(user, /* token= */
        null, /* secret= */
        null, /* isNewUser= */
        false, new FirebaseUiException(collisionException.getErrorCode(), collisionException.getMessage()), collisionException.getCredential());
    } else {
        FirebaseUiException wrapped = new FirebaseUiException(ErrorCodes.UNKNOWN_ERROR, e.getMessage());
        wrapped.setStackTrace(e.getStackTrace());
        return new IdpResponse(wrapped);
    }
}
Also used : User(com.firebase.ui.auth.data.model.User) SuppressLint(android.annotation.SuppressLint) NonNull(androidx.annotation.NonNull) RestrictTo(androidx.annotation.RestrictTo)

Aggregations

RestrictTo (androidx.annotation.RestrictTo)6 SuppressLint (android.annotation.SuppressLint)3 Activity (android.app.Activity)2 Application (android.app.Application)2 Intent (android.content.Intent)2 Typeface (android.graphics.Typeface)2 Bundle (android.os.Bundle)2 Nullable (androidx.annotation.Nullable)2 PrintWriter (java.io.PrintWriter)2 StringWriter (java.io.StringWriter)2 WeakReference (java.lang.ref.WeakReference)2 DateFormat (java.text.DateFormat)2 SimpleDateFormat (java.text.SimpleDateFormat)2 Date (java.util.Date)2 NonNull (androidx.annotation.NonNull)1 FontFamilyFilesResourceEntry (androidx.core.content.res.FontResourcesParserCompat.FontFamilyFilesResourceEntry)1 ProviderResourceEntry (androidx.core.content.res.FontResourcesParserCompat.ProviderResourceEntry)1 DefaultErrorActivity (cat.ereza.customactivityoncrash.activity.DefaultErrorActivity)1 CompositionLayer (com.airbnb.lottie.model.layer.CompositionLayer)1 User (com.firebase.ui.auth.data.model.User)1