Enable builtin hosts if the country is CN

This commit is contained in:
seven332 committed 2019-03-15 15:45:14 +08:00
1 parent 7fc9ef9e1f
commit c165c9071d
1 file changed
+11
@@ -36,6 +36,7 @@ import com.hippo.yorozuya.FileUtils;
import com.hippo.yorozuya.MathUtils;
import com.hippo.yorozuya.NumberUtils;
import java.io.File;
import java.util.Locale;
public class Settings {
@@ -49,6 +50,16 @@ public class Settings {
sContext = context.getApplicationContext();
sSettingsPre = PreferenceManager.getDefaultSharedPreferences(sContext);
sEhConfig = loadEhConfig();
fixDefaultValue(context);
}
private static void fixDefaultValue(Context context) {
// Enable builtin hosts if the country is CN
if (!sSettingsPre.contains(KEY_BUILT_IN_HOSTS)) {
if ("CN".equals(Locale.getDefault().getCountry())) {
putBuiltInHosts(true);
}
}
}
private static EhConfig loadEhConfig() {