mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-14 10:11:58 +00:00
fix gear deserialization
This commit is contained in:
parent
013f3fda9d
commit
f889c5086b
1 changed files with 12 additions and 1 deletions
|
|
@ -50,7 +50,18 @@ public class ItemDataListDeserializer implements JsonDeserializer<List<ItemData>
|
|||
}
|
||||
|
||||
for (Map.Entry<String,JsonElement> entry : json.getAsJsonObject().entrySet()) {
|
||||
ItemData item = context.deserialize(entry.getValue(), ItemData.class);
|
||||
ItemData item;
|
||||
if (entry.getValue().isJsonObject()) {
|
||||
item = context.deserialize(entry.getValue(), ItemData.class);
|
||||
} else {
|
||||
item = new ItemData();
|
||||
item.key = entry.getKey();
|
||||
if (entry.getValue().isJsonNull()) {
|
||||
item.owned = null;
|
||||
} else {
|
||||
item.owned = entry.getValue().getAsBoolean();
|
||||
}
|
||||
}
|
||||
vals.add(item);
|
||||
}
|
||||
TransactionManager.getInstance().addTransaction(new SaveModelTransaction<>(ProcessModelInfo.withModels(vals)));
|
||||
|
|
|
|||
Loading…
Reference in a new issue