Adapted code to URIs refactoring in OwnCloudClient
authorDavid A. Velasco <dvelasco@solidgear.es>
Fri, 13 Jun 2014 07:26:56 +0000 (09:26 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Fri, 13 Jun 2014 07:26:56 +0000 (09:26 +0200)
owncloud-android-library
src/com/owncloud/android/authentication/AuthenticatorActivity.java
src/com/owncloud/android/operations/DetectAuthenticationMethodOperation.java
src/com/owncloud/android/operations/GetServerInfoOperation.java
src/com/owncloud/android/services/OperationsService.java

index e069a8c..45aba26 160000 (submodule)
@@ -1 +1 @@
-Subproject commit e069a8cb9f4f874ee91d7c012c083899556378e9
+Subproject commit 45aba26a47911184e286bd4d240c4c02d68fce9a
index b87c2dc..fccd615 100644 (file)
@@ -828,9 +828,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
      * the root folder of the ownCloud server.\r
      */\r
     private void checkBasicAuthorization() {\r
-        /// get the path to the root folder through WebDAV from the version server\r
-        String webdav_path = AccountUtils.getWebdavPath(mServerInfo.mVersion, mAuthTokenType);\r
-\r
         /// get basic credentials entered by user\r
         String username = mUsernameInput.getText().toString();\r
         String password = mPasswordInput.getText().toString();\r
@@ -844,18 +841,19 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
         String remotePath ="";\r
         boolean successIfAbsent = false;\r
         boolean followRedirects = true;\r
-        startExistenceCheckRemoteOperation(remotePath, this, successIfAbsent, webdav_path, username, password, followRedirects);\r
+        startExistenceCheckRemoteOperation(\r
+                remotePath, this, successIfAbsent, username, password, followRedirects);\r
         \r
     }\r
 \r
-    private void startExistenceCheckRemoteOperation(String remotePath, Context context, boolean successIfAbsent, String webdav_path,\r
+    private void startExistenceCheckRemoteOperation(\r
+            String remotePath, Context context, boolean successIfAbsent,\r
             String username, String password, boolean followRedirects) {\r
         Intent existenceCheckIntent = new Intent();\r
         existenceCheckIntent.setAction(OperationsService.ACTION_EXISTENCE_CHECK);\r
         existenceCheckIntent.putExtra(OperationsService.EXTRA_SERVER_URL, mServerInfo.mBaseUrl);\r
         existenceCheckIntent.putExtra(OperationsService.EXTRA_REMOTE_PATH, remotePath);\r
         existenceCheckIntent.putExtra(OperationsService.EXTRA_SUCCESS_IF_ABSENT, successIfAbsent);\r
-        existenceCheckIntent.putExtra(OperationsService.EXTRA_WEBDAV_PATH, webdav_path);\r
         existenceCheckIntent.putExtra(OperationsService.EXTRA_USERNAME, username);\r
         existenceCheckIntent.putExtra(OperationsService.EXTRA_PASSWORD, password);\r
         existenceCheckIntent.putExtra(OperationsService.EXTRA_AUTH_TOKEN, mAuthToken);\r
@@ -904,14 +902,12 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
                 IndeterminateProgressDialog.newInstance(R.string.auth_trying_to_login, true);\r
         dialog.show(getSupportFragmentManager(), WAIT_DIALOG_TAG);\r
 \r
-        /// get the path to the root folder through WebDAV from the version server\r
-        String webdav_path = AccountUtils.getWebdavPath(mServerInfo.mVersion, mAuthTokenType);\r
-\r
         /// test credentials accessing the root folder\r
         String remotePath ="";\r
         boolean successIfAbsent = false;\r
         boolean followRedirections = false;\r
-        startExistenceCheckRemoteOperation(remotePath, this, successIfAbsent, webdav_path, "", "", followRedirections);\r
+        startExistenceCheckRemoteOperation(\r
+                remotePath, this, successIfAbsent, "", "", followRedirections);\r
 \r
     }\r
 \r
@@ -1284,8 +1280,7 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
         mWaitingForOpId = Long.MAX_VALUE;\r
         dismissDialog(WAIT_DIALOG_TAG);\r
 \r
-        String webdav_path = AccountUtils.getWebdavPath(mServerInfo.mVersion, mAuthTokenType);\r
-        if (result.isSuccess() && webdav_path != null) {\r
+        if (result.isSuccess()) {\r
             /// be gentle with the user\r
             IndeterminateProgressDialog dialog = \r
                     IndeterminateProgressDialog.newInstance(R.string.auth_trying_to_login, true);\r
@@ -1301,7 +1296,8 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
             String remotePath ="";\r
             boolean successIfAbsent = false;\r
             boolean followRedirects = true;\r
-            startExistenceCheckRemoteOperation(remotePath, this, successIfAbsent, webdav_path, "", "", followRedirects);\r
+            startExistenceCheckRemoteOperation(\r
+                    remotePath, this, successIfAbsent, "", "", followRedirects);\r
 \r
         } else {\r
             updateAuthStatusIconAndText(result);\r
index e8c0fd1..18d8cec 100644 (file)
@@ -93,15 +93,15 @@ public class DetectAuthenticationMethodOperation extends RemoteOperation {
         AuthenticationMethod authMethod = AuthenticationMethod.UNKNOWN;
         
         RemoteOperation operation = new ExistenceCheckRemoteOperation("", mContext, false);
-        client.setWebdavUri(Uri.parse(mWebDavUrl));
         client.clearCredentials();
         client.setFollowRedirects(false);
         
         // try to access the root folder, following redirections but not SAML SSO redirections
         result = operation.execute(client);
         String redirectedLocation = result.getRedirectedLocation(); 
-        while (redirectedLocation != null && redirectedLocation.length() > 0 && !result.isIdPRedirection()) {
-            client.setWebdavUri(Uri.parse(result.getRedirectedLocation()));
+        while (redirectedLocation != null && redirectedLocation.length() > 0 && 
+                !result.isIdPRedirection()) {
+            client.setBaseUri(Uri.parse(result.getRedirectedLocation()));
             result = operation.execute(client);
             redirectedLocation = result.getRedirectedLocation();
         } 
index 14f405e..1e6e8b0 100644 (file)
@@ -87,9 +87,9 @@ public class GetServerInfoOperation extends RemoteOperation {
        protected RemoteOperationResult run(OwnCloudClient client) {
            
            // first: check the status of the server (including its version)
-           GetRemoteStatusOperation getStatus = new GetRemoteStatusOperation(mUrl, mContext);
+           GetRemoteStatusOperation getStatus = new GetRemoteStatusOperation(mContext);
            RemoteOperationResult result = getStatus.execute(client);
-
+           
         if (result.isSuccess()) {
             // second: get authentication method required by the server
             mResultData.mVersion = (OwnCloudVersion)(result.getData().get(0));
index 3670881..bc0446b 100644 (file)
@@ -80,7 +80,6 @@ public class OperationsService extends Service {
     public static final String EXTRA_RESULT = "RESULT";
     
     // TODO review if ALL OF THEM are necessary
-    public static final String EXTRA_WEBDAV_PATH = "WEBDAV_PATH";
     public static final String EXTRA_SUCCESS_IF_ABSENT = "SUCCESS_IF_ABSENT";
     public static final String EXTRA_USERNAME = "USERNAME";
     public static final String EXTRA_PASSWORD = "PASSWORD";
@@ -112,18 +111,16 @@ public class OperationsService extends Service {
     private static class Target {
         public Uri mServerUrl = null;
         public Account mAccount = null;
-        public String mWebDavUrl = null;
         public String mUsername = null;
         public String mPassword = null;
         public String mAuthToken = null;
         public boolean mFollowRedirects = true;
         public String mCookie = null;
         
-        public Target(Account account, Uri serverUrl, String webdavUrl, String username, String password, String authToken,
+        public Target(Account account, Uri serverUrl, String username, String password, String authToken,
                 boolean followRedirects, String cookie) {
             mAccount = account;
             mServerUrl = serverUrl;
-            mWebDavUrl = webdavUrl;
             mUsername = username;
             mPassword = password;
             mAuthToken = authToken;
@@ -303,8 +300,6 @@ public class OperationsService extends Service {
                 } else {
                     Account account = operationIntent.getParcelableExtra(EXTRA_ACCOUNT);
                     String serverUrl = operationIntent.getStringExtra(EXTRA_SERVER_URL);
-                    String webDavPath = operationIntent.getStringExtra(EXTRA_WEBDAV_PATH);
-                    String webDavUrl = serverUrl + webDavPath;
                     String username = operationIntent.getStringExtra(EXTRA_USERNAME);
                     String password = operationIntent.getStringExtra(EXTRA_PASSWORD);
                     String authToken = operationIntent.getStringExtra(EXTRA_AUTH_TOKEN);
@@ -313,7 +308,6 @@ public class OperationsService extends Service {
                     target = new Target(
                             account, 
                             (serverUrl == null) ? null : Uri.parse(serverUrl),
-                            ((webDavPath == null) || (serverUrl == null)) ? null : webDavUrl,
                             username,
                             password,
                             authToken,
@@ -504,10 +498,6 @@ public class OperationsService extends Service {
                                         mLastTarget.mServerUrl,
                                         credentials,    // still can be null, and that is right
                                         this);
-                        
-                        if (mLastTarget.mWebDavUrl != null) {
-                            mOwnCloudClient.setWebdavUri(Uri.parse(mLastTarget.mWebDavUrl));
-                        }
                         mOwnCloudClient.setFollowRedirects(mLastTarget.mFollowRedirects);
                         mStorageManager = null;
                     }