use of com.owncloud.android.files.services.TransferRequester in project android by owncloud.
the class UploadListActivity method onRemoteOperationFinish.
/**
* @param operation Operation performed.
* @param result Result of the removal.
*/
@Override
public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {
if (operation instanceof CheckCurrentCredentialsOperation) {
// Do not call super in this case; more refactoring needed around onRemoteOperationFinish :'(
getFileOperationsHelper().setOpIdWaitingFor(Long.MAX_VALUE);
dismissLoadingDialog();
Account account = ((RemoteOperationResult<Account>) result).getData();
if (!result.isSuccess()) {
requestCredentialsUpdate();
} else {
// already updated -> just retry!
TransferRequester requester = new TransferRequester();
requester.retryFailedUploads(this, account, UploadResult.CREDENTIAL_ERROR, false);
}
} else {
super.onRemoteOperationFinish(operation, result);
}
}
use of com.owncloud.android.files.services.TransferRequester in project android by owncloud.
the class ConflictsResolveActivity method conflictDecisionMade.
@Override
public void conflictDecisionMade(Decision decision) {
Integer behaviour = null;
Boolean forceOverwrite = null;
switch(decision) {
case CANCEL:
finish();
return;
case OVERWRITE:
// use local version -> overwrite on server
forceOverwrite = true;
break;
case KEEP_BOTH:
behaviour = FileUploader.LOCAL_BEHAVIOUR_MOVE;
break;
case SERVER:
// use server version -> delete local, request download
Intent intent = new Intent(this, FileDownloader.class);
intent.putExtra(FileDownloader.KEY_ACCOUNT, getAccount());
intent.putExtra(FileDownloader.KEY_FILE, getFile());
startService(intent);
finish();
return;
default:
Timber.e("Unhandled conflict decision %s", decision);
return;
}
TransferRequester requester = new TransferRequester();
requester.uploadUpdate(this, getAccount(), getFile(), behaviour, forceOverwrite, false);
finish();
}
use of com.owncloud.android.files.services.TransferRequester in project android by owncloud.
the class CopyAndUploadContentUrisTask method requestUpload.
private void requestUpload(Account account, String localPath, String remotePath, int behaviour, String mimeType) {
TransferRequester requester = new TransferRequester();
requester.uploadNewFile(mAppContext, account, localPath, remotePath, behaviour, mimeType, // do not create parent folder if not existent
false, UploadFileOperation.CREATED_BY_USER);
}
Aggregations