Merge pull request #1048 from owncloud/shareWithYou_icon_in_fileList
[pub/Android/ownCloud.git] / src / com / owncloud / android / services / OperationsService.java
index ee01c41..7667e90 100644 (file)
@@ -40,6 +40,7 @@ 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.shares.ShareType;
+import com.owncloud.android.lib.resources.status.OwnCloudVersion;
 import com.owncloud.android.lib.resources.users.GetRemoteUserNameOperation;
 import com.owncloud.android.operations.common.SyncOperation;
 import com.owncloud.android.operations.CreateFolderOperation;
@@ -54,6 +55,7 @@ import com.owncloud.android.operations.SynchronizeFolderOperation;
 import com.owncloud.android.operations.UnshareLinkOperation;
 
 import android.accounts.Account;
+import android.accounts.AccountManager;
 import android.accounts.AccountsException;
 import android.accounts.AuthenticatorException;
 import android.accounts.OperationCanceledException;
@@ -352,12 +354,7 @@ public class OperationsService extends Service {
                 return true;
                 //Log_OC.wtf(TAG, "Sending callback later");
             } else {
-                if (!mServiceHandler.mPendingOperations.isEmpty()) {
-                    return true;
-                } else {
-                    return false;
-                }
-                //Log_OC.wtf(TAG, "Not finished yet");
+                return (!mServiceHandler.mPendingOperations.isEmpty());
             }
         }
         
@@ -441,7 +438,13 @@ public class OperationsService extends Service {
                             OwnCloudAccount ocAccount = new OwnCloudAccount(mLastTarget.mAccount,
                                     mService);
                             mOwnCloudClient = OwnCloudClientManagerFactory.getDefaultSingleton().
-                                    getClientFor(ocAccount, mService, MainApp.getUserAgent());
+                                    getClientFor(ocAccount, mService);
+
+                            OwnCloudVersion version = com.owncloud.android.authentication.AccountUtils.getServerVersion(
+                                    mLastTarget.mAccount
+                            );
+                            mOwnCloudClient.setOwnCloudVersion(version);
+
                             mStorageManager = new FileDataStorageManager(
                                     mLastTarget.mAccount, 
                                     mService.getContentResolver()
@@ -459,7 +462,7 @@ public class OperationsService extends Service {
                             OwnCloudAccount ocAccount = new OwnCloudAccount(
                                     mLastTarget.mServerUrl, credentials);
                             mOwnCloudClient = OwnCloudClientManagerFactory.getDefaultSingleton().
-                                    getClientFor(ocAccount, mService, MainApp.getUserAgent());
+                                    getClientFor(ocAccount, mService);
                             mStorageManager = null;
                         }
                     }
@@ -469,7 +472,7 @@ public class OperationsService extends Service {
                         result = ((SyncOperation)mCurrentOperation).execute(mOwnCloudClient,
                                 mStorageManager);
                     } else {
-                        result = mCurrentOperation.execute(mOwnCloudClient, MainApp.getUserAgent());
+                        result = mCurrentOperation.execute(mOwnCloudClient);
                     }
                     
                 } catch (AccountsException e) {