Skip to content

Commit

Permalink
Remove offensive terms (#1973)
Browse files Browse the repository at this point in the history
  • Loading branch information
samtstern authored Jul 6, 2021
1 parent bfdb796 commit f0e61e6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 38 deletions.
4 changes: 2 additions & 2 deletions auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ allowedCountries.add("+1");
allowedCountries.add("gr");

IdpConfig phoneConfigWithAllowedCountries = new IdpConfig.PhoneBuilder()
.setWhitelistedCountries(allowedCountries)
.setAllowedCountries(allowedCountries)
.build();
```
All countries with the country code +1 will be present in the selector as well as Greece ('gr').
Expand All @@ -433,7 +433,7 @@ blockedCountries.add("+1");
blockedCountries.add("gr");

IdpConfig phoneConfigWithBlockedCountries = new IdpConfig.PhoneBuilder()
.setBlacklistedCountries(blockedCountries)
.setBlockedCountries(blockedCountries)
.build();
```

Expand Down
15 changes: 5 additions & 10 deletions auth/src/main/java/com/firebase/ui/auth/AuthUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,13 @@
import com.firebase.ui.auth.util.data.ProviderUtils;
import com.google.android.gms.auth.api.credentials.Credential;
import com.google.android.gms.auth.api.credentials.CredentialRequest;
import com.google.android.gms.auth.api.credentials.CredentialRequestResponse;
import com.google.android.gms.auth.api.credentials.CredentialsClient;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.common.api.CommonStatusCodes;
import com.google.android.gms.common.api.GoogleApi;
import com.google.android.gms.common.api.Scope;
import com.google.android.gms.tasks.Continuation;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.Tasks;
import com.google.firebase.FirebaseApp;
Expand Down Expand Up @@ -845,7 +840,7 @@ public PhoneBuilder setDefaultCountryIso(@NonNull String iso) {
* Sets the country codes available in the country code selector for phone
* authentication. Takes as input a List of both country isos and codes.
* This is not to be called with
* {@link #setBlacklistedCountries(List)}.
* {@link #setBlockedCountries(List)}.
* If both are called, an exception will be thrown.
* <p>
* Inputting an e-164 country code (e.g. '+1') will include all countries with
Expand All @@ -860,7 +855,7 @@ public PhoneBuilder setDefaultCountryIso(@NonNull String iso) {
* @throws IllegalArgumentException if an empty allowlist is provided.
* @throws NullPointerException if a null allowlist is provided.
*/
public PhoneBuilder setWhitelistedCountries(
public PhoneBuilder setAllowedCountries(
@NonNull List<String> countries) {
if (getParams().containsKey(ExtraConstants.BLOCKLISTED_COUNTRIES)) {
throw new IllegalStateException(
Expand All @@ -882,7 +877,7 @@ public PhoneBuilder setWhitelistedCountries(
* Sets the countries to be removed from the country code selector for phone
* authentication. Takes as input a List of both country isos and codes.
* This is not to be called with
* {@link #setWhitelistedCountries(List)}.
* {@link #setAllowedCountries(List)}.
* If both are called, an exception will be thrown.
* <p>
* Inputting an e-164 country code (e.g. '+1') will include all countries with
Expand All @@ -897,7 +892,7 @@ public PhoneBuilder setWhitelistedCountries(
* @throws IllegalArgumentException if an empty blocklist is provided.
* @throws NullPointerException if a null blocklist is provided.
*/
public PhoneBuilder setBlacklistedCountries(
public PhoneBuilder setBlockedCountries(
@NonNull List<String> countries) {
if (getParams().containsKey(ExtraConstants.ALLOWLISTED_COUNTRIES)) {
throw new IllegalStateException(
Expand All @@ -906,7 +901,7 @@ public PhoneBuilder setBlacklistedCountries(
}

String message = "Invalid argument: Only non-%s blocklists are valid. " +
"To specify no blacklist, do not call this method.";
"To specify no blocklist, do not call this method.";
Preconditions.checkNotNull(countries, String.format(message, "null"));
Preconditions.checkArgument(!countries.isEmpty(), String.format
(message, "empty"));
Expand Down
52 changes: 26 additions & 26 deletions auth/src/test/java/com/firebase/ui/auth/AuthUITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,115 +155,115 @@ public void testCreatingStartIntent_withOnlyAnonymousProvider_expectIllegalState
}

@Test(expected = IllegalArgumentException.class)
public void testPhoneBuilder_withBlacklistedDefaultNumberCode_expectIllegalArgumentException() {
public void testPhoneBuilder_withBlockedDefaultNumberCode_expectIllegalArgumentException() {
new IdpConfig.PhoneBuilder()
.setDefaultNumber("+1123456789")
.setBlacklistedCountries(Arrays.asList("+1"))
.setBlockedCountries(Arrays.asList("+1"))
.build();
}

@Test(expected = IllegalArgumentException.class)
public void testPhoneBuilder_withBlacklistedDefaultIso_expectIllegalArgumentException() {
public void testPhoneBuilder_withBlockedDefaultIso_expectIllegalArgumentException() {
new IdpConfig.PhoneBuilder()
.setDefaultNumber("us", "123456789")
.setBlacklistedCountries(Arrays.asList("us"))
.setBlockedCountries(Arrays.asList("us"))
.build();
}

@Test
public void testPhoneBuilder_withWhitelistedDefaultIso_expectSuccess() {
public void testPhoneBuilder_withAllowedDefaultIso_expectSuccess() {
new IdpConfig.PhoneBuilder()
.setDefaultNumber("us", "123456789")
.setWhitelistedCountries(Arrays.asList("us"))
.setAllowedCountries(Arrays.asList("us"))
.build();
}

@Test
public void testPhoneBuilder_withWhitelistedDefaultNumberCode_expectSuccess() {
public void testPhoneBuilder_withAllowedDefaultNumberCode_expectSuccess() {
new IdpConfig.PhoneBuilder()
.setDefaultNumber("+1123456789")
.setWhitelistedCountries(Arrays.asList("+1"))
.setAllowedCountries(Arrays.asList("+1"))
.build();
}

@Test(expected = IllegalArgumentException.class)
public void testPhoneBuilder_whiteInvalidDefaultNumberCode_expectIllegalArgumentException() {
public void testPhoneBuilder_withInvalidDefaultNumberCode_expectIllegalArgumentException() {
new IdpConfig.PhoneBuilder()
.setDefaultNumber("+1123456789")
.setWhitelistedCountries(Arrays.asList("gr"))
.setAllowedCountries(Arrays.asList("gr"))
.build();
}

@Test
public void testPhoneBuilder_withValidDefaultNumberCode_expectSuccess() {
new IdpConfig.PhoneBuilder()
.setDefaultNumber("+1123456789")
.setWhitelistedCountries(Arrays.asList("ca"))
.setAllowedCountries(Arrays.asList("ca"))
.build();
}

@Test
public void testPhoneBuilder_withBlacklistedCountryWithSameCountryCode_expectSuccess() {
public void testPhoneBuilder_withBlockedCountryWithSameCountryCode_expectSuccess() {
new IdpConfig.PhoneBuilder()
.setDefaultNumber("+1123456789")
.setBlacklistedCountries(Arrays.asList("ca"))
.setBlockedCountries(Arrays.asList("ca"))
.build();
}

@Test(expected = IllegalArgumentException.class)
public void testPhoneBuilder_withInvalidDefaultIso_expectIllegalArgumentException() {
new IdpConfig.PhoneBuilder()
.setDefaultNumber("us", "123456789")
.setWhitelistedCountries(Arrays.asList("ca"))
.setAllowedCountries(Arrays.asList("ca"))
.build();
}

@Test
public void testPhoneBuilder_withValidDefaultIso_expectSucess() {
new IdpConfig.PhoneBuilder()
.setDefaultNumber("us", "123456789")
.setBlacklistedCountries(Arrays.asList("ca"))
.setBlockedCountries(Arrays.asList("ca"))
.build();
}

@Test(expected = IllegalStateException.class)
public void
testPhoneBuilder_setBothBlacklistedAndWhitelistedCountries_expectIllegalStateException() {
testPhoneBuilder_setBothBlockedAndAllowedCountries_expectIllegalStateException() {
List<String> countries = Arrays.asList("ca");
new IdpConfig.PhoneBuilder()
.setBlacklistedCountries(countries)
.setWhitelistedCountries(countries)
.setBlockedCountries(countries)
.setAllowedCountries(countries)
.build();
}

@Test(expected = IllegalArgumentException.class)
public void
testPhoneBuilder_passEmptyListForWhitelistedCountries_expectIllegalArgumentException() {
testPhoneBuilder_passEmptyListForAllowedCountries_expectIllegalArgumentException() {
new IdpConfig.PhoneBuilder()
.setWhitelistedCountries(new ArrayList<String>())
.setAllowedCountries(new ArrayList<String>())
.build();
}

@Test(expected = NullPointerException.class)
public void testPhoneBuilder_passNullForWhitelistedCountries_expectNullPointerException() {
public void testPhoneBuilder_passNullForAllowedCountries_expectNullPointerException() {
new IdpConfig.PhoneBuilder()
.setWhitelistedCountries(null)
.setAllowedCountries(null)
.build();
}


@Test(expected = IllegalArgumentException.class)
public void
testPhoneBuilder_passEmptyListForBlacklistedCountries_expectIllegalArgumentException() {
testPhoneBuilder_passEmptyListForBlockedCountries_expectIllegalArgumentException() {
new IdpConfig.PhoneBuilder()
.setBlacklistedCountries(new ArrayList<String>())
.setBlockedCountries(new ArrayList<String>())
.build();
}

@Test(expected = NullPointerException.class)
public void testPhoneBuilder_passNullForBlacklistedCountries_expectNullPointerException() {
public void testPhoneBuilder_passNullForBlockedCountries_expectNullPointerException() {
new IdpConfig.PhoneBuilder()
.setBlacklistedCountries(null)
.setBlockedCountries(null)
.build();
}

Expand Down

0 comments on commit f0e61e6

Please sign in to comment.