Fix saving

This commit is contained in:
carbotaniuman 2020-06-13 16:10:17 -05:00
parent 1818175d4a
commit a4a21904ed

View file

@ -84,16 +84,6 @@ public class MangaDexClient {
}
statsMap.put(Instant.now(), statistics.get());
try {
DiskLruCache.Editor editor = cache.edit("statistics");
if (editor != null) {
String json = GSON.toJson(statistics.get(), Statistics.class);
editor.setString(0, json);
editor.setString(1, "");
editor.setString(2, "");
editor.commit();
}
} catch (IOException ignored) {}
if (clientSettings.getWebSettings() != null) {
webUi = WebUiKt.getUiServer(clientSettings.getWebSettings(), statistics, statsMap);
@ -122,6 +112,17 @@ public class MangaDexClient {
statsMap.put(Instant.now(), statistics.get());
try {
DiskLruCache.Editor editor = cache.edit("statistics");
if (editor != null) {
String json = GSON.toJson(statistics.get(), Statistics.class);
editor.setString(0, json);
editor.setString(1, "");
editor.setString(2, "");
editor.commit();
}
} catch (IOException ignored) {}
// if the server is offline then don't try and refresh certs
if (engine == null) {
return;