remove complexity form notifyResult

Signed-off-by: Jonas Mayer <jonas.a.mayer@gmx.net>
This commit is contained in:
Jonas Mayer 2024-01-18 15:48:44 +01:00 committed by Jonas Mayer
parent 9cdd22d5c6
commit 5ba3201bc5

View file

@ -271,28 +271,25 @@ class FileUploadWorker(
} }
notificationManager.run { notificationManager.run {
val errorMessage = ErrorMessageAdapter.getErrorCauseMessage(
uploadResult,
uploadFileOperation,
context.resources
)
// FIXME SYNC_CONFLICT passes wrong OCFile, check ConflictsResolveActivity.createIntent usage
val conflictResolveIntent = if (uploadResult.code == ResultCode.SYNC_CONFLICT) {
intents.conflictResolveActionIntents(context, uploadFileOperation)
} else {
null
}
val credentialIntent: PendingIntent? = if (uploadResult.code == ResultCode.UNAUTHORIZED) { val credentialIntent: PendingIntent? = if (uploadResult.code == ResultCode.UNAUTHORIZED) {
intents.credentialIntent(uploadFileOperation) intents.credentialIntent(uploadFileOperation)
} else { } else {
null null
} }
notifyForFailedResult(uploadResult.code, conflictResolveIntent, credentialIntent, errorMessage)
if (!uploadResult.isSuccess) { showNewNotification(uploadFileOperation)
val errorMessage = ErrorMessageAdapter.getErrorCauseMessage(
uploadResult,
uploadFileOperation,
context.resources
)
// FIXME SYNC_CONFLICT passes wrong OCFile, check ConflictsResolveActivity.createIntent usage
val conflictResolveIntent = if (uploadResult.code == ResultCode.SYNC_CONFLICT) {
intents.conflictResolveActionIntents(context, uploadFileOperation)
} else {
null
}
notifyForFailedResult(uploadResult.code, conflictResolveIntent, credentialIntent, errorMessage)
showNewNotification(uploadFileOperation)
}
} }
} }