Skip to content

Commit 71bfba2

Browse files
authored
Use respectful terms (#1905)
1 parent 735bf7b commit 71bfba2

File tree

4 files changed

+89
-90
lines changed

4 files changed

+89
-90
lines changed

auth/README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,15 @@ To use email link sign in, you will first need to enable it in the Firebase Cons
263263
also have to enable Firebase Dynamic Links.
264264

265265
You can enable email link sign in by calling the `enableEmailLinkSignIn` on an `EmailBuilder` instance. You will also need
266-
to provide a valid `ActionCodeSettings` object with `setHandleCodeInApp` set to true. Additionally, you need to whitelist the
266+
to provide a valid `ActionCodeSettings` object with `setHandleCodeInApp` set to true. Additionally, you need to allowlist the
267267
URL you pass to `setUrl`; you can do so in the Firebase Console (Authentication -> Sign in Methods -> Authorized domains).
268268

269269
```java
270270

271271
ActionCodeSettings actionCodeSettings = ActionCodeSettings.newBuilder()
272272
.setAndroidPackageName(/*yourPackageName*/, /*installIfNotAvailable*/true, /*minimumVersion*/null)
273273
.setHandleCodeInApp(true)
274-
.setUrl("https://google.com") // This URL needs to be whitelisted
274+
.setUrl("https://google.com") // This URL needs to be allowlisted
275275
.build();
276276

277277
startActivityForResult(
@@ -409,37 +409,37 @@ IdpConfig phoneConfigWithDefaultNumber = new IdpConfig.PhoneBuilder()
409409

410410
You can limit the countries shown in the country selector list. By default, all countries are shown.
411411

412-
You can provide a list of countries to whitelist or blacklist. You can populate these lists with
412+
You can provide a list of countries to allowlist or blocklist. You can populate these lists with
413413
ISO (alpha-2) and E164 formatted country codes.
414414

415415
```java
416-
List<String> whitelistedCountries = new ArrayList<String>();
417-
whitelistedCountries.add("+1");
418-
whitelistedCountries.add("gr");
416+
List<String> allowedCountries = new ArrayList<String>();
417+
allowedCountries.add("+1");
418+
allowedCountries.add("gr");
419419

420-
IdpConfig phoneConfigWithWhitelistedCountries = new IdpConfig.PhoneBuilder()
421-
.setWhitelistedCountries(whitelistedCountries)
420+
IdpConfig phoneConfigWithAllowedCountries = new IdpConfig.PhoneBuilder()
421+
.setWhitelistedCountries(allowedCountries)
422422
.build();
423423
```
424424
All countries with the country code +1 will be present in the selector as well as Greece ('gr').
425425

426-
You may want to exclude a few countries from the list and avoid creating a whitelist with
427-
many countries. You can instead provide a list of countries to blacklist. By doing so, all countries
426+
You may want to exclude a few countries from the list and avoid creating a allowlist with
427+
many countries. You can instead provide a list of countries to blocklist. By doing so, all countries
428428
excluding the ones you provide will be in the selector.
429429

430430
```java
431-
List<String> blacklistedCountries = new ArrayList<String>();
432-
blacklistedCountries.add("+1");
433-
blacklistedCountries.add("gr");
431+
List<String> blockedCountries = new ArrayList<String>();
432+
blockedCountries.add("+1");
433+
blockedCountries.add("gr");
434434

435-
IdpConfig phoneConfigWithBlacklistedCountries = new IdpConfig.PhoneBuilder()
436-
.setBlacklistedCountries(blacklistedCountries)
435+
IdpConfig phoneConfigWithBlockedCountries = new IdpConfig.PhoneBuilder()
436+
.setBlacklistedCountries(blockedCountries)
437437
.build();
438438
```
439439

440440
The country code selector will exclude all countries with a country code of +1 and Greece ('gr').
441441

442-
Note: You can't provide both a list of countries to whitelist and blacklist. If you do, a runtime
442+
Note: You can't provide both a list of countries to allowlist and blocklist. If you do, a runtime
443443
exception will be thrown.
444444
445445
This change is purely UI based. We do not restrict users from signing in with their phone number.

auth/src/main/java/com/firebase/ui/auth/AuthUI.java

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ public EmailBuilder enableEmailLinkSignIn() {
736736
* <p>
737737
* {@link ActionCodeSettings#canHandleCodeInApp()} must be set to true, and a valid
738738
* continueUrl must be passed via {@link ActionCodeSettings.Builder#setUrl(String)}.
739-
* This URL must be whitelisted in the Firebase Console.
739+
* This URL must be allowlisted in the Firebase Console.
740740
*
741741
* @throws IllegalStateException if canHandleCodeInApp is set to false
742742
* @throws NullPointerException if ActionCodeSettings is null
@@ -878,26 +878,26 @@ public PhoneBuilder setDefaultCountryIso(@NonNull String iso) {
878878
* https://en.wikipedia.org/wiki/ISO_3166-1
879879
* and e-164 codes here: https://en.wikipedia.org/wiki/List_of_country_calling_codes
880880
*
881-
* @param whitelistedCountries a non empty case insensitive list of country codes
882-
* and/or isos to be whitelisted
883-
* @throws IllegalArgumentException if an empty whitelist is provided.
884-
* @throws NullPointerException if a null whitelist is provided.
881+
* @param countries a non empty case insensitive list of country codes
882+
* and/or isos to be allowlisted
883+
* @throws IllegalArgumentException if an empty allowlist is provided.
884+
* @throws NullPointerException if a null allowlist is provided.
885885
*/
886886
public PhoneBuilder setWhitelistedCountries(
887-
@NonNull List<String> whitelistedCountries) {
888-
if (getParams().containsKey(ExtraConstants.BLACKLISTED_COUNTRIES)) {
887+
@NonNull List<String> countries) {
888+
if (getParams().containsKey(ExtraConstants.BLOCKLISTED_COUNTRIES)) {
889889
throw new IllegalStateException(
890-
"You can either whitelist or blacklist country codes for phone " +
890+
"You can either allowlist or blocklist country codes for phone " +
891891
"authentication.");
892892
}
893893

894-
String message = "Invalid argument: Only non-%s whitelists are valid. " +
895-
"To specify no whitelist, do not call this method.";
896-
Preconditions.checkNotNull(whitelistedCountries, String.format(message, "null"));
897-
Preconditions.checkArgument(!whitelistedCountries.isEmpty(), String.format
894+
String message = "Invalid argument: Only non-%s allowlists are valid. " +
895+
"To specify no allowlist, do not call this method.";
896+
Preconditions.checkNotNull(countries, String.format(message, "null"));
897+
Preconditions.checkArgument(!countries.isEmpty(), String.format
898898
(message, "empty"));
899899

900-
addCountriesToBundle(whitelistedCountries, ExtraConstants.WHITELISTED_COUNTRIES);
900+
addCountriesToBundle(countries, ExtraConstants.ALLOWLISTED_COUNTRIES);
901901
return this;
902902
}
903903

@@ -915,26 +915,26 @@ public PhoneBuilder setWhitelistedCountries(
915915
* https://en.wikipedia.org/wiki/ISO_3166-1
916916
* and e-164 codes here: https://en.wikipedia.org/wiki/List_of_country_calling_codes
917917
*
918-
* @param blacklistedCountries a non empty case insensitive list of country codes
919-
* and/or isos to be blacklisted
920-
* @throws IllegalArgumentException if an empty blacklist is provided.
921-
* @throws NullPointerException if a null blacklist is provided.
918+
* @param countries a non empty case insensitive list of country codes
919+
* and/or isos to be blocklisted
920+
* @throws IllegalArgumentException if an empty blocklist is provided.
921+
* @throws NullPointerException if a null blocklist is provided.
922922
*/
923923
public PhoneBuilder setBlacklistedCountries(
924-
@NonNull List<String> blacklistedCountries) {
925-
if (getParams().containsKey(ExtraConstants.WHITELISTED_COUNTRIES)) {
924+
@NonNull List<String> countries) {
925+
if (getParams().containsKey(ExtraConstants.ALLOWLISTED_COUNTRIES)) {
926926
throw new IllegalStateException(
927-
"You can either whitelist or blacklist country codes for phone " +
927+
"You can either allowlist or blocklist country codes for phone " +
928928
"authentication.");
929929
}
930930

931-
String message = "Invalid argument: Only non-%s blacklists are valid. " +
931+
String message = "Invalid argument: Only non-%s blocklists are valid. " +
932932
"To specify no blacklist, do not call this method.";
933-
Preconditions.checkNotNull(blacklistedCountries, String.format(message, "null"));
934-
Preconditions.checkArgument(!blacklistedCountries.isEmpty(), String.format
933+
Preconditions.checkNotNull(countries, String.format(message, "null"));
934+
Preconditions.checkArgument(!countries.isEmpty(), String.format
935935
(message, "empty"));
936936

937-
addCountriesToBundle(blacklistedCountries, ExtraConstants.BLACKLISTED_COUNTRIES);
937+
addCountriesToBundle(countries, ExtraConstants.BLOCKLISTED_COUNTRIES);
938938
return this;
939939
}
940940

@@ -954,27 +954,26 @@ private void addCountriesToBundle(List<String> CountryIsos, String CountryIsoTyp
954954
}
955955

956956
private void validateInputs() {
957-
List<String> whitelistedCountries = getParams().getStringArrayList(
958-
ExtraConstants.WHITELISTED_COUNTRIES);
959-
List<String> blacklistedCountries = getParams().getStringArrayList(
960-
ExtraConstants.BLACKLISTED_COUNTRIES);
957+
List<String> allowedCountries = getParams().getStringArrayList(
958+
ExtraConstants.ALLOWLISTED_COUNTRIES);
959+
List<String> blockedCountries = getParams().getStringArrayList(
960+
ExtraConstants.BLOCKLISTED_COUNTRIES);
961961

962-
if (whitelistedCountries != null &&
963-
blacklistedCountries != null) {
962+
if (allowedCountries != null && blockedCountries != null) {
964963
throw new IllegalStateException(
965-
"You can either whitelist or blacklist country codes for phone " +
964+
"You can either allowlist or blocked country codes for phone " +
966965
"authentication.");
967-
} else if (whitelistedCountries != null) {
968-
validateInputs(whitelistedCountries, true);
966+
} else if (allowedCountries != null) {
967+
validateInputs(allowedCountries, true);
969968

970-
} else if (blacklistedCountries != null) {
971-
validateInputs(blacklistedCountries, false);
969+
} else if (blockedCountries != null) {
970+
validateInputs(blockedCountries, false);
972971
}
973972
}
974973

975-
private void validateInputs(List<String> countries, boolean whitelisted) {
974+
private void validateInputs(List<String> countries, boolean allowed) {
976975
validateCountryInput(countries);
977-
validateDefaultCountryInput(countries, whitelisted);
976+
validateDefaultCountryInput(countries, allowed);
978977
}
979978

980979
private void validateCountryInput(List<String> codes) {
@@ -986,40 +985,40 @@ private void validateCountryInput(List<String> codes) {
986985
}
987986
}
988987

989-
private void validateDefaultCountryInput(List<String> codes, boolean whitelisted) {
988+
private void validateDefaultCountryInput(List<String> codes, boolean allowed) {
990989
// A default iso/code can be set via #setDefaultCountryIso() or #setDefaultNumber()
991990
if (getParams().containsKey(ExtraConstants.COUNTRY_ISO) ||
992991
getParams().containsKey(ExtraConstants.PHONE)) {
993992

994-
if (!validateDefaultCountryIso(codes, whitelisted)
995-
|| !validateDefaultPhoneIsos(codes, whitelisted)) {
993+
if (!validateDefaultCountryIso(codes, allowed)
994+
|| !validateDefaultPhoneIsos(codes, allowed)) {
996995
throw new IllegalArgumentException("Invalid default country iso. Make " +
997-
"sure it is either part of the whitelisted list or that you "
998-
+ "haven't blacklisted it.");
996+
"sure it is either part of the allowed list or that you "
997+
+ "haven't blocked it.");
999998
}
1000999
}
10011000

10021001
}
10031002

1004-
private boolean validateDefaultCountryIso(List<String> codes, boolean whitelisted) {
1003+
private boolean validateDefaultCountryIso(List<String> codes, boolean allowed) {
10051004
String defaultIso = getDefaultIso();
1006-
return isValidDefaultIso(codes, defaultIso, whitelisted);
1005+
return isValidDefaultIso(codes, defaultIso, allowed);
10071006
}
10081007

1009-
private boolean validateDefaultPhoneIsos(List<String> codes, boolean whitelisted) {
1008+
private boolean validateDefaultPhoneIsos(List<String> codes, boolean allowed) {
10101009
List<String> phoneIsos = getPhoneIsosFromCode();
10111010
for (String iso : phoneIsos) {
1012-
if (isValidDefaultIso(codes, iso, whitelisted)) {
1011+
if (isValidDefaultIso(codes, iso, allowed)) {
10131012
return true;
10141013
}
10151014
}
10161015
return phoneIsos.isEmpty();
10171016
}
10181017

1019-
private boolean isValidDefaultIso(List<String> codes, String iso, boolean whitelisted) {
1018+
private boolean isValidDefaultIso(List<String> codes, String iso, boolean allowed) {
10201019
if (iso == null) return true;
10211020
boolean containsIso = containsCountryIso(codes, iso);
1022-
return containsIso && whitelisted || !containsIso && !whitelisted;
1021+
return containsIso && allowed || !containsIso && !allowed;
10231022

10241023
}
10251024

auth/src/main/java/com/firebase/ui/auth/ui/phone/CountryListSpinner.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public final class CountryListSpinner extends AppCompatEditText implements View.
5555
private String mSelectedCountryName;
5656
private CountryInfo mSelectedCountryInfo;
5757

58-
private Set<String> mWhitelistedCountryIsos = new HashSet<>();
59-
private Set<String> mBlacklistedCountryIsos = new HashSet<>();
58+
private Set<String> mAllowedCountryIsos = new HashSet<>();
59+
private Set<String> mBlockedCountryIsos = new HashSet<>();
6060

6161
public CountryListSpinner(Context context) {
6262
this(context, null, android.R.attr.spinnerStyle);
@@ -88,25 +88,25 @@ private List<CountryInfo> getCountriesToDisplayInSpinner(Bundle params) {
8888
initCountrySpinnerIsosFromParams(params);
8989
Map<String, Integer> countryInfoMap = PhoneNumberUtils.getImmutableCountryIsoMap();
9090

91-
// We consider all countries to be whitelisted if there are no whitelisted
92-
// or blacklisted countries given as input.
93-
if (mWhitelistedCountryIsos.isEmpty() && mBlacklistedCountryIsos.isEmpty()) {
94-
this.mWhitelistedCountryIsos = new HashSet<>(countryInfoMap.keySet());
91+
// We consider all countries to be allowed if there are no allowed
92+
// or blocked countries given as input.
93+
if (mAllowedCountryIsos.isEmpty() && mBlockedCountryIsos.isEmpty()) {
94+
this.mAllowedCountryIsos = new HashSet<>(countryInfoMap.keySet());
9595
}
9696

9797
List<CountryInfo> countryInfoList = new ArrayList<>();
9898

99-
// At this point either mWhitelistedCountryIsos or mBlacklistedCountryIsos is null.
99+
// At this point either mAllowedCountryIsos or mBlockedCountryIsos is null.
100100
// We assume no countries are to be excluded. Here, we correct this assumption based on the
101101
// contents of either lists.
102102
Set<String> excludedCountries = new HashSet<>();
103-
if (!mBlacklistedCountryIsos.isEmpty()) {
104-
// Exclude all countries in the mBlacklistedCountryIsos list.
105-
excludedCountries.addAll(mBlacklistedCountryIsos);
103+
if (!mBlockedCountryIsos.isEmpty()) {
104+
// Exclude all countries in the mBlockedCountryIsos list.
105+
excludedCountries.addAll(mBlockedCountryIsos);
106106
} else {
107-
// Exclude all countries that are not present in the mWhitelistedCountryIsos list.
107+
// Exclude all countries that are not present in the mAllowedCountryIsos list.
108108
excludedCountries.addAll(countryInfoMap.keySet());
109-
excludedCountries.removeAll(mWhitelistedCountryIsos);
109+
excludedCountries.removeAll(mAllowedCountryIsos);
110110
}
111111

112112
// Once we know which countries need to be excluded, we loop through the country isos,
@@ -122,17 +122,17 @@ private List<CountryInfo> getCountriesToDisplayInSpinner(Bundle params) {
122122
}
123123

124124
private void initCountrySpinnerIsosFromParams(@NonNull Bundle params) {
125-
List<String> whitelistedCountries =
126-
params.getStringArrayList(ExtraConstants.WHITELISTED_COUNTRIES);
127-
List<String> blacklistedCountries =
128-
params.getStringArrayList(ExtraConstants.BLACKLISTED_COUNTRIES);
125+
List<String> allowedCountries =
126+
params.getStringArrayList(ExtraConstants.ALLOWLISTED_COUNTRIES);
127+
List<String> blockedCountries =
128+
params.getStringArrayList(ExtraConstants.BLOCKLISTED_COUNTRIES);
129129

130-
if (whitelistedCountries != null) {
131-
mWhitelistedCountryIsos = convertCodesToIsos(whitelistedCountries);
130+
if (allowedCountries != null) {
131+
mAllowedCountryIsos = convertCodesToIsos(allowedCountries);
132132
}
133133

134-
if (blacklistedCountries != null) {
135-
mBlacklistedCountryIsos = convertCodesToIsos(blacklistedCountries);
134+
if (blockedCountries != null) {
135+
mBlockedCountryIsos = convertCodesToIsos(blockedCountries);
136136
}
137137
}
138138

@@ -167,12 +167,12 @@ private void setDefaultCountryForSpinner(List<CountryInfo> countries) {
167167
public boolean isValidIso(String iso) {
168168
iso = iso.toUpperCase(Locale.getDefault());
169169
boolean valid = true;
170-
if (!mWhitelistedCountryIsos.isEmpty()) {
171-
valid = valid && mWhitelistedCountryIsos.contains(iso);
170+
if (!mAllowedCountryIsos.isEmpty()) {
171+
valid = valid && mAllowedCountryIsos.contains(iso);
172172
}
173173

174-
if (!mBlacklistedCountryIsos.isEmpty()) {
175-
valid = valid && !mBlacklistedCountryIsos.contains(iso);
174+
if (!mBlockedCountryIsos.isEmpty()) {
175+
valid = valid && !mBlockedCountryIsos.contains(iso);
176176
}
177177

178178
return valid;

auth/src/main/java/com/firebase/ui/auth/util/ExtraConstants.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public final class ExtraConstants {
4040
public static final String COUNTRY_ISO = "extra_country_iso";
4141
public static final String NATIONAL_NUMBER = "extra_national_number";
4242

43-
public static final String WHITELISTED_COUNTRIES = "whitelisted_countries";
44-
public static final String BLACKLISTED_COUNTRIES = "blacklisted_countries";
43+
public static final String ALLOWLISTED_COUNTRIES = "allowlisted_countries";
44+
public static final String BLOCKLISTED_COUNTRIES = "blocklisted_countries";
4545

4646
public static final String EMAIL_LINK_SIGN_IN = "email_link_sign_in";
4747
public static final String ACTION_CODE_SETTINGS = "action_code_settings";

0 commit comments

Comments
 (0)