@@ -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
0 commit comments