1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-26 14:21:16 +00:00

Fixed repos not being displayed (fixes #100).

This commit is contained in:
Felix Ableitner 2014-08-24 16:51:17 +02:00
parent b5f38c5c19
commit 35d80844fc

View file

@ -451,6 +451,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
List<Repo> ret;
try {
JSONArray repos = mConfig.getJSONArray("Repositories");
String x = repos.toString();
ret = new ArrayList<>(repos.length());
for (int i = 0; i < repos.length(); i++) {
JSONObject json = repos.getJSONObject(i);
@ -458,7 +459,17 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
r.Directory = json.getString("Directory");
r.ID = json.getString("ID");
r.Invalid = json.getString("Invalid");
r.Nodes = getNodes(json.getJSONArray("Nodes"));
r.Nodes = new ArrayList<>();
JSONArray nodes = json.getJSONArray("Nodes");
for (int j = 0; i < nodes.length(); i++) {
JSONObject n = nodes.getJSONObject(i);
String id = n.getString("NodeID");
for (Node n2 : getNodes()) {
if (n2.NodeID.equals(id)) {
r.Nodes.add(n2);
}
}
}
r.ReadOnly = json.getBoolean("ReadOnly");
JSONObject versioning = json.getJSONObject("Versioning");