@@ -736,7 +736,7 @@ public EmailBuilder enableEmailLinkSignIn() {
736
736
* <p>
737
737
* {@link ActionCodeSettings#canHandleCodeInApp()} must be set to true, and a valid
738
738
* 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.
740
740
*
741
741
* @throws IllegalStateException if canHandleCodeInApp is set to false
742
742
* @throws NullPointerException if ActionCodeSettings is null
@@ -878,26 +878,26 @@ public PhoneBuilder setDefaultCountryIso(@NonNull String iso) {
878
878
* https://en.wikipedia.org/wiki/ISO_3166-1
879
879
* and e-164 codes here: https://en.wikipedia.org/wiki/List_of_country_calling_codes
880
880
*
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.
885
885
*/
886
886
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 )) {
889
889
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 " +
891
891
"authentication." );
892
892
}
893
893
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
898
898
(message , "empty" ));
899
899
900
- addCountriesToBundle (whitelistedCountries , ExtraConstants .WHITELISTED_COUNTRIES );
900
+ addCountriesToBundle (countries , ExtraConstants .ALLOWLISTED_COUNTRIES );
901
901
return this ;
902
902
}
903
903
@@ -915,26 +915,26 @@ public PhoneBuilder setWhitelistedCountries(
915
915
* https://en.wikipedia.org/wiki/ISO_3166-1
916
916
* and e-164 codes here: https://en.wikipedia.org/wiki/List_of_country_calling_codes
917
917
*
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.
922
922
*/
923
923
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 )) {
926
926
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 " +
928
928
"authentication." );
929
929
}
930
930
931
- String message = "Invalid argument: Only non-%s blacklists are valid. " +
931
+ String message = "Invalid argument: Only non-%s blocklists are valid. " +
932
932
"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
935
935
(message , "empty" ));
936
936
937
- addCountriesToBundle (blacklistedCountries , ExtraConstants .BLACKLISTED_COUNTRIES );
937
+ addCountriesToBundle (countries , ExtraConstants .BLOCKLISTED_COUNTRIES );
938
938
return this ;
939
939
}
940
940
@@ -954,27 +954,26 @@ private void addCountriesToBundle(List<String> CountryIsos, String CountryIsoTyp
954
954
}
955
955
956
956
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 );
961
961
962
- if (whitelistedCountries != null &&
963
- blacklistedCountries != null ) {
962
+ if (allowedCountries != null && blockedCountries != null ) {
964
963
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 " +
966
965
"authentication." );
967
- } else if (whitelistedCountries != null ) {
968
- validateInputs (whitelistedCountries , true );
966
+ } else if (allowedCountries != null ) {
967
+ validateInputs (allowedCountries , true );
969
968
970
- } else if (blacklistedCountries != null ) {
971
- validateInputs (blacklistedCountries , false );
969
+ } else if (blockedCountries != null ) {
970
+ validateInputs (blockedCountries , false );
972
971
}
973
972
}
974
973
975
- private void validateInputs (List <String > countries , boolean whitelisted ) {
974
+ private void validateInputs (List <String > countries , boolean allowed ) {
976
975
validateCountryInput (countries );
977
- validateDefaultCountryInput (countries , whitelisted );
976
+ validateDefaultCountryInput (countries , allowed );
978
977
}
979
978
980
979
private void validateCountryInput (List <String > codes ) {
@@ -986,40 +985,40 @@ private void validateCountryInput(List<String> codes) {
986
985
}
987
986
}
988
987
989
- private void validateDefaultCountryInput (List <String > codes , boolean whitelisted ) {
988
+ private void validateDefaultCountryInput (List <String > codes , boolean allowed ) {
990
989
// A default iso/code can be set via #setDefaultCountryIso() or #setDefaultNumber()
991
990
if (getParams ().containsKey (ExtraConstants .COUNTRY_ISO ) ||
992
991
getParams ().containsKey (ExtraConstants .PHONE )) {
993
992
994
- if (!validateDefaultCountryIso (codes , whitelisted )
995
- || !validateDefaultPhoneIsos (codes , whitelisted )) {
993
+ if (!validateDefaultCountryIso (codes , allowed )
994
+ || !validateDefaultPhoneIsos (codes , allowed )) {
996
995
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." );
999
998
}
1000
999
}
1001
1000
1002
1001
}
1003
1002
1004
- private boolean validateDefaultCountryIso (List <String > codes , boolean whitelisted ) {
1003
+ private boolean validateDefaultCountryIso (List <String > codes , boolean allowed ) {
1005
1004
String defaultIso = getDefaultIso ();
1006
- return isValidDefaultIso (codes , defaultIso , whitelisted );
1005
+ return isValidDefaultIso (codes , defaultIso , allowed );
1007
1006
}
1008
1007
1009
- private boolean validateDefaultPhoneIsos (List <String > codes , boolean whitelisted ) {
1008
+ private boolean validateDefaultPhoneIsos (List <String > codes , boolean allowed ) {
1010
1009
List <String > phoneIsos = getPhoneIsosFromCode ();
1011
1010
for (String iso : phoneIsos ) {
1012
- if (isValidDefaultIso (codes , iso , whitelisted )) {
1011
+ if (isValidDefaultIso (codes , iso , allowed )) {
1013
1012
return true ;
1014
1013
}
1015
1014
}
1016
1015
return phoneIsos .isEmpty ();
1017
1016
}
1018
1017
1019
- private boolean isValidDefaultIso (List <String > codes , String iso , boolean whitelisted ) {
1018
+ private boolean isValidDefaultIso (List <String > codes , String iso , boolean allowed ) {
1020
1019
if (iso == null ) return true ;
1021
1020
boolean containsIso = containsCountryIso (codes , iso );
1022
- return containsIso && whitelisted || !containsIso && !whitelisted ;
1021
+ return containsIso && allowed || !containsIso && !allowed ;
1023
1022
1024
1023
}
1025
1024
0 commit comments