-Subproject commit 94ac3a93d3da2719c24c4f62c95e5de3e7b5e650
+Subproject commit 9990eeb7ff68dd6e3a8056768ddce93b4e04bf99
MainApp.mContext = getApplicationContext();
boolean isSamlAuth = AUTH_ON.equals(getString(R.string.auth_method_saml_web_sso));
-
+
+ OwnCloudClientManagerFactory.setUserAgent(getUserAgent());
if (isSamlAuth) {
OwnCloudClientManagerFactory.setDefaultPolicy(Policy.SINGLE_SESSION_PER_ACCOUNT);
// Client
Uri uri = Uri.parse(url);
- OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(uri, mContext, true,
- MainApp.getUserAgent());
+ OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(uri, mContext, true);
client.setCredentials(credentials);
mContext,
SUCCESS_IF_ABSENT
);
- result = operation.execute(client, MainApp.getUserAgent());
+ result = operation.execute(client);
} else {
result = new RemoteOperationResult(RemoteOperationResult.ResultCode.UNKNOWN_ERROR);
OwnCloudAccount ocAccount = new OwnCloudAccount(mAccount,
MainApp.getAppContext());
mClient = OwnCloudClientManagerFactory.getDefaultSingleton().
- getClientFor(ocAccount, MainApp.getAppContext(),
- MainApp.getUserAgent());
+ getClientFor(ocAccount, MainApp.getAppContext());
}
mFile = params[0];
// of update
OwnCloudAccount ocAccount = new OwnCloudAccount(mCurrentAccount, this);
mDownloadClient = OwnCloudClientManagerFactory.getDefaultSingleton().
- getClientFor(ocAccount, this, MainApp.getUserAgent());
+ getClientFor(ocAccount, this);
/// perform the download
/*Log_OC.v( "NOW " + TAG + ", thread " + Thread.currentThread().getName(),
"Executing download of " + mCurrentDownload.getRemotePath());*/
- downloadResult = mCurrentDownload.execute(mDownloadClient,
- MainApp.getUserAgent());
+ downloadResult = mCurrentDownload.execute(mDownloadClient);
if (downloadResult.isSuccess()) {
saveDownloadedFile();
}
new FileDataStorageManager(mLastAccount, getContentResolver());
OwnCloudAccount ocAccount = new OwnCloudAccount(mLastAccount, this);
mUploadClient = OwnCloudClientManagerFactory.getDefaultSingleton().
- getClientFor(ocAccount, this, MainApp.getUserAgent());
+ getClientFor(ocAccount, this);
}
/// check the existence of the parent folder for the file to upload
if (grantResult.isSuccess()) {
OCFile parent = mStorageManager.getFileByPath(remoteParentPath);
mCurrentUpload.getFile().setParentId(parent.getFileId());
- uploadResult = mCurrentUpload.execute(mUploadClient,
- MainApp.getUserAgent());
+ uploadResult = mCurrentUpload.execute(mUploadClient);
if (uploadResult.isSuccess()) {
saveUploadedFile();
}
*/
private RemoteOperationResult grantFolderExistence(String pathToGrant) {
RemoteOperation operation = new ExistenceCheckRemoteOperation(pathToGrant, this, false);
- RemoteOperationResult result = operation.execute(mUploadClient, MainApp.getUserAgent());
+ RemoteOperationResult result = operation.execute(mUploadClient);
if (!result.isSuccess() && result.getCode() == ResultCode.FILE_NOT_FOUND &&
mCurrentUpload.isRemoteFolderToBeCreated()) {
SyncOperation syncOp = new CreateFolderOperation( pathToGrant, true);
// in theory, should return the same we already have
ReadRemoteFileOperation operation =
new ReadRemoteFileOperation(mCurrentUpload.getRemotePath());
- RemoteOperationResult result = operation.execute(mUploadClient, MainApp.getUserAgent());
+ RemoteOperationResult result = operation.execute(mUploadClient);
if (result.isSuccess()) {
updateOCFile(file, (RemoteFile) result.getData().get(0));
file.setLastSyncDateForProperties(syncDate);
protected RemoteOperationResult run(OwnCloudClient client) {
CreateRemoteFolderOperation operation = new CreateRemoteFolderOperation(mRemotePath,
mCreateFullPath);
- RemoteOperationResult result = operation.execute(client, MainApp.getUserAgent());
+ RemoteOperationResult result = operation.execute(client);
if (result.isSuccess()) {
saveFolderInDB();
// Check if the share link already exists
operation = new GetRemoteSharesForFileOperation(mPath, false, false);
RemoteOperationResult result =
- ((GetRemoteSharesForFileOperation)operation).execute(client, MainApp.getUserAgent());
+ ((GetRemoteSharesForFileOperation)operation).execute(client);
if (!result.isSuccess() || result.getData().size() <= 0) {
operation = new CreateRemoteShareOperation(mPath, mShareType, mShareWith, mPublicUpload,
mPassword, mPermissions);
- result = ((CreateRemoteShareOperation)operation).execute(client, MainApp.getUserAgent());
+ result = ((CreateRemoteShareOperation)operation).execute(client);
}
if (result.isSuccess()) {
client.setFollowRedirects(false);
// try to access the root folder, following redirections but not SAML SSO redirections
- result = operation.execute(client, MainApp.getUserAgent());
+ result = operation.execute(client);
String redirectedLocation = result.getRedirectedLocation();
while (redirectedLocation != null && redirectedLocation.length() > 0 &&
!result.isIdPRedirection()) {
client.setBaseUri(Uri.parse(result.getRedirectedLocation()));
- result = operation.execute(client, MainApp.getUserAgent());
+ result = operation.execute(client);
redirectedLocation = result.getRedirectedLocation();
}
while (listener.hasNext()) {
mDownloadOperation.addDatatransferProgressListener(listener.next());
}
- result = mDownloadOperation.execute(client, MainApp.getUserAgent());
+ result = mDownloadOperation.execute(client);
if (result.isSuccess()) {
mModificationTimestamp = mDownloadOperation.getModificationTimestamp();
// first: check the status of the server (including its version)
GetRemoteStatusOperation getStatus = new GetRemoteStatusOperation(mContext);
- RemoteOperationResult result = getStatus.execute(client, MainApp.getUserAgent());
+ RemoteOperationResult result = getStatus.execute(client);
if (result.isSuccess()) {
// second: get authentication method required by the server
Log_OC.d(TAG, "Trying empty authorization to detect authentication method");
DetectAuthenticationMethodOperation operation =
new DetectAuthenticationMethodOperation(mContext);
- return operation.execute(client, MainApp.getUserAgent());
+ return operation.execute(client);
}
protected RemoteOperationResult run(OwnCloudClient client) {
GetRemoteSharesForFileOperation operation = new GetRemoteSharesForFileOperation(mPath,
mReshares, mSubfiles);
- RemoteOperationResult result = operation.execute(client, MainApp.getUserAgent());
+ RemoteOperationResult result = operation.execute(client);
if (result.isSuccess()) {
@Override
protected RemoteOperationResult run(OwnCloudClient client) {
GetRemoteSharesOperation operation = new GetRemoteSharesOperation();
- RemoteOperationResult result = operation.execute(client, MainApp.getUserAgent());
+ RemoteOperationResult result = operation.execute(client);
if (result.isSuccess()) {
targetPath,
false
);
- result = operation.execute(client, MainApp.getUserAgent());
+ result = operation.execute(client);
/// 3. local move
if (result.isSuccess()) {
private void updateOCVersion(OwnCloudClient client) {
UpdateOCVersionOperation update = new UpdateOCVersionOperation(mAccount, mContext);
- RemoteOperationResult result = update.execute(client, MainApp.getUserAgent());
+ RemoteOperationResult result = update.execute(client);
if (result.isSuccess()) {
mIsShareSupported = update.getOCVersion().isSharedSupported();
}
// remote request
ReadRemoteFileOperation operation = new ReadRemoteFileOperation(remotePath);
- result = operation.execute(client, MainApp.getUserAgent());
+ result = operation.execute(client);
if (result.isSuccess()){
OCFile remoteFolder = FileStorageUtils.fillOCFile((RemoteFile) result.getData().get(0));
private RemoteOperationResult fetchAndSyncRemoteFolder(OwnCloudClient client) {
String remotePath = mLocalFolder.getRemotePath();
ReadRemoteFolderOperation operation = new ReadRemoteFolderOperation(remotePath);
- RemoteOperationResult result = operation.execute(client, MainApp.getUserAgent());
+ RemoteOperationResult result = operation.execute(client);
Log_OC.d(TAG, "Synchronizing " + mAccount.name + remotePath);
if (result.isSuccess()) {
// remote request
GetRemoteSharesForFileOperation operation =
new GetRemoteSharesForFileOperation(mLocalFolder.getRemotePath(), false, true);
- result = operation.execute(client, MainApp.getUserAgent());
+ result = operation.execute(client);
if (result.isSuccess()) {
// update local database
boolean localRemovalFailed = false;
if (!mOnlyLocalCopy) {
RemoveRemoteFileOperation operation = new RemoveRemoteFileOperation(mRemotePath);
- result = operation.execute(client, MainApp.getUserAgent());
+ result = operation.execute(client);
if (result.isSuccess() || result.getCode() == ResultCode.FILE_NOT_FOUND) {
localRemovalFailed = !(getStorageManager().removeFile(mFileToRemove, true, true));
}
RenameRemoteFileOperation operation = new RenameRemoteFileOperation(mFile.getFileName(),
mFile.getRemotePath(),
mNewName, mFile.isFolder());
- result = operation.execute(client, MainApp.getUserAgent());
+ result = operation.execute(client);
if (result.isSuccess()) {
if (mFile.isFolder()) {
if (mServerFile == null) {
ReadRemoteFileOperation operation = new ReadRemoteFileOperation(mRemotePath);
- result = operation.execute(client, MainApp.getUserAgent());
+ result = operation.execute(client);
if (result.isSuccess()){
mServerFile = FileStorageUtils.fillOCFile((RemoteFile) result.getData().get(0));
mServerFile.setLastSyncDateForProperties(System.currentTimeMillis());
// remote request
ReadRemoteFileOperation operation = new ReadRemoteFileOperation(mRemotePath);
- result = operation.execute(client, MainApp.getUserAgent());
+ result = operation.execute(client);
if (result.isSuccess()){
OCFile remoteFolder = FileStorageUtils.fillOCFile((RemoteFile) result.getData().get(0));
}
ReadRemoteFolderOperation operation = new ReadRemoteFolderOperation(mRemotePath);
- RemoteOperationResult result = operation.execute(client, MainApp.getUserAgent());
+ RemoteOperationResult result = operation.execute(client);
Log_OC.d(TAG, "Synchronizing " + mAccount.name + mRemotePath);
if (result.isSuccess()) {
if (share != null) {
RemoveRemoteShareOperation operation =
new RemoveRemoteShareOperation((int) share.getIdRemoteShared());
- result = operation.execute(client, MainApp.getUserAgent());
+ result = operation.execute(client);
if (result.isSuccess() || result.getCode() == ResultCode.SHARE_NOT_FOUND) {
Log_OC.d(TAG, "Share id = " + share.getIdRemoteShared() + " deleted");
private boolean existsFile(OwnCloudClient client, String remotePath){
ExistenceCheckRemoteOperation existsOperation =
new ExistenceCheckRemoteOperation(remotePath, mContext, false);
- RemoteOperationResult result = existsOperation.execute(client, MainApp.getUserAgent());
+ RemoteOperationResult result = existsOperation.execute(client);
return result.isSuccess();
}
mUploadOperation.addDatatransferProgressListener(listener.next());
}
if (!mCancellationRequested.get()) {
- result = mUploadOperation.execute(client, MainApp.getUserAgent());
+ result = mUploadOperation.execute(client);
/// move local temporal file or original file to its corresponding
// location in the ownCloud local folder
private boolean existsFile(OwnCloudClient client, String remotePath){
ExistenceCheckRemoteOperation existsOperation =
new ExistenceCheckRemoteOperation(remotePath, mContext, false);
- RemoteOperationResult result = existsOperation.execute(client, MainApp.getUserAgent());
+ RemoteOperationResult result = existsOperation.execute(client);
return result.isSuccess();
}
"storage manager for a NULL account");
}
mStorageManager = storageManager;
- return super.execute(mStorageManager.getAccount(), context, getUserAgent());
+ return super.execute(mStorageManager.getAccount(), context);
}
throw new IllegalArgumentException("Trying to execute a sync operation with a " +
"NULL storage manager");
mStorageManager = storageManager;
- return super.execute(client, MainApp.getUserAgent());
+ return super.execute(client);
}
"with a NULL storage manager");
}
mStorageManager = storageManager;
- return super.execute(client, MainApp.getUserAgent(), listener, listenerHandler);
+ return super.execute(client, listener, listenerHandler);
}
OwnCloudAccount ocAccount = new OwnCloudAccount(mLastTarget.mAccount,
mService);
mOwnCloudClient = OwnCloudClientManagerFactory.getDefaultSingleton().
- getClientFor(ocAccount, mService, MainApp.getUserAgent());
+ getClientFor(ocAccount, mService);
mStorageManager = new FileDataStorageManager(
mLastTarget.mAccount,
mService.getContentResolver()
OwnCloudAccount ocAccount = new OwnCloudAccount(
mLastTarget.mServerUrl, credentials);
mOwnCloudClient = OwnCloudClientManagerFactory.getDefaultSingleton().
- getClientFor(ocAccount, mService, MainApp.getUserAgent());
+ getClientFor(ocAccount, mService);
mStorageManager = null;
}
}
result = ((SyncOperation)mCurrentOperation).execute(mOwnCloudClient,
mStorageManager);
} else {
- result = mCurrentOperation.execute(mOwnCloudClient, MainApp.getUserAgent());
+ result = mCurrentOperation.execute(mOwnCloudClient);
}
} catch (AccountsException e) {
// always get client from client manager, to get fresh credentials in case of update
OwnCloudAccount ocAccount = new OwnCloudAccount(account, mService);
mOwnCloudClient = OwnCloudClientManagerFactory.getDefaultSingleton().
- getClientFor(ocAccount, mService, MainApp.getUserAgent());
+ getClientFor(ocAccount, mService);
result = mCurrentSyncOperation.execute(mOwnCloudClient, mStorageManager);
AccountUtils.constructFullURLForAccount(getContext(), account);\r
OwnCloudAccount ocAccount = new OwnCloudAccount(account, getContext());\r
mClient = OwnCloudClientManagerFactory.getDefaultSingleton().\r
- getClientFor(ocAccount, getContext(), MainApp.getUserAgent());\r
+ getClientFor(ocAccount, getContext());\r
}\r
\r
protected OwnCloudClient getClient() {\r
* locally saved.
*
* See {@link #onPerformSync(Account, Bundle, String, ContentProviderClient, SyncResult)}
- * and {@link #synchronizeFolder(String, long)}.
+ * and {@link #synchronizeFolder(OCFile)}.
*/
@Override
public void onSyncCanceled() {
*/
private void updateOCVersion() {
UpdateOCVersionOperation update = new UpdateOCVersionOperation(getAccount(), getContext());
- RemoteOperationResult result = update.execute(getClient(), MainApp.getUserAgent());
+ RemoteOperationResult result = update.execute(getClient());
if (!result.isSuccess()) {
mLastFailedResult = result;
} else {
getAccount(),
getContext()
);
- RemoteOperationResult result = synchFolderOp.execute(getClient(), MainApp.getUserAgent());
+ RemoteOperationResult result = synchFolderOp.execute(getClient());
// synchronized folder -> notice to UI - ALWAYS, although !result.isSuccess
getAccount(),
getApplicationContext()
);
- synchFolderOp.execute(getAccount(), this, MainApp.getUserAgent(), null, null);
+ synchFolderOp.execute(getAccount(), this, null, null);
setSupportProgressBarIndeterminateVisibility(true);