Add more fixes to the country picker.

This commit is contained in:
Michelle Tang
2025-02-06 16:19:43 -05:00
committed by GitHub
parent 254b0dacc3
commit 5173916699
24 changed files with 425 additions and 355 deletions

View File

@@ -232,6 +232,11 @@ public class Util {
return Optional.ofNullable(simCountryIso != null ? simCountryIso.toUpperCase() : null);
}
public static @Nullable String getNetworkCountryIso(Context context) {
String networkCountryIso = ((TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE)).getNetworkCountryIso();
return networkCountryIso == null ? null : networkCountryIso.toUpperCase();
}
public static @NonNull <T> T firstNonNull(@Nullable T optional, @NonNull T fallback) {
return optional != null ? optional : fallback;
}