mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-30 21:55:10 +00:00
Use setFailed for errors when sending/receiving files
This commit is contained in:
@@ -241,7 +241,7 @@ public class CompositeReceiveFileJob extends BackgroundJob<Device, Void> {
|
||||
failedFiles = (totalNumFiles - currentFileNum + 1);
|
||||
}
|
||||
|
||||
receiveNotification.setFinished(getDevice().getContext().getResources().getQuantityString(R.plurals.received_files_fail_title, failedFiles, getDevice().getName(), failedFiles, totalNumFiles));
|
||||
receiveNotification.setFailed(getDevice().getContext().getResources().getQuantityString(R.plurals.received_files_fail_title, failedFiles, getDevice().getName(), failedFiles, totalNumFiles));
|
||||
receiveNotification.show();
|
||||
reportError(e);
|
||||
} finally {
|
||||
|
@@ -127,7 +127,7 @@ public class CompositeUploadFileJob extends BackgroundJob<Device, Void> {
|
||||
int failedFiles;
|
||||
synchronized (lock) {
|
||||
failedFiles = (totalNumFiles - currentFileNum + 1);
|
||||
uploadNotification.setFinished(getDevice().getContext().getResources()
|
||||
uploadNotification.setFailed(getDevice().getContext().getResources()
|
||||
.getQuantityString(R.plurals.send_files_fail_title, failedFiles, getDevice().getName(),
|
||||
failedFiles, totalNumFiles));
|
||||
}
|
||||
@@ -229,7 +229,7 @@ public class CompositeUploadFileJob extends BackgroundJob<Device, Void> {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
//Ignored
|
||||
// Handled in the run() function when sendPacketBlocking returns false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -99,6 +99,11 @@ class ReceiveNotification {
|
||||
}
|
||||
}
|
||||
|
||||
public void setFailed(String message) {
|
||||
setFinished(message);
|
||||
builder.setSmallIcon(android.R.drawable.stat_notify_error);
|
||||
}
|
||||
|
||||
public void setURI(Uri destinationUri, String mimeType, String filename) {
|
||||
/*
|
||||
* We only support file URIs (because sending a content uri to another app does not work for security reasons).
|
||||
|
Reference in New Issue
Block a user