mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-21 23:20:23 +00:00
Parse legacy colors
This commit is contained in:
parent
3ca8db6ed4
commit
7992ef7a64
1 changed files with 19 additions and 9 deletions
|
@ -186,6 +186,15 @@ public class DataStoreEntry extends StorageElement {
|
|||
.map(jsonNode -> UUID.fromString(jsonNode.textValue()))
|
||||
.orElse(DataStorage.DEFAULT_CATEGORY_UUID);
|
||||
var name = json.required("name").textValue().trim();
|
||||
var color = Optional.ofNullable(json.get("color"))
|
||||
.map(node -> {
|
||||
try {
|
||||
return mapper.treeToValue(node, DataColor.class);
|
||||
} catch (JsonProcessingException e) {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.orElse(null);
|
||||
|
||||
var persistentState = stateJson.get("persistentState");
|
||||
var lastUsed = Optional.ofNullable(stateJson.get("lastUsed"))
|
||||
|
@ -217,15 +226,16 @@ public class DataStoreEntry extends StorageElement {
|
|||
var expanded = Optional.ofNullable(stateJson.get("expanded"))
|
||||
.map(jsonNode -> jsonNode.booleanValue())
|
||||
.orElse(true);
|
||||
var color = Optional.ofNullable(stateJson.get("color"))
|
||||
.map(node -> {
|
||||
try {
|
||||
return mapper.treeToValue(node, DataColor.class);
|
||||
} catch (JsonProcessingException e) {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.orElse(null);
|
||||
|
||||
if (color == null) {
|
||||
color = Optional.ofNullable(stateJson.get("color")).map(node -> {
|
||||
try {
|
||||
return mapper.treeToValue(node, DataColor.class);
|
||||
} catch (JsonProcessingException e) {
|
||||
return null;
|
||||
}
|
||||
}).orElse(null);
|
||||
}
|
||||
|
||||
String notes = null;
|
||||
if (Files.exists(notesFile)) {
|
||||
|
|
Loading…
Reference in a new issue