Revert "BROKEN: FIXUP: Remove reset preference check"

This reverts commit 14fdbd96e3.
pull/1/head
Taylor Smock 2020-03-19 07:32:08 -06:00
rodzic 14fdbd96e3
commit 935f2ad9e3
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 625F6A74A3E4311A
1 zmienionych plików z 21 dodań i 0 usunięć

Wyświetl plik

@ -78,6 +78,27 @@ public final class MapWithAIPreferenceHelper {
returnMap.add(layerMap);
}
}
if (returnMap.isEmpty()) {
final List<String> defaultAPIs = Collections.singletonList(DEFAULT_MAPWITHAI_API);
final List<String> defaultList = Config.getPref().getList(API_CONFIG).isEmpty() ? defaultAPIs
: Config.getPref().getList(API_CONFIG);
returnMap.addAll(defaultList.stream().map(string -> {
final TreeMap<String, String> map = new TreeMap<>();
map.put(URL_STRING, string);
return map;
}).collect(Collectors.toList()));
}
returnMap.parallelStream().forEach(map -> {
final String url = map.get(URL_STRING);
if (DEFAULT_MAPWITHAI_API.equals(url)) {
map.putIfAbsent(SOURCE_STRING, MapWithAIPlugin.NAME);
map.putIfAbsent(ENABLED_STRING, "true");
map.putIfAbsent(PARAMETERS_STRING, DEFAULT_MAPWITHAI_API_PARAMETERS);
} else {
map.putIfAbsent(SOURCE_STRING, url);
map.putIfAbsent(ENABLED_STRING, Boolean.FALSE.toString());
}
});
return returnMap;
}