code
stringlengths
23
201k
docstring
stringlengths
17
96.2k
func_name
stringlengths
0
235
language
stringclasses
1 value
repo
stringlengths
8
72
path
stringlengths
11
317
url
stringlengths
57
377
license
stringclasses
7 values
@Override public void onResume() { super.onResume(); if (!mHasResumed) { // Don't check for codes before we've even had the chance to send one. mHasResumed = true; return; } ClipData clip = ContextCompat.getSystemService(requireContext(), Clipboar...
Display confirmation code to verify phone numbers input in {@link CheckPhoneNumberFragment}
onResume
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
Apache-2.0
@Override public void onSaveInstanceState(@NonNull Bundle outState) { mLooper.removeCallbacks(mCountdown); outState.putLong(EXTRA_MILLIS_UNTIL_FINISHED, mMillisUntilFinished); }
Display confirmation code to verify phone numbers input in {@link CheckPhoneNumberFragment}
onSaveInstanceState
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
Apache-2.0
@Override public void onDestroy() { super.onDestroy(); // Remove here in addition to onSaveInstanceState since it might not be called if finishing // for good. mLooper.removeCallbacks(mCountdown); }
Display confirmation code to verify phone numbers input in {@link CheckPhoneNumberFragment}
onDestroy
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
Apache-2.0
private void setupConfirmationCodeEditText() { mConfirmationCodeEditText.setText("------"); mConfirmationCodeEditText.addTextChangedListener(new BucketedTextChangeListener( mConfirmationCodeEditText, VERIFICATION_CODE_LENGTH, "-", new BucketedTextChangeListener.ContentCha...
Display confirmation code to verify phone numbers input in {@link CheckPhoneNumberFragment}
setupConfirmationCodeEditText
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
Apache-2.0
@Override public void whenComplete() { submitCode(); }
Display confirmation code to verify phone numbers input in {@link CheckPhoneNumberFragment}
whenComplete
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
Apache-2.0
@Override public void whileIncomplete() {}
Display confirmation code to verify phone numbers input in {@link CheckPhoneNumberFragment}
whileIncomplete
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
Apache-2.0
private void setupEditPhoneNumberTextView() { mPhoneTextView.setText(mPhoneNumber); mPhoneTextView.setOnClickListener(v -> requireActivity().getSupportFragmentManager().popBackStack()); }
Display confirmation code to verify phone numbers input in {@link CheckPhoneNumberFragment}
setupEditPhoneNumberTextView
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
Apache-2.0
private void setupResendConfirmationCodeTextView() { mResendCodeTextView.setOnClickListener(v -> { mHandler.verifyPhoneNumber(requireActivity(), mPhoneNumber, true); mResendCodeTextView.setVisibility(View.GONE); mCountDownTextView.setVisibility(View.VISIBLE); mCo...
Display confirmation code to verify phone numbers input in {@link CheckPhoneNumberFragment}
setupResendConfirmationCodeTextView
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
Apache-2.0
private void processCountdownTick() { mMillisUntilFinished -= TICK_INTERVAL_MILLIS; if (mMillisUntilFinished <= 0) { mCountDownTextView.setText(""); mCountDownTextView.setVisibility(View.GONE); mResendCodeTextView.setVisibility(View.VISIBLE); } else { ...
Display confirmation code to verify phone numbers input in {@link CheckPhoneNumberFragment}
processCountdownTick
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
Apache-2.0
private void submitCode() { mHandler.submitVerificationCode( mPhoneNumber, mConfirmationCodeEditText.getUnspacedText().toString()); }
Display confirmation code to verify phone numbers input in {@link CheckPhoneNumberFragment}
submitCode
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
Apache-2.0
@Override public void showProgress(int message) { mProgressBar.setVisibility(View.VISIBLE); }
Display confirmation code to verify phone numbers input in {@link CheckPhoneNumberFragment}
showProgress
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
Apache-2.0
@Override public void hideProgress() { mProgressBar.setVisibility(View.INVISIBLE); }
Display confirmation code to verify phone numbers input in {@link CheckPhoneNumberFragment}
hideProgress
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
Apache-2.0
@NonNull public static CredentialData buildCredentialDataOrThrow(@NonNull FirebaseUser user, @Nullable String password) { CredentialData credentialData = buildCredentialData(user, password); if (credentialData == null) { throw n...
Same as {@link #buildCredentialData(FirebaseUser, String)} but throws an exception if data cannot be built. @param user the FirebaseUser. @param password the password the user signed in with. @return a non-null {@link CredentialData} instance. @throws IllegalStateException if credential data cannot be constructed.
buildCredentialDataOrThrow
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/CredentialUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/CredentialUtils.java
Apache-2.0
public String getIdentifier() { return identifier; }
A simple data class representing the information required by the new CredentialManager.
getIdentifier
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/CredentialUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/CredentialUtils.java
Apache-2.0
public String getDisplayName() { return displayName; }
A simple data class representing the information required by the new CredentialManager.
getDisplayName
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/CredentialUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/CredentialUtils.java
Apache-2.0
public String getPassword() { return password; }
A simple data class representing the information required by the new CredentialManager.
getPassword
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/CredentialUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/CredentialUtils.java
Apache-2.0
public Uri getProfilePictureUri() { return profilePictureUri; }
A simple data class representing the information required by the new CredentialManager.
getProfilePictureUri
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/CredentialUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/CredentialUtils.java
Apache-2.0
public static FirebaseAuthError fromException(FirebaseAuthException ex) { try { return FirebaseAuthError.valueOf(ex.getErrorCode()); } catch (IllegalArgumentException e) { return FirebaseAuthError.ERROR_UNKNOWN; } }
Get an {@link FirebaseAuthError} from an exception, returning {@link #ERROR_UNKNOWN} as a default.
fromException
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/FirebaseAuthError.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/FirebaseAuthError.java
Apache-2.0
public String getDescription() { return description; }
Get an {@link FirebaseAuthError} from an exception, returning {@link #ERROR_UNKNOWN} as a default.
getDescription
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/FirebaseAuthError.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/FirebaseAuthError.java
Apache-2.0
@NonNull public static <T> T checkNotNull( @Nullable T val, @NonNull String errorMessageTemplate, @Nullable Object... errorMessageArgs) { if (val == null) { if (errorMessageArgs == null) { throw new NullPointerException(errorMessageTemplate); ...
Ensures that the provided value is not null, and throws a {@link NullPointerException} if it is null, with a message constructed from the provided error template and arguments.
checkNotNull
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/Preconditions.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/Preconditions.java
Apache-2.0
@StyleRes public static int checkValidStyle( @NonNull Context context, int styleId, @NonNull String errorMessageTemplate, @Nullable Object... errorMessageArguments) { try { String resourceType = context.getResources().getResourceTypeName(styleId); ...
Ensures that the provided identifier matches a known style resource, and throws an {@link IllegalArgumentException} if the resource cannot be found, or is not a style resource, with a message constructed from the provided error template and arguments.
checkValidStyle
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/Preconditions.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/Preconditions.java
Apache-2.0
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) public static void checkUnset(@NonNull Bundle b, @Nullable String message, @NonNull String... keys) { for (String key : keys) { if (b.containsKey(key)) { throw new IllegalStateExceptio...
Ensures that the provided identifier matches a known style resource, and throws an {@link IllegalArgumentException} if the resource cannot be found, or is not a style resource, with a message constructed from the provided error template and arguments.
checkUnset
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/Preconditions.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/Preconditions.java
Apache-2.0
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) public static void checkConfigured(@NonNull Context context, @Nullable String message, @StringRes int... ids) { for (int id : ids) { if (context.getString(id).equals(AuthUI.U...
Ensures that the provided identifier matches a known style resource, and throws an {@link IllegalArgumentException} if the resource cannot be found, or is not a style resource, with a message constructed from the provided error template and arguments.
checkConfigured
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/Preconditions.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/Preconditions.java
Apache-2.0
public static void checkArgument(boolean expression, String errorMessage) { if (!expression) { throw new IllegalArgumentException(errorMessage); } }
Ensures the truth of an expression involving parameters to the calling method. @param expression a boolean expression @param errorMessage the exception message to use if the check fails @throws IllegalArgumentException if {@code expression} is false
checkArgument
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/Preconditions.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/Preconditions.java
Apache-2.0
public static synchronized AuthOperationManager getInstance() { if (mAuthManager == null) { mAuthManager = new AuthOperationManager(); } return mAuthManager; }
Utilities to help with Anonymous user upgrade.
getInstance
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/AuthOperationManager.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/AuthOperationManager.java
Apache-2.0
private FirebaseApp getScratchApp(FirebaseApp defaultApp) { try { return FirebaseApp.getInstance(firebaseAppName); } catch (IllegalStateException e) { return FirebaseApp.initializeApp(defaultApp.getApplicationContext(), defaultApp.getOptions(), firebaseAppName...
Utilities to help with Anonymous user upgrade.
getScratchApp
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/AuthOperationManager.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/AuthOperationManager.java
Apache-2.0
private FirebaseAuth getScratchAuth(FlowParameters flowParameters) { // Use a different FirebaseApp so that the anonymous user state is not lost in our // original FirebaseAuth instance. if (mScratchAuth == null) { AuthUI authUI = AuthUI.getInstance(flowParameters.appName); ...
Utilities to help with Anonymous user upgrade.
getScratchAuth
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/AuthOperationManager.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/AuthOperationManager.java
Apache-2.0
public Task<AuthResult> createOrLinkUserWithEmailAndPassword(@NonNull FirebaseAuth auth, @NonNull FlowParameters flowParameters, @NonNull String email, ...
Utilities to help with Anonymous user upgrade.
createOrLinkUserWithEmailAndPassword
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/AuthOperationManager.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/AuthOperationManager.java
Apache-2.0
public Task<AuthResult> signInAndLinkWithCredential(@NonNull FirebaseAuth auth, @NonNull FlowParameters flowParameters, @NonNull AuthCredential credential) { if (canUpgradeAnonymous(auth, flowParamete...
Utilities to help with Anonymous user upgrade.
signInAndLinkWithCredential
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/AuthOperationManager.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/AuthOperationManager.java
Apache-2.0
public boolean canUpgradeAnonymous(FirebaseAuth auth, FlowParameters flowParameters) { return flowParameters.isAnonymousUpgradeEnabled() && auth.getCurrentUser() != null && auth.getCurrentUser().isAnonymous(); }
Utilities to help with Anonymous user upgrade.
canUpgradeAnonymous
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/AuthOperationManager.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/AuthOperationManager.java
Apache-2.0
@NonNull public Task<AuthResult> validateCredential(AuthCredential credential, FlowParameters flowParameters) { return getScratchAuth(flowParameters).signInWithCredential(credential); }
Utilities to help with Anonymous user upgrade.
validateCredential
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/AuthOperationManager.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/AuthOperationManager.java
Apache-2.0
public Task<AuthResult> safeLink(final AuthCredential credential, final AuthCredential credentialToLink, final FlowParameters flowParameters) { return getScratchAuth(flowParameters) .signInWithCredential(credential) ...
Utilities to help with Anonymous user upgrade.
safeLink
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/AuthOperationManager.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/AuthOperationManager.java
Apache-2.0
@NonNull public Task<AuthResult> safeGenericIdpSignIn(@NonNull final HelperActivityBase activity, @NonNull final OAuthProvider provider, @NonNull final FlowParameters flowParameters) { return getScratchAuth(flo...
Utilities to help with Anonymous user upgrade.
safeGenericIdpSignIn
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/AuthOperationManager.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/AuthOperationManager.java
Apache-2.0
public static EmailLinkPersistenceManager getInstance() { return instance; }
Manages saving/retrieving from SharedPreferences for email link sign in.
getInstance
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
Apache-2.0
public void saveEmail(@NonNull Context context, @NonNull String email, @NonNull String sessionId, @Nullable String anonymousUserId) { Preconditions.checkNotNull(context); Preconditions.checkNotNull(email); SharedPrefer...
Manages saving/retrieving from SharedPreferences for email link sign in.
saveEmail
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
Apache-2.0
public void saveIdpResponseForLinking(@NonNull Context context, @NonNull IdpResponse idpResponseForLinking) { if (idpResponseForLinking.hasCredentialForLinking()) { // Signing in via Generic IDP returns a credential that must be used for sign-in. ...
Manages saving/retrieving from SharedPreferences for email link sign in.
saveIdpResponseForLinking
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
Apache-2.0
@Nullable public SessionRecord retrieveSessionRecord(@NonNull Context context) { Preconditions.checkNotNull(context); SharedPreferences sharedPreferences = context.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE); String email = sharedPreferences.getString(KEY_EMA...
Manages saving/retrieving from SharedPreferences for email link sign in.
retrieveSessionRecord
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
Apache-2.0
public void clearAllData(@NonNull Context context) { Preconditions.checkNotNull(context); SharedPreferences sharedPreferences = context.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); for (String ke...
Manages saving/retrieving from SharedPreferences for email link sign in.
clearAllData
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
Apache-2.0
public String getSessionId() { return mSessionId; }
Holds the necessary information to complete the email link sign in flow
getSessionId
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
Apache-2.0
public String getEmail() { return mEmail; }
Holds the necessary information to complete the email link sign in flow
getEmail
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
Apache-2.0
public SessionRecord setEmail(@NonNull String email) { this.mEmail = email; return this; }
Holds the necessary information to complete the email link sign in flow
setEmail
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
Apache-2.0
@Nullable public IdpResponse getIdpResponseForLinking() { return mIdpResponseForLinking; }
Holds the necessary information to complete the email link sign in flow
getIdpResponseForLinking
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
Apache-2.0
public SessionRecord setIdpResponseForLinking(@NonNull IdpResponse idpResponseForLinking) { this.mIdpResponseForLinking = idpResponseForLinking; return this; }
Holds the necessary information to complete the email link sign in flow
setIdpResponseForLinking
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
Apache-2.0
@Nullable public String getAnonymousUserId() { return mAnonymousUserId; }
Holds the necessary information to complete the email link sign in flow
getAnonymousUserId
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/EmailLinkPersistenceManager.java
Apache-2.0
public static String format(@NonNull String phoneNumber, @NonNull CountryInfo countryInfo) { if (phoneNumber.startsWith("+")) { return phoneNumber; } else { return "+" + String.valueOf(countryInfo.getCountryCode()) + phoneNumber.replaceAll(...
This method works as follow: <ol><li>When the android version is LOLLIPOP or greater, the reliable {{@link android.telephony.PhoneNumberUtils#formatNumberToE164}} is used to format.</li> <li>For lower versions, we construct a value with the input phone number stripped of non numeric characters and prefix it with a "+" ...
format
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
Apache-2.0
@Nullable public static String formatUsingCurrentCountry(@NonNull String phoneNumber, Context context) { return format(phoneNumber, getCurrentCountryInfo(context)); }
This method uses the country returned by {@link #getCurrentCountryInfo(Context)} to format the phone number. Internally invokes {@link #format(String, CountryInfo)} @param phoneNumber that may or may not itself have country code
formatUsingCurrentCountry
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
Apache-2.0
@NonNull public static CountryInfo getCurrentCountryInfo(@NonNull Context context) { Locale locale = getSimBasedLocale(context); if (locale == null) { locale = getOSLocale(); } if (locale == null) { return DEFAULT_COUNTRY; } Integer countryC...
This method uses the country returned by {@link #getCurrentCountryInfo(Context)} to format the phone number. Internally invokes {@link #format(String, CountryInfo)} @param phoneNumber that may or may not itself have country code
getCurrentCountryInfo
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
Apache-2.0
public static PhoneNumber getPhoneNumber(@NonNull String providedPhoneNumber) { String countryCode = DEFAULT_COUNTRY_CODE; String countryIso = DEFAULT_LOCALE.getCountry(); String phoneNumber = providedPhoneNumber; if (providedPhoneNumber.startsWith("+")) { countryCode = getC...
This method should not be called on UI thread. Potentially creates a country code by iso map which can take long in some devices @param providedPhoneNumber works best when formatted as e164 @return an instance of the PhoneNumber using the SIM information
getPhoneNumber
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
Apache-2.0
public static boolean isValid(@NonNull String number) { return number.startsWith("+") && getCountryCodeForPhoneNumber(number) != null; }
This method should not be called on UI thread. Potentially creates a country code by iso map which can take long in some devices @param providedPhoneNumber works best when formatted as e164 @return an instance of the PhoneNumber using the SIM information
isValid
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
Apache-2.0
public static boolean isValidIso(@Nullable String iso) { return getCountryCode(iso) != null; }
This method should not be called on UI thread. Potentially creates a country code by iso map which can take long in some devices @param providedPhoneNumber works best when formatted as e164 @return an instance of the PhoneNumber using the SIM information
isValidIso
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
Apache-2.0
@Nullable private static String getCountryCodeForPhoneNumber(String normalizedPhoneNumber) { String phoneWithoutPlusPrefix = normalizedPhoneNumber.replaceFirst("^\\+", ""); int numberLength = phoneWithoutPlusPrefix.length(); for (int i = 1; i <= MAX_LENGTH_COUNTRY_CODE && i <= numberLength;...
Country code extracted using shortest matching prefix like libPhoneNumber. See: https://github.com/googlei18n/libphonenumber/blob/master/java/libphonenumber/src/com /google/i18n/phonenumbers/PhoneNumberUtil.java#L2395
getCountryCodeForPhoneNumber
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
Apache-2.0
@NonNull private static String getCountryCodeForPhoneNumberOrDefault(String normalizedPhoneNumber) { String code = getCountryCodeForPhoneNumber(normalizedPhoneNumber); return code == null ? DEFAULT_COUNTRY_CODE : code; }
Country code extracted using shortest matching prefix like libPhoneNumber. See: https://github.com/googlei18n/libphonenumber/blob/master/java/libphonenumber/src/com /google/i18n/phonenumbers/PhoneNumberUtil.java#L2395
getCountryCodeForPhoneNumberOrDefault
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
Apache-2.0
private static String stripCountryCode(String phoneNumber, String countryCode) { return phoneNumber.replaceFirst("^\\+?" + countryCode, ""); }
Country code extracted using shortest matching prefix like libPhoneNumber. See: https://github.com/googlei18n/libphonenumber/blob/master/java/libphonenumber/src/com /google/i18n/phonenumbers/PhoneNumberUtil.java#L2395
stripCountryCode
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
Apache-2.0
private static String stripPlusSign(String phoneNumber) { return phoneNumber.replaceFirst("^\\+?", ""); }
Country code extracted using shortest matching prefix like libPhoneNumber. See: https://github.com/googlei18n/libphonenumber/blob/master/java/libphonenumber/src/com /google/i18n/phonenumbers/PhoneNumberUtil.java#L2395
stripPlusSign
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
Apache-2.0
private static Locale getSimBasedLocale(@NonNull Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String countryIso = tm != null ? tm.getSimCountryIso() : null; return TextUtils.isEmpty(countryIso) ? null : new Locale("", countryIso...
Country code extracted using shortest matching prefix like libPhoneNumber. See: https://github.com/googlei18n/libphonenumber/blob/master/java/libphonenumber/src/com /google/i18n/phonenumbers/PhoneNumberUtil.java#L2395
getSimBasedLocale
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
Apache-2.0
private static Locale getOSLocale() { return Locale.getDefault(); }
Country code extracted using shortest matching prefix like libPhoneNumber. See: https://github.com/googlei18n/libphonenumber/blob/master/java/libphonenumber/src/com /google/i18n/phonenumbers/PhoneNumberUtil.java#L2395
getOSLocale
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
Apache-2.0
private static SparseArray<List<String>> createCountryCodeToRegionCodeMap() { SparseArray<List<String>> map = new SparseArray<>(MAX_COUNTRY_CODES); map.put(1, asList( "US", "AG", "AI", "AS", "BB", "BM", "BS", "CA", "DM", "DO", "GD", "GU", "JM", "KN", "KY", "LC", "MP", "M...
Country code extracted using shortest matching prefix like libPhoneNumber. See: https://github.com/googlei18n/libphonenumber/blob/master/java/libphonenumber/src/com /google/i18n/phonenumbers/PhoneNumberUtil.java#L2395
createCountryCodeToRegionCodeMap
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
Apache-2.0
private static void initCountryCodeByIsoMap() { Map<String, Integer> map = new HashMap<>(MAX_COUNTRIES); for (int i = 0; i < COUNTRY_TO_REGION_CODES.size(); i++) { int code = COUNTRY_TO_REGION_CODES.keyAt(i); List<String> regions = COUNTRY_TO_REGION_CODES.get(code); ...
Country code extracted using shortest matching prefix like libPhoneNumber. See: https://github.com/googlei18n/libphonenumber/blob/master/java/libphonenumber/src/com /google/i18n/phonenumbers/PhoneNumberUtil.java#L2395
initCountryCodeByIsoMap
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/PhoneNumberUtils.java
Apache-2.0
public static String providerIdToAccountType( @AuthUI.SupportedProvider @NonNull String providerId) { switch (providerId) { case GoogleAuthProvider.PROVIDER_ID: return GOOGLE_ACCOUNT_TYPE; case FacebookAuthProvider.PROVIDER_ID: return FACEBOOK_...
Translate a Firebase Auth provider ID (such as {@link GoogleAuthProvider#PROVIDER_ID}) to a Credentials API account type.
providerIdToAccountType
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/ProviderUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/ProviderUtils.java
Apache-2.0
@AuthUI.SupportedProvider public static String accountTypeToProviderId(@NonNull String accountType) { switch (accountType) { case GOOGLE_ACCOUNT_TYPE: return GoogleAuthProvider.PROVIDER_ID; case FACEBOOK_ACCOUNT_TYPE: return FacebookAuthProvider.PROVID...
Translate a Firebase Auth provider ID (such as {@link GoogleAuthProvider#PROVIDER_ID}) to a Credentials API account type.
accountTypeToProviderId
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/ProviderUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/ProviderUtils.java
Apache-2.0
public static String providerIdToProviderName(@NonNull String providerId) { switch (providerId) { case GoogleAuthProvider.PROVIDER_ID: return AuthUI.getApplicationContext().getString(R.string.fui_idp_name_google); case FacebookAuthProvider.PROVIDER_ID: ret...
Translate a Firebase Auth provider ID (such as {@link GoogleAuthProvider#PROVIDER_ID}) to a Credentials API account type.
providerIdToProviderName
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/ProviderUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/ProviderUtils.java
Apache-2.0
@Nullable public static AuthUI.IdpConfig getConfigFromIdps(List<AuthUI.IdpConfig> idps, String id) { for (AuthUI.IdpConfig idp : idps) { if (idp.getProviderId().equals(id)) { return idp; } } return null; }
Translate a Firebase Auth provider ID (such as {@link GoogleAuthProvider#PROVIDER_ID}) to a Credentials API account type.
getConfigFromIdps
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/ProviderUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/ProviderUtils.java
Apache-2.0
@NonNull public static AuthUI.IdpConfig getConfigFromIdpsOrThrow(List<AuthUI.IdpConfig> idps, String id) { AuthUI.IdpConfig config = getConfigFromIdps(idps, id); if (config == null) { throw new IllegalStateException("Provider " ...
Translate a Firebase Auth provider ID (such as {@link GoogleAuthProvider#PROVIDER_ID}) to a Credentials API account type.
getConfigFromIdpsOrThrow
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/ProviderUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/ProviderUtils.java
Apache-2.0
public static Task<List<String>> fetchSortedProviders(@NonNull FirebaseAuth auth, @NonNull final FlowParameters params, @NonNull String email) { if (TextUtils.isEmpty(email)) { return ...
Translate a Firebase Auth provider ID (such as {@link GoogleAuthProvider#PROVIDER_ID}) to a Credentials API account type.
fetchSortedProviders
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/ProviderUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/ProviderUtils.java
Apache-2.0
@Override public Task<List<String>> then(@NonNull Task<SignInMethodQueryResult> task) { List<String> methods = task.getResult().getSignInMethods(); if (methods == null) { methods = new ArrayList<>(); ...
Translate a Firebase Auth provider ID (such as {@link GoogleAuthProvider#PROVIDER_ID}) to a Credentials API account type.
then
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/ProviderUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/ProviderUtils.java
Apache-2.0
private void reorderPriorities(List<String> providers) { // Prioritize Google over everything else // Prioritize email-password sign in second // De-prioritize email link sign in changePriority(provid...
Translate a Firebase Auth provider ID (such as {@link GoogleAuthProvider#PROVIDER_ID}) to a Credentials API account type.
reorderPriorities
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/ProviderUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/ProviderUtils.java
Apache-2.0
private void changePriority(List<String> providers, String id, boolean maximizePriority) { if (providers.remove(id)) { if (maximizePriority) { ...
Translate a Firebase Auth provider ID (such as {@link GoogleAuthProvider#PROVIDER_ID}) to a Credentials API account type.
changePriority
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/ProviderUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/ProviderUtils.java
Apache-2.0
public static Task<String> fetchTopProvider( @NonNull FirebaseAuth auth, @NonNull FlowParameters params, @NonNull String email) { return fetchSortedProviders(auth, params, email) .continueWithTask(task -> { if (!task.isSuccessful()) { ...
Translate a Firebase Auth provider ID (such as {@link GoogleAuthProvider#PROVIDER_ID}) to a Credentials API account type.
fetchTopProvider
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/ProviderUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/ProviderUtils.java
Apache-2.0
public static String generateRandomAlphaNumericString(int length) { StringBuilder sb = new StringBuilder(); Random random = new Random(); for (int i = 0; i < length; i++) { sb.append(VALID_CHARS.charAt(random.nextInt(length))); } return sb.toString(); }
Generates a random alpha numeric string. @param length the desired length of the generated string. @return a randomly generated string with the desired number of characters.
generateRandomAlphaNumericString
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/data/SessionUtils.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/data/SessionUtils.java
Apache-2.0
private static String[] generatePostfixArray(CharSequence repeatableChar, int length) { final String[] ret = new String[length + 1]; for (int i = 0; i <= length; i++) { ret[i] = TextUtils.join("", Collections.nCopies(i, repeatableChar)); } return ret; }
For example, passing in ("-", 6) would return the following result: {"", "-", "--", "---", "----", "-----", "------"} @param repeatableChar the char to repeat to the specified length @param length the maximum length of repeated chars @return an increasing sequence array of chars up the specified length
generatePostfixArray
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/ui/BucketedTextChangeListener.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/ui/BucketedTextChangeListener.java
Apache-2.0
@SuppressLint("SetTextI18n") @Override public void onTextChanged( CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { // The listener is expected to be used in conjunction with the SpacedEditText. // Approach // 1) Strip all spaces and hyphens introduc...
For example, passing in ("-", 6) would return the following result: {"", "-", "--", "---", "----", "-----", "------"} @param repeatableChar the char to repeat to the specified length @param length the maximum length of repeated chars @return an increasing sequence array of chars up the specified length
onTextChanged
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/ui/BucketedTextChangeListener.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/ui/BucketedTextChangeListener.java
Apache-2.0
@Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
For example, passing in ("-", 6) would return the following result: {"", "-", "--", "---", "----", "-----", "------"} @param repeatableChar the char to repeat to the specified length @param length the maximum length of repeated chars @return an increasing sequence array of chars up the specified length
beforeTextChanged
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/ui/BucketedTextChangeListener.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/ui/BucketedTextChangeListener.java
Apache-2.0
@Override public void afterTextChanged(Editable s) {}
For example, passing in ("-", 6) would return the following result: {"", "-", "--", "---", "----", "-----", "------"} @param repeatableChar the char to repeat to the specified length @param length the maximum length of repeated chars @return an increasing sequence array of chars up the specified length
afterTextChanged
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/util/ui/BucketedTextChangeListener.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/util/ui/BucketedTextChangeListener.java
Apache-2.0
public LiveData<O> getOperation() { return mOperation; }
Get the observable state of the operation.
getOperation
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/viewmodel/OperableViewModel.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/viewmodel/OperableViewModel.java
Apache-2.0
public ProviderSignInBase<T> initWith(T args) { super.init(args); return this; }
Just a convenience method that makes certain chaining logic easier.
initWith
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/viewmodel/ProviderSignInBase.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/viewmodel/ProviderSignInBase.java
Apache-2.0
public void startSignIn(@NonNull final String email, @NonNull final String password, @NonNull final IdpResponse inputResponse, @Nullable final AuthCredential credential) { setResult(Resource.forLoading()); // Store the ...
Kick off the sign-in process.
startSignIn
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/viewmodel/email/WelcomeBackPasswordHandler.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/viewmodel/email/WelcomeBackPasswordHandler.java
Apache-2.0
public String getPendingPassword() { return mPendingPassword; }
Get the most recent pending password.
getPendingPassword
java
firebase/FirebaseUI-Android
auth/src/main/java/com/firebase/ui/auth/viewmodel/email/WelcomeBackPasswordHandler.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/main/java/com/firebase/ui/auth/viewmodel/email/WelcomeBackPasswordHandler.java
Apache-2.0
@Override public void onCreate() { super.onCreate(); setTheme(R.style.FirebaseUI); }
Used when Robolectric testing UI components which depend on the theme.s
onCreate
java
firebase/FirebaseUI-Android
auth/src/test/java/com/firebase/ui/auth/TestApplication.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/test/java/com/firebase/ui/auth/TestApplication.java
Apache-2.0
@NonNull @Override public <TContinuationResult> Task<TContinuationResult> continueWith( @NonNull Continuation<TResult, TContinuationResult> continuation) { return (Task<TContinuationResult>) Tasks.forResult(mContinuationResult); }
Subclass of {@link AutoCompleteTask} that also supports continuations.
continueWith
java
firebase/FirebaseUI-Android
auth/src/test/java/com/firebase/ui/auth/testhelpers/AutoContinueTask.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/test/java/com/firebase/ui/auth/testhelpers/AutoContinueTask.java
Apache-2.0
@NonNull @Override public <TContinuationResult> Task<TContinuationResult> continueWithTask( @NonNull Continuation<TResult, Task<TContinuationResult>> continuation) { return (Task<TContinuationResult>) Tasks.forResult(mContinuationResult); }
Subclass of {@link AutoCompleteTask} that also supports continuations.
continueWithTask
java
firebase/FirebaseUI-Android
auth/src/test/java/com/firebase/ui/auth/testhelpers/AutoContinueTask.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/test/java/com/firebase/ui/auth/testhelpers/AutoContinueTask.java
Apache-2.0
public static <T, F> void setPrivateField( T obj, Class<T> objClass, Class<F> fieldClass, F fieldValue) { Field targetField = null; Field[] classFields = objClass.getDeclaredFields(); for (Field field : classFields) { if (field.getType...
Set a private, obfuscated field of an object. @param obj the object to modify. @param objClass the object's class. @param fieldClass the class of the target field. @param fieldValue the value to use for the field.
setPrivateField
java
firebase/FirebaseUI-Android
auth/src/test/java/com/firebase/ui/auth/testhelpers/TestHelper.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/test/java/com/firebase/ui/auth/testhelpers/TestHelper.java
Apache-2.0
private void testSpacing(String expectedSpacedText, String expectedOriginalText, SpacedEditText editText) { final Editable editable = editText.getText(); final ScaleXSpan[] spans = editable.getSpans(0, editText.length(), ScaleXSpan.class); assertEquals(expectedSpace...
1. Tests whether the content is set to the expected value. 2. Tests whether the original content is set to the original value. 3. Tests that the styles applied have the expected proportion 4. Tests that the styles have been applied only on the spaces to preserve fonts appearance.
testSpacing
java
firebase/FirebaseUI-Android
auth/src/test/java/com/firebase/ui/auth/ui/phone/SpacedEditTextTest.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/test/java/com/firebase/ui/auth/ui/phone/SpacedEditTextTest.java
Apache-2.0
@Before public void setUp() { TestHelper.initialize(); MockitoAnnotations.initMocks(this); // Create our handler mHandler = new CredentialManagerHandler( (Application) ApplicationProvider.getApplicationContext() ); // Provide FlowParameters (e.g., fo...
Unit tests for {@link CredentialManagerHandler}. NOTE: This example shows a minimal approach in Java. If your actual code uses coroutines, you may need a custom setup or workaround to test asynchronous behavior in Java.
setUp
java
firebase/FirebaseUI-Android
auth/src/test/java/com/firebase/ui/auth/viewmodel/CredentialManagerHandlerTest.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/test/java/com/firebase/ui/auth/viewmodel/CredentialManagerHandlerTest.java
Apache-2.0
@Test @Ignore("This test is not possible with CredentialManager") public void testSaveCredentials_success() { ActivityController<TestActivity> controller = Robolectric.buildActivity(TestActivity.class).setup(); TestActivity testActivity = controller.get(); com.google.firebase.auth.Fireb...
Unit tests for {@link CredentialManagerHandler}. NOTE: This example shows a minimal approach in Java. If your actual code uses coroutines, you may need a custom setup or workaround to test asynchronous behavior in Java.
testSaveCredentials_success
java
firebase/FirebaseUI-Android
auth/src/test/java/com/firebase/ui/auth/viewmodel/CredentialManagerHandlerTest.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/test/java/com/firebase/ui/auth/viewmodel/CredentialManagerHandlerTest.java
Apache-2.0
@Test public void testSaveCredentials_failure() { ActivityController<TestActivity> controller = Robolectric.buildActivity(TestActivity.class).setup(); TestActivity testActivity = controller.get(); mHandler.saveCredentials( testActivity, null, // invalid user ...
Unit tests for {@link CredentialManagerHandler}. NOTE: This example shows a minimal approach in Java. If your actual code uses coroutines, you may need a custom setup or workaround to test asynchronous behavior in Java.
testSaveCredentials_failure
java
firebase/FirebaseUI-Android
auth/src/test/java/com/firebase/ui/auth/viewmodel/CredentialManagerHandlerTest.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/test/java/com/firebase/ui/auth/viewmodel/CredentialManagerHandlerTest.java
Apache-2.0
@Before public void setUp() { TestHelper.initialize(); MockitoAnnotations.initMocks(this); mHandler = new LinkingSocialProviderResponseHandler((Application) ApplicationProvider.getApplicationContext()); FlowParameters testParams = TestHelper.getFlowParameters(Collections.singletonLi...
Unit tests for {@link LinkingSocialProviderResponseHandler}. <p> This handler is used by WelcomeBackIdpPrompt. This prompt handles the case where a user attempts to log in with an IDP, but there is a user that has a different IDP with the same email. <p> In this case, the handler will link the provider to the existing ...
setUp
java
firebase/FirebaseUI-Android
auth/src/test/java/com/firebase/ui/auth/viewmodel/LinkingSocialProviderResponseHandlerTest.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/test/java/com/firebase/ui/auth/viewmodel/LinkingSocialProviderResponseHandlerTest.java
Apache-2.0
@Test public void testSignIn_withSameIdp_expectSuccess() { mHandler.getOperation().observeForever(mResponseObserver); // Fake social response from Google IdpResponse response = new IdpResponse.Builder(new User.Builder( GoogleAuthProvider.PROVIDER_ID, TestConstants.EMAIL).bui...
Unit tests for {@link LinkingSocialProviderResponseHandler}. <p> This handler is used by WelcomeBackIdpPrompt. This prompt handles the case where a user attempts to log in with an IDP, but there is a user that has a different IDP with the same email. <p> In this case, the handler will link the provider to the existing ...
testSignIn_withSameIdp_expectSuccess
java
firebase/FirebaseUI-Android
auth/src/test/java/com/firebase/ui/auth/viewmodel/LinkingSocialProviderResponseHandlerTest.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/test/java/com/firebase/ui/auth/viewmodel/LinkingSocialProviderResponseHandlerTest.java
Apache-2.0
@Test public void testSignIn_anonymousUpgradeEnabledWithSameIdp_expectMergeFailure() { mHandler.getOperation().observeForever(mResponseObserver); setupAnonymousUpgrade(); // Fake social response from Google IdpResponse response = new IdpResponse.Builder(new User.Builder( ...
Unit tests for {@link LinkingSocialProviderResponseHandler}. <p> This handler is used by WelcomeBackIdpPrompt. This prompt handles the case where a user attempts to log in with an IDP, but there is a user that has a different IDP with the same email. <p> In this case, the handler will link the provider to the existing ...
testSignIn_anonymousUpgradeEnabledWithSameIdp_expectMergeFailure
java
firebase/FirebaseUI-Android
auth/src/test/java/com/firebase/ui/auth/viewmodel/LinkingSocialProviderResponseHandlerTest.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/test/java/com/firebase/ui/auth/viewmodel/LinkingSocialProviderResponseHandlerTest.java
Apache-2.0
@Test public void testSignIn_withDifferentIdp_expectSuccess() { mHandler.getOperation().observeForever(mResponseObserver); // We're going to fake a sign in with facebook, where the email belongs // to an existing account with a Google provider. // Fake social response from Google ...
Unit tests for {@link LinkingSocialProviderResponseHandler}. <p> This handler is used by WelcomeBackIdpPrompt. This prompt handles the case where a user attempts to log in with an IDP, but there is a user that has a different IDP with the same email. <p> In this case, the handler will link the provider to the existing ...
testSignIn_withDifferentIdp_expectSuccess
java
firebase/FirebaseUI-Android
auth/src/test/java/com/firebase/ui/auth/viewmodel/LinkingSocialProviderResponseHandlerTest.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/test/java/com/firebase/ui/auth/viewmodel/LinkingSocialProviderResponseHandlerTest.java
Apache-2.0
@Test public void testSignIn_anonymousUpgradeEnabledWithDifferentIdp_expectMergeFailure() { mHandler.getOperation().observeForever(mResponseObserver); setupAnonymousUpgrade(); // We're going to fake a sign in with facebook, where the email belongs // to an existing account with a Go...
Unit tests for {@link LinkingSocialProviderResponseHandler}. <p> This handler is used by WelcomeBackIdpPrompt. This prompt handles the case where a user attempts to log in with an IDP, but there is a user that has a different IDP with the same email. <p> In this case, the handler will link the provider to the existing ...
testSignIn_anonymousUpgradeEnabledWithDifferentIdp_expectMergeFailure
java
firebase/FirebaseUI-Android
auth/src/test/java/com/firebase/ui/auth/viewmodel/LinkingSocialProviderResponseHandlerTest.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/test/java/com/firebase/ui/auth/viewmodel/LinkingSocialProviderResponseHandlerTest.java
Apache-2.0
@Test public void testSignIn_genericIdpLinkingFlow_expectImmediateLink() { mHandler.getOperation().observeForever(mResponseObserver); // Set Facebook credential AuthCredential facebookAuthCredential = FacebookAuthProvider.getCredential(TestConstants.TOKEN); mHandler....
Unit tests for {@link LinkingSocialProviderResponseHandler}. <p> This handler is used by WelcomeBackIdpPrompt. This prompt handles the case where a user attempts to log in with an IDP, but there is a user that has a different IDP with the same email. <p> In this case, the handler will link the provider to the existing ...
testSignIn_genericIdpLinkingFlow_expectImmediateLink
java
firebase/FirebaseUI-Android
auth/src/test/java/com/firebase/ui/auth/viewmodel/LinkingSocialProviderResponseHandlerTest.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/test/java/com/firebase/ui/auth/viewmodel/LinkingSocialProviderResponseHandlerTest.java
Apache-2.0
private void setupAnonymousUpgrade() { FlowParameters testParams = TestHelper.getFlowParameters(Collections.singletonList( GoogleAuthProvider.PROVIDER_ID), true); mHandler.initializeForTesting(testParams, mMockAuth, null); when(mMockAuth.getCurrentUser()).thenReturn(mMockUser); ...
Unit tests for {@link LinkingSocialProviderResponseHandler}. <p> This handler is used by WelcomeBackIdpPrompt. This prompt handles the case where a user attempts to log in with an IDP, but there is a user that has a different IDP with the same email. <p> In this case, the handler will link the provider to the existing ...
setupAnonymousUpgrade
java
firebase/FirebaseUI-Android
auth/src/test/java/com/firebase/ui/auth/viewmodel/LinkingSocialProviderResponseHandlerTest.java
https://github.com/firebase/FirebaseUI-Android/blob/master/auth/src/test/java/com/firebase/ui/auth/viewmodel/LinkingSocialProviderResponseHandlerTest.java
Apache-2.0
@NonNull @Override public T parseSnapshot(@NonNull S snapshot) { String id = getId(snapshot); T result = mObjectCache.get(id); if (result == null) { T object = mParser.parseSnapshot(snapshot); mObjectCache.put(id, object); result = object; } ...
Get a unique identifier for a snapshot, should not depend on snapshot content.
parseSnapshot
java
firebase/FirebaseUI-Android
common/src/main/java/com/firebase/ui/common/BaseCachingSnapshotParser.java
https://github.com/firebase/FirebaseUI-Android/blob/master/common/src/main/java/com/firebase/ui/common/BaseCachingSnapshotParser.java
Apache-2.0
@Override @NonNull public T get(int index) { return mCachingParser.parseSnapshot(getSnapshot(index)); }
Get the list of snapshots mirroring the server's data. Must be mutable and use a single instance over the lifetime of this class's active lifecycle. @return the local copy of the server's snapshots
get
java
firebase/FirebaseUI-Android
common/src/main/java/com/firebase/ui/common/BaseObservableSnapshotArray.java
https://github.com/firebase/FirebaseUI-Android/blob/master/common/src/main/java/com/firebase/ui/common/BaseObservableSnapshotArray.java
Apache-2.0
@Override public int size() { return getSnapshots().size(); }
Get the list of snapshots mirroring the server's data. Must be mutable and use a single instance over the lifetime of this class's active lifecycle. @return the local copy of the server's snapshots
size
java
firebase/FirebaseUI-Android
common/src/main/java/com/firebase/ui/common/BaseObservableSnapshotArray.java
https://github.com/firebase/FirebaseUI-Android/blob/master/common/src/main/java/com/firebase/ui/common/BaseObservableSnapshotArray.java
Apache-2.0
@NonNull public S getSnapshot(int index) { return getSnapshots().get(index); }
Returns the snapshot at the specified position in this list. @param index index of the snapshot to return @return the snapshot at the specified position in this list @throws IndexOutOfBoundsException if the index is out of range (<tt>index &lt; 0 || index &gt;= size()</tt>)
getSnapshot
java
firebase/FirebaseUI-Android
common/src/main/java/com/firebase/ui/common/BaseObservableSnapshotArray.java
https://github.com/firebase/FirebaseUI-Android/blob/master/common/src/main/java/com/firebase/ui/common/BaseObservableSnapshotArray.java
Apache-2.0
@CallSuper @NonNull public L addChangeEventListener(@NonNull L listener) { Preconditions.checkNotNull(listener); boolean wasListening = isListening(); mListeners.add(listener); // Catch up new listener to existing state for (int i = 0; i < size(); i++) { lis...
Attach a {@link BaseChangeEventListener} to this array. The listener will receive one {@link ChangeEventType#ADDED} event for each item that already exists in the array at the time of attachment, a {@link BaseChangeEventListener#onDataChanged()} event if one has occurred, and then receive all future child events. <p> I...
addChangeEventListener
java
firebase/FirebaseUI-Android
common/src/main/java/com/firebase/ui/common/BaseObservableSnapshotArray.java
https://github.com/firebase/FirebaseUI-Android/blob/master/common/src/main/java/com/firebase/ui/common/BaseObservableSnapshotArray.java
Apache-2.0
@CallSuper public void removeChangeEventListener(@NonNull L listener) { Preconditions.checkNotNull(listener); boolean wasListening = isListening(); mListeners.remove(listener); if (!isListening() && wasListening) { onDestroy(); } }
Remove a listener from the array. <p> If no listeners remain, {@link #onDestroy()} will be called.
removeChangeEventListener
java
firebase/FirebaseUI-Android
common/src/main/java/com/firebase/ui/common/BaseObservableSnapshotArray.java
https://github.com/firebase/FirebaseUI-Android/blob/master/common/src/main/java/com/firebase/ui/common/BaseObservableSnapshotArray.java
Apache-2.0
@CallSuper public void removeAllListeners() { for (L listener : mListeners) { removeChangeEventListener(listener); } }
Remove all listeners from the array and reset its state.
removeAllListeners
java
firebase/FirebaseUI-Android
common/src/main/java/com/firebase/ui/common/BaseObservableSnapshotArray.java
https://github.com/firebase/FirebaseUI-Android/blob/master/common/src/main/java/com/firebase/ui/common/BaseObservableSnapshotArray.java
Apache-2.0
@CallSuper protected void onCreate() {}
Called when the {@link BaseObservableSnapshotArray} is active and should start listening to the Firebase database.
onCreate
java
firebase/FirebaseUI-Android
common/src/main/java/com/firebase/ui/common/BaseObservableSnapshotArray.java
https://github.com/firebase/FirebaseUI-Android/blob/master/common/src/main/java/com/firebase/ui/common/BaseObservableSnapshotArray.java
Apache-2.0