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

Commit 965bf4bd authored by Andy Scherzinger's avatar Andy Scherzinger Committed by GitHub
Browse files

Merge pull request #86 from nextcloud/login-improvements

Login improvements
parents 38d4f789 4d82852c
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -423,6 +423,10 @@ public class AccountUtils {
		 */
		public static final String KEY_DISPLAY_NAME = "oc_display_name";

		/**
		 * User ID
		 */
		public static final String KEY_USER_ID = "oc_id";
	}

}
+4 −2
Original line number Diff line number Diff line
@@ -43,10 +43,12 @@ import java.io.IOException;
public class ToggleFavoriteOperation extends RemoteOperation {
    private boolean makeItFavorited;
    private String filePath;
    private String userID;

    public ToggleFavoriteOperation(boolean makeItFavorited, String filePath) {
    public ToggleFavoriteOperation(boolean makeItFavorited, String filePath, String userID) {
        this.makeItFavorited = makeItFavorited;
        this.filePath = filePath;
        this.userID = userID;
    }

    @Override
@@ -69,7 +71,7 @@ public class ToggleFavoriteOperation extends RemoteOperation {
        int pos = filePath.lastIndexOf('/') + 1;
        filePath = filePath.substring(0, pos) + Uri.encode(filePath.substring(pos));

        String fullFilePath = webDavUrl + "/files/" + client.getCredentials().getUsername() + filePath;
        String fullFilePath = webDavUrl + "/files/" + userID + filePath;

        try {
            propPatchMethod = new PropPatchMethod(fullFilePath,
+8 −2
Original line number Diff line number Diff line
@@ -279,8 +279,14 @@ public class GetRemoteCapabilitiesOperation extends RemoteOperation {
                            capability.setServerName(respTheming.getString(PROPERTY_SERVERNAME));
                            capability.setServerSlogan(respTheming.getString(PROPERTY_SERVERSLOGAN));
                            capability.setServerColor(respTheming.getString(PROPERTY_SERVERCOLOR));
                            if (respTheming.has(PROPERTY_SERVERLOGO) &&
                                    respTheming.getString(PROPERTY_SERVERLOGO) != null) {
                                capability.setServerLogo(respTheming.getString(PROPERTY_SERVERLOGO));
                            }
                            if (respTheming.has(PROPERTY_SERVERBACKGROUND) &&
                                    respTheming.getString(PROPERTY_SERVERBACKGROUND) != null) {
                                capability.setServerBackground(respTheming.getString(PROPERTY_SERVERBACKGROUND));
                            }
                            Log_OC.d(TAG, "*** Added " + NODE_THEMING);
                        }

+17 −1
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import com.owncloud.android.lib.common.UserInfo;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;

import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.NameValuePair;
@@ -97,16 +98,31 @@ public class GetRemoteUserInfoOperation extends RemoteOperation {
     */
    public static final long QUOTA_LIMIT_INFO_NOT_AVAILABLE = Long.MIN_VALUE;

    private String userID;

    public GetRemoteUserInfoOperation() {
    }

    public GetRemoteUserInfoOperation(String userID) {
        this.userID = userID;
    }

    @Override
    protected RemoteOperationResult run(OwnCloudClient client) {
        RemoteOperationResult result = null;
        int status = -1;
        GetMethod get = null;
        String url = client.getBaseUri() + OCS_ROUTE_SELF;

        OwnCloudVersion version = client.getOwnCloudVersion();
        boolean versionWithSelfAPI = version != null && version.isSelfSupported();

        String url = "";

        if (!versionWithSelfAPI && TextUtils.isEmpty(userID)) {
            url = client.getBaseUri() + OCS_ROUTE_SEARCH + userID;
        } else {
            url = client.getBaseUri() + OCS_ROUTE_SELF;
        }


        OwnCloudBasicCredentials credentials = (OwnCloudBasicCredentials) client.getCredentials();