Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36da2a23 authored by Juan Carlos González Cabrero's avatar Juan Carlos González Cabrero
Browse files

Parse the lists of remote users from the JSON response of the server

parent 23643ad2
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ public class GetRemoteShareesOperation extends RemoteOperation{

    // Arguments - constant values
    private static final String VALUE_FORMAT = "json";
    private static final String VALUE_ITEM_TYPE = "search";         //  to get the server search for users / groups
    private static final String VALUE_ITEM_TYPE = "file";         //  to get the server search for users / groups


    // JSON Node names
@@ -87,6 +87,7 @@ public class GetRemoteShareesOperation extends RemoteOperation{
    private static final String NODE_EXACT = "exact";
    private static final String NODE_USERS = "users";
    private static final String NODE_GROUPS = "groups";
    private static final String NODE_REMOTES = "remotes";
    public static final String NODE_VALUE = "value";
    public static final String PROPERTY_LABEL = "label";
    public static final String PROPERTY_SHARE_TYPE = "shareType";
@@ -146,17 +147,21 @@ public class GetRemoteShareesOperation extends RemoteOperation{
                JSONObject respExact = respData.getJSONObject(NODE_EXACT);
                JSONArray respExactUsers = respExact.getJSONArray(NODE_USERS);
                JSONArray respExactGroups = respExact.getJSONArray(NODE_GROUPS);
                JSONArray respExactRemotes = respExact.getJSONArray(NODE_REMOTES);
                JSONArray respPartialUsers = respData.getJSONArray(NODE_USERS);
                JSONArray respPartialGroups = respData.getJSONArray(NODE_GROUPS);
                JSONArray respPartialRemotes = respData.getJSONArray(NODE_REMOTES);
                JSONArray[] jsonResults = {
                        respExactUsers,
                        respExactGroups,
                        respExactRemotes,
                        respPartialUsers,
                        respPartialGroups
                        respPartialGroups,
                        respPartialRemotes
                };

                ArrayList<Object> data = new ArrayList<Object>(); // For result data
                for (int i=0; i<4; i++) {
                for (int i=0; i<6; i++) {
                    for(int j=0; j< jsonResults[i].length(); j++){
                        JSONObject jsonResult = jsonResults[i].getJSONObject(j);
                        data.add(jsonResult);