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.OwnCloudClientFactory;
+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;
}
}
- public void dispatchResultIfFinished(int operationId, OnRemoteOperationListener listener) {
+ public boolean dispatchResultIfFinished(int operationId, OnRemoteOperationListener listener) {
Pair<RemoteOperation, RemoteOperationResult> undispatched =
mUndispatchedFinishedOperations.remove(operationId);
if (undispatched != null) {
listener.onRemoteOperationFinish(undispatched.first, undispatched.second);
+ return true;
//Log_OC.wtf(TAG, "Sending callback later");
} else {
+ if (!mPendingOperations.isEmpty()) {
+ return true;
+ } else {
+ return false;
+ }
//Log_OC.wtf(TAG, "Not finished yet");
}
}
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