X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/57fe5e08fdaa73c48fc14f7fb6412a7398d89c70..51748e4b20a86db9af8406955cdfffc83649fcb9:/src/com/owncloud/android/services/OperationsService.java diff --git a/src/com/owncloud/android/services/OperationsService.java b/src/com/owncloud/android/services/OperationsService.java index 0f836524..a4f9d70e 100644 --- a/src/com/owncloud/android/services/OperationsService.java +++ b/src/com/owncloud/android/services/OperationsService.java @@ -23,10 +23,11 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentMap; +import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.datamodel.FileDataStorageManager; -import com.owncloud.android.lib.common.OwnCloudClientFactory; import com.owncloud.android.lib.common.OwnCloudClient; +import com.owncloud.android.lib.common.OwnCloudClientMap; import com.owncloud.android.lib.common.operations.OnRemoteOperationListener; import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperationResult; @@ -172,8 +173,12 @@ public class OperationsService extends Service { @Override public void onDestroy() { //Log_OC.wtf(TAG, "onDestroy init" ); + // Saving cookies + OwnCloudClientMap.saveAllClients(this, MainApp.getAccountType()); + //Log_OC.wtf(TAG, "Clear mUndispatchedFinisiedOperations" ); mUndispatchedFinishedOperations.clear(); + //Log_OC.wtf(TAG, "onDestroy end" ); super.onDestroy(); } @@ -397,7 +402,6 @@ public class OperationsService extends Service { //Log_OC.wtf(TAG, "Sending callback later"); } else { if (!mPendingOperations.isEmpty()) { - nextOperation(); return true; } else { return false; @@ -454,11 +458,18 @@ public class OperationsService extends Service { if (mLastTarget == null || !mLastTarget.equals(next.first)) { mLastTarget = next.first; if (mLastTarget.mAccount != null) { - mOwnCloudClient = OwnCloudClientFactory.createOwnCloudClient(mLastTarget.mAccount, getApplicationContext()); - mStorageManager = new FileDataStorageManager(mLastTarget.mAccount, getContentResolver()); + mOwnCloudClient = + OwnCloudClientMap.getClientFor(mLastTarget.mAccount, this); + mStorageManager = + new FileDataStorageManager( + mLastTarget.mAccount, + getContentResolver()); } else { - mOwnCloudClient = OwnCloudClientFactory.createOwnCloudClient(mLastTarget.mServerUrl, getApplicationContext(), - mLastTarget.mFollowRedirects); // this is not good enough + mOwnCloudClient = OwnCloudClientMap.getAnonymousClientFor( + mLastTarget.mServerUrl, + this, + mLastTarget.mFollowRedirects); + if (mLastTarget.mWebDavUrl != null) { mOwnCloudClient.setWebdavUri(Uri.parse(mLastTarget.mWebDavUrl)); }