Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b494809
chore(gradle): Improve Gradle Configuration
jim-acn Oct 10, 2025
645481a
chore(gradle): Improve Gradle Configuration
jim-acn Oct 10, 2025
9807c02
chore(gradle): Resolve comment
jim-acn Oct 13, 2025
e77fdcd
chore(gradle): Resolve comment
jim-acn Oct 14, 2025
b9b51c8
paginate: local file list adapter
alperozturk96 Oct 1, 2025
aef2b4a
paginate: local file list adapter
alperozturk96 Oct 1, 2025
d3330a5
paginate: local file list adapter
alperozturk96 Oct 1, 2025
e766ef9
refactor: pagination
alperozturk96 Oct 6, 2025
af452ab
refactor: pagination
alperozturk96 Oct 6, 2025
a740cd6
fix: sorting order
alperozturk96 Oct 6, 2025
c3d5bed
add: file helper tests
alperozturk96 Oct 6, 2025
da8afa7
fix: code analytics
alperozturk96 Oct 6, 2025
a2698d2
fix: local file list duplicate item
alperozturk96 Oct 14, 2025
cfaf825
fix(l10n): Update translations from Transifex
nextcloud-bot Oct 15, 2025
71fcc18
fix: folder download
alperozturk96 Oct 14, 2025
d243293
rename to folder download worker
alperozturk96 Oct 14, 2025
da14449
rename to folder download worker
alperozturk96 Oct 15, 2025
5fdd7db
chore: upgrade android sdk 36
alperozturk96 Oct 6, 2025
a9b76a2
refactor: update back press gesture
alperozturk96 Oct 6, 2025
5628c7b
fix: custom back press navigation
alperozturk96 Oct 6, 2025
945fd35
fix: custom back press navigation
alperozturk96 Oct 6, 2025
0544556
fix: code analytics
alperozturk96 Oct 6, 2025
710bdaa
fix: code analytics
alperozturk96 Oct 6, 2025
d12d3a3
add: Unsupported platform APIs and unable to migrate due to outdated …
alperozturk96 Oct 7, 2025
7714335
fix: back press of fda
alperozturk96 Oct 15, 2025
4e277dd
fix: back press of fda
alperozturk96 Oct 15, 2025
1fa87b9
fix: make file upload worker long running task
alperozturk96 Oct 14, 2025
c3fde61
fix: save file for folder download
alperozturk96 Oct 15, 2025
60866b8
fix: save file for folder download
alperozturk96 Oct 15, 2025
6ad8a98
fix(l10n): Update translations from Transifex
nextcloud-bot Oct 16, 2025
f3b0b8a
fix: handle not modified and no content response
alperozturk96 Oct 15, 2025
e299a74
fix: handle not modified
alperozturk96 Oct 15, 2025
ed06c09
fix: git conflict
alperozturk96 Oct 15, 2025
0696850
fix: upload cancel
alperozturk96 Sep 29, 2025
00c8c7c
fix: upload cancel
alperozturk96 Sep 29, 2025
9b04f37
fix: upload cancel
alperozturk96 Sep 30, 2025
54056b9
fix: upload cancel
alperozturk96 Sep 30, 2025
523f822
fix: upload cancel
alperozturk96 Sep 30, 2025
ee69e98
fix: upload cancel
alperozturk96 Sep 30, 2025
506fbe9
fix: upload cancel
alperozturk96 Sep 30, 2025
0c7317b
fix: upload cancel
alperozturk96 Sep 30, 2025
b8c55bd
fix: upload cancel
alperozturk96 Sep 30, 2025
d0402ae
fix: git conflict
alperozturk96 Oct 15, 2025
60ffc50
chore: update lib
alperozturk96 Oct 15, 2025
fa4efa0
chore(gradle): Resolve conflict
jim-acn Oct 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: upload cancel
Signed-off-by: alperozturk <[email protected]>

# Conflicts:
#	build.gradle
  • Loading branch information
alperozturk96 authored and jim-acn committed Oct 17, 2025
commit 0c7317b9698c3cbf2c24c54c17c00a7f3c18a653
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class FileUploadWorker(
fun cancelCurrentUpload(remotePath: String, accountName: String, onCompleted: () -> Unit) {
currentUploadFileOperation?.let {
if (it.remotePath == remotePath && it.user.accountName == accountName) {
it.cancel(null)
it.cancel(ResultCode.USER_CANCELLED)
onCompleted()
}
}
Expand Down Expand Up @@ -400,6 +400,10 @@ class FileUploadWorker(
return
}

if (uploadResult.code == ResultCode.USER_CANCELLED) {
return
}

notificationManager.run {
val errorMessage = ErrorMessageAdapter.getErrorCauseMessage(
uploadResult,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ public void updateDatabaseUploadResult(RemoteOperationResult uploadResult, Uploa
upload.getRemotePath(),
localPath
);
} else {
} else if (uploadResult.getCode() != RemoteOperationResult.ResultCode.USER_CANCELLED){
updateUploadStatus(
upload.getOCUploadId(),
UploadStatus.UPLOAD_FAILED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1131,10 +1131,6 @@ private RemoteOperationResult normalUpload(OwnCloudClient client) {
return result;
}

private boolean isCancellationRequested() {
return mCancellationRequested.get() || mUpload.getUploadStatus() == UploadsStorageManager.UploadStatus.UPLOAD_CANCELLED;
}

private void updateSize(long size) {
OCUpload ocUpload = uploadsStorageManager.getUploadById(getOCUploadId());
if (ocUpload != null) {
Expand Down Expand Up @@ -1172,7 +1168,7 @@ private RemoteOperationResult copyFile(File originalFile, String expectedPath) t
return copy(originalFile, temporalFile);
}

if (isCancellationRequested()) {
if (mCancellationRequested.get()) {
throw new OperationCancelledException();
}

Expand Down Expand Up @@ -1214,7 +1210,7 @@ private RemoteOperationResult checkNameCollision(OCFile parentFile,
}
}

if (isCancellationRequested()) {
if (mCancellationRequested.get()) {
throw new OperationCancelledException();
}

Expand Down Expand Up @@ -1438,21 +1434,37 @@ private static boolean existsFile(OwnCloudClient client,
}

/**
* Allows to cancel the actual upload operation. If actual upload operating is in progress it is cancelled, if
* upload preparation is being performed upload will not take place.
* Cancels the current upload process.
*
* <p>
* Behavior depends on the current state of the upload:
* <ul>
* <li><b>Upload in preparation:</b> Upload will not start and a cancellation flag is set.</li>
* <li><b>Upload in progress:</b> The ongoing upload operation is cancelled via
* {@link UploadFileRemoteOperation#cancel(ResultCode)}.</li>
* <li><b>No upload operation:</b> A cancellation flag is still set, but this situation is unexpected
* and logged as an error.</li>
* </ul>
*
* <p>
* Once cancelled, the database will be updated through
* {@link UploadsStorageManager#updateDatabaseUploadResult(RemoteOperationResult, UploadFileOperation)}.
*
* @param cancellationReason the reason for cancellation
*/
public void cancel(ResultCode cancellationReason) {
if (mUploadOperation == null) {
if (mUploadOperation != null) {
// Cancel an active upload
Log_OC.d(TAG, "Cancelling upload during actual upload operation.");
mUploadOperation.cancel(cancellationReason);
} else {
// Cancel while preparing or when no upload exists
mCancellationRequested.set(true);
if (mUploadStarted.get()) {
Log_OC.d(TAG, "Cancelling upload during upload preparations.");
mCancellationRequested.set(true);
Log_OC.d(TAG, "Cancelling upload during preparation.");
} else {
mCancellationRequested.set(true);
Log_OC.e(TAG, "No upload in progress. This should not happen.");
}
} else {
Log_OC.d(TAG, "Cancelling upload during actual upload operation.");
mUploadOperation.cancel(cancellationReason);
}
}

Expand Down Expand Up @@ -1507,19 +1519,19 @@ private RemoteOperationResult copy(File sourceFile, File targetFile) throws IOEx
out = new FileOutputStream(targetFile);
int nRead;
byte[] buf = new byte[4096];
while (!isCancellationRequested() &&
while (!mCancellationRequested.get() &&
(nRead = in.read(buf)) > -1) {
out.write(buf, 0, nRead);
}
out.flush();

} // else: weird but possible situation, nothing to copy

if (isCancellationRequested()) {
return new RemoteOperationResult<>(new OperationCancelledException());
if (mCancellationRequested.get()) {
return new RemoteOperationResult(new OperationCancelledException());
}
} catch (Exception e) {
return new RemoteOperationResult<>(ResultCode.LOCAL_STORAGE_NOT_COPIED);
return new RemoteOperationResult(ResultCode.LOCAL_STORAGE_NOT_COPIED);
} finally {
try {
if (in != null) {
Expand Down
8 changes: 8 additions & 0 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16772,6 +16772,14 @@
<sha256 value="66fc4c12f83ef0d2ae5536ebc4d808e2225129ba4668af77f03f27bd95b93934" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud" name="android-library" version="198270eb39">
<artifact name="android-library-198270eb39.aar">
<sha256 value="9bfd96478ef41028d4f469453e8ae43c29f9a80b35ef0b40aeb14a3818815ab4" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="android-library-198270eb39.module">
<sha256 value="afee00871f65f143324e77d6c3b95ed80e92a0127a70aae92be856823bba9a5b" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud" name="android-library" version="1a8e497c9a75edb490014ba01b9675f452d39ef6">
<artifact name="android-library-1a8e497c9a75edb490014ba01b9675f452d39ef6.aar">
<sha256 value="9022efe1d029eb74b5c165144d010dcca39bc23fd7004a3463996e5012f3d424" origin="Generated by Gradle"/>
Expand Down