Trigger media scan after file upload
[pub/Android/ownCloud.git] / src / com / owncloud / android / authentication / AuthenticatorAsyncTask.java
index e995c00..a25ade8 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2015 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author masensio on 09/02/2015.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -24,6 +27,7 @@ import android.os.AsyncTask;
 import com.owncloud.android.lib.common.OwnCloudClient;
 import com.owncloud.android.lib.common.OwnCloudClientFactory;
 import com.owncloud.android.lib.common.OwnCloudCredentials;
 import com.owncloud.android.lib.common.OwnCloudClient;
 import com.owncloud.android.lib.common.OwnCloudClientFactory;
 import com.owncloud.android.lib.common.OwnCloudCredentials;
+import com.owncloud.android.lib.common.network.RedirectionPath;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
 
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
 
@@ -32,8 +36,6 @@ import java.lang.ref.WeakReference;
 
 /**
  * Async Task to verify the credentials of a user
 
 /**
  * Async Task to verify the credentials of a user
- *
- * @author masensio on 09/02/2015.
  */
 public class AuthenticatorAsyncTask  extends AsyncTask<Object, Void, RemoteOperationResult> {
 
  */
 public class AuthenticatorAsyncTask  extends AsyncTask<Object, Void, RemoteOperationResult> {
 
@@ -60,7 +62,6 @@ public class AuthenticatorAsyncTask  extends AsyncTask<Object, Void, RemoteOpera
             // Client
             Uri uri = Uri.parse(url);
             OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(uri, mContext, true);
             // Client
             Uri uri = Uri.parse(url);
             OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(uri, mContext, true);
-
             client.setCredentials(credentials);
 
             // Operation
             client.setCredentials(credentials);
 
             // Operation
@@ -71,6 +72,12 @@ public class AuthenticatorAsyncTask  extends AsyncTask<Object, Void, RemoteOpera
             );
             result = operation.execute(client);
 
             );
             result = operation.execute(client);
 
+            if (operation.wasRedirected()) {
+                RedirectionPath redirectionPath = operation.getRedirectionPath();
+                String permanentLocation = redirectionPath.getLastPermanentLocation();
+                result.setLastPermanentLocation(permanentLocation);
+            }
+
         } else {
             result = new RemoteOperationResult(RemoteOperationResult.ResultCode.UNKNOWN_ERROR);
         }
         } else {
             result = new RemoteOperationResult(RemoteOperationResult.ResultCode.UNKNOWN_ERROR);
         }