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

Unverified Commit 97a96d5d authored by Andy Scherzinger's avatar Andy Scherzinger Committed by GitHub
Browse files

Merge pull request #174 from nextcloud/addRoomShareType

Add room share type
parents 4bc973cb 438ce145
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -20,7 +20,7 @@ repositories {
dependencies {
dependencies {
    compile 'org.apache.jackrabbit:jackrabbit-webdav:2.12.6'
    compile 'org.apache.jackrabbit:jackrabbit-webdav:2.12.6'
    implementation 'org.parceler:parceler-api:1.1.11'
    implementation 'org.parceler:parceler-api:1.1.11'
    annotationProcessor 'org.parceler:parceler:1.1.6'
    annotationProcessor 'org.parceler:parceler:1.1.9'
    implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
    implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
    implementation "com.android.support:support-annotations:27.1.1"
    implementation "com.android.support:support-annotations:27.1.1"
}
}
+18 −12
Original line number Original line Diff line number Diff line
@@ -48,7 +48,7 @@ import java.util.ArrayList;
 *
 *
 * Currently only handles users and groups. Users in other OC servers (federation) should be added later.
 * Currently only handles users and groups. Users in other OC servers (federation) should be added later.
 *
 *
 * Depends on SHAREE API. {@See https://github.com/owncloud/documentation/issues/1626}
 * Depends on SHAREE API. {@see https://github.com/owncloud/documentation/issues/1626}
 *
 *
 * Syntax:
 * Syntax:
 *    Entry point: ocs/v2.php/apps/files_sharing/api/v1/sharees
 *    Entry point: ocs/v2.php/apps/files_sharing/api/v1/sharees
@@ -89,6 +89,7 @@ public class GetRemoteShareesOperation extends RemoteOperation{
    private static final String NODE_GROUPS = "groups";
    private static final String NODE_GROUPS = "groups";
    private static final String NODE_REMOTES = "remotes";
    private static final String NODE_REMOTES = "remotes";
    private static final String NODE_EMAILS = "emails";
    private static final String NODE_EMAILS = "emails";
    private static final String NODE_ROOMS = "rooms";
    public static final String NODE_VALUE = "value";
    public static final String NODE_VALUE = "value";
    public static final String PROPERTY_LABEL = "label";
    public static final String PROPERTY_LABEL = "label";
    public static final String PROPERTY_SHARE_TYPE = "shareType";
    public static final String PROPERTY_SHARE_TYPE = "shareType";
@@ -113,7 +114,7 @@ public class GetRemoteShareesOperation extends RemoteOperation{


    @Override
    @Override
    protected RemoteOperationResult run(OwnCloudClient client) {
    protected RemoteOperationResult run(OwnCloudClient client) {
        RemoteOperationResult result = null;
        RemoteOperationResult result;
        int status;
        int status;
        GetMethod get = null;
        GetMethod get = null;


@@ -145,26 +146,30 @@ public class GetRemoteShareesOperation extends RemoteOperation{
                JSONArray respExactUsers = respExact.getJSONArray(NODE_USERS);
                JSONArray respExactUsers = respExact.getJSONArray(NODE_USERS);
                JSONArray respExactGroups = respExact.getJSONArray(NODE_GROUPS);
                JSONArray respExactGroups = respExact.getJSONArray(NODE_GROUPS);
                JSONArray respExactRemotes = respExact.getJSONArray(NODE_REMOTES);
                JSONArray respExactRemotes = respExact.getJSONArray(NODE_REMOTES);
                JSONArray respExactRooms = respExact.getJSONArray(NODE_ROOMS);
                JSONArray respExactEmails = respExact.getJSONArray(NODE_EMAILS);
                JSONArray respExactEmails = respExact.getJSONArray(NODE_EMAILS);
                JSONArray respPartialUsers = respData.getJSONArray(NODE_USERS);
                JSONArray respPartialUsers = respData.getJSONArray(NODE_USERS);
                JSONArray respPartialGroups = respData.getJSONArray(NODE_GROUPS);
                JSONArray respPartialGroups = respData.getJSONArray(NODE_GROUPS);
                JSONArray respPartialRemotes = respData.getJSONArray(NODE_REMOTES);
                JSONArray respPartialRemotes = respData.getJSONArray(NODE_REMOTES);
                JSONArray respPartialRooms = respData.getJSONArray(NODE_ROOMS);
                JSONArray[] jsonResults = {
                JSONArray[] jsonResults = {
                        respExactUsers,
                        respExactUsers,
                        respExactGroups,
                        respExactGroups,
                        respExactRemotes,
                        respExactRemotes,
                        respExactRooms,
                        respExactEmails,
                        respPartialUsers,
                        respPartialUsers,
                        respPartialGroups,
                        respPartialGroups,
                        respPartialRemotes,
                        respPartialRemotes,
                        respExactEmails
                        respPartialRooms
                };
                };


                ArrayList<Object> data = new ArrayList<Object>(); // For result data
                ArrayList<Object> data = new ArrayList<>();
                for (int i=0; i<7; i++) {
                for (JSONArray jsonResult : jsonResults) {
                    for(int j=0; j< jsonResults[i].length(); j++){
                    for (int j = 0; j < jsonResult.length(); j++) {
                        JSONObject jsonResult = jsonResults[i].getJSONObject(j);
                        JSONObject jsonObject = jsonResult.getJSONObject(j);
                        data.add(jsonResult);
                        data.add(jsonObject);
                        Log_OC.d(TAG, "*** Added item: " + jsonResult.getString(PROPERTY_LABEL));
                        Log_OC.d(TAG, "*** Added item: " + jsonObject.getString(PROPERTY_LABEL));
                    }
                    }
                }
                }


@@ -178,6 +183,7 @@ public class GetRemoteShareesOperation extends RemoteOperation{
                result = new RemoteOperationResult(false, get);
                result = new RemoteOperationResult(false, get);
                String response = get.getResponseBodyAsString();
                String response = get.getResponseBodyAsString();
                Log_OC.e(TAG, "Failed response while getting users/groups from the server");
                Log_OC.e(TAG, "Failed response while getting users/groups from the server");

                if (response != null) {
                if (response != null) {
                    Log_OC.e(TAG, "*** status code: " + status + "; response message: " + response);
                    Log_OC.e(TAG, "*** status code: " + status + "; response message: " + response);
                } else {
                } else {
+4 −1
Original line number Original line Diff line number Diff line
@@ -45,7 +45,8 @@ public enum ShareType {
    PUBLIC_LINK (3),
    PUBLIC_LINK (3),
    EMAIL (4),
    EMAIL (4),
    CONTACT (5),
    CONTACT (5),
    FEDERATED (6);
    FEDERATED(6),
    ROOM(10);
    
    
    private int value;
    private int value;
    
    
@@ -76,6 +77,8 @@ public enum ShareType {
            return CONTACT;
            return CONTACT;
        case 6:
        case 6:
            return FEDERATED;
            return FEDERATED;
            case 10:
                return ROOM;    
        default:
        default:
            return NO_SHARED;
            return NO_SHARED;
        }
        }