Skip to content

Kotlin conversion of UploadFileOperation#17108

Open
hannesa2 wants to merge 1 commit into
masterfrom
KotlinUploadFileOperation
Open

Kotlin conversion of UploadFileOperation#17108
hannesa2 wants to merge 1 commit into
masterfrom
KotlinUploadFileOperation

Conversation

@hannesa2
Copy link
Copy Markdown
Contributor

I was investigation how to change Wifi upload mechanism, and I found that causing class is still Java 👎
So I converted it in advance to Kotlin without changing anything in the logic. I hope that tests will check, if there is something now faulty

@hannesa2 hannesa2 force-pushed the KotlinUploadFileOperation branch 4 times, most recently from 118a028 to 9efa156 Compare June 6, 2026 09:13
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 6, 2026

APK file: https://github.com/nextcloud/android/actions/runs/27058366047/artifacts/7453194578
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

Log_OC.d(TAG, "Creating temporal folder")
val temporalParent = targetFile.parentFile

if (!temporalParent!!.mkdirs() && !temporalParent.isDirectory) {
Log_OC.d(TAG, "Creating temporal folder")
val temporalParent = targetFile.parentFile

if (!temporalParent!!.mkdirs() && !temporalParent.isDirectory) {
}

Log_OC.d(TAG, "Creating temporal file")
if (!targetFile.createNewFile() && !targetFile.isFile) {
}

Log_OC.d(TAG, "Creating temporal file")
if (!targetFile.createNewFile() && !targetFile.isFile) {
} else {
`in` = FileInputStream(sourceFile)
}
out = FileOutputStream(targetFile)
private fun move(sourceFile: File, targetFile: File) {
if (targetFile != sourceFile) {
val expectedFolder = targetFile.parentFile
Files.createDirectories(expectedFolder!!.toPath())
val expectedFolder = targetFile.parentFile
Files.createDirectories(expectedFolder!!.toPath())

if (expectedFolder.isDirectory) {
Files.createDirectories(expectedFolder!!.toPath())

if (expectedFolder.isDirectory) {
if (!sourceFile.renameTo(targetFile)) {
if (expectedFolder.isDirectory) {
if (!sourceFile.renameTo(targetFile)) {
// try to copy and then delete
Files.createFile(targetFile.toPath())
Files.createFile(targetFile.toPath())
try {
FileInputStream(sourceFile).channel.use { inChannel ->
FileOutputStream(targetFile).channel.use { outChannel ->
@hannesa2 hannesa2 force-pushed the KotlinUploadFileOperation branch 2 times, most recently from b5e43ff to 317a04b Compare June 6, 2026 10:04
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 6, 2026

APK file: https://github.com/nextcloud/android/actions/runs/27059364136/artifacts/7453518059
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

Signed-off-by: Hannes Achleitner <hannes.software@gmx.at>
@hannesa2 hannesa2 force-pushed the KotlinUploadFileOperation branch from 317a04b to 79ab1da Compare June 6, 2026 10:28
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 6, 2026

Codacy

SpotBugs

CategoryBaseNew
Bad practice3331
Correctness6764
Dodgy code215202
Experimental11
Internationalization77
Malicious code vulnerability22
Multithreaded correctness3126
Performance4137
Security1616
Total413386

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 6, 2026

APK file: https://github.com/nextcloud/android/actions/runs/27059855267/artifacts/7453666242
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 6, 2026

blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants