Skip to content

Enhance failed uploads#6161

Open
tobiasKaminsky wants to merge 4 commits intomasterfrom
pendingUploads
Open

Enhance failed uploads#6161
tobiasKaminsky wants to merge 4 commits intomasterfrom
pendingUploads

Conversation

@tobiasKaminsky
Copy link
Member

  • first check constraints, then get failed uploads based on this constraints only

  • enhanced remove uploads with no accounts associated

  • use List instead of OCUpload[]

Signed-off-by: tobiasKaminsky tobias@kaminsky.me

Testing

Writing tests is very important. Please try to write some tests for your PR.
If you need help, please do not hesitate to ask in this PR for help.

unit tests
instrumented tests
UI tests

  • Tests written, or not not needed

…traints only

- enhanced remove uploads with no accounts associated
- use List<OCUpload> instead of OCUpload[]

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
@nextcloud-android-bot
Copy link
Collaborator

master-Unit test failed, but no output was generated. Maybe a preliminary stage failed.

@nextcloud-android-bot
Copy link
Collaborator

stable-Unit test failed, but no output was generated. Maybe a preliminary stage failed.

@nextcloud-android-bot
Copy link
Collaborator

@nextcloud-android-bot
Copy link
Collaborator

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

@nextcloud-android-bot
Copy link
Collaborator

}

public void setWhileChargingOnly(boolean whileChargingOnly) {
public OCUpload setWhileChargingOnly(boolean whileChargingOnly) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fluent Interface FTW 👍

return;
}

// always clean up
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...except when there is no internet or power-saving

--> the following removal call could just be executed no matter the above (doesn't hurt the way it is now either)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try { ... } finally { ... } can be used to deal with such situation.

@AndyScherzinger
Copy link
Member

looking good, just some minor comments

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
retry failed uploads only once

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
@nextcloud-android-bot
Copy link
Collaborator

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/14258.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

@nextcloud-android-bot
Copy link
Collaborator

Codacy

392

Lint

TypemasterPR
Warnings9595
Errors00

SpotBugs (new)

Warning TypeNumber
Bad practice Warnings27
Correctness Warnings64
Internationalization Warnings9
Malicious code vulnerability Warnings4
Multithreaded correctness Warnings9
Performance Warnings80
Security Warnings44
Dodgy code Warnings139
Total376

SpotBugs (master)

Warning TypeNumber
Bad practice Warnings27
Correctness Warnings64
Internationalization Warnings9
Malicious code vulnerability Warnings4
Multithreaded correctness Warnings9
Performance Warnings75
Security Warnings44
Dodgy code Warnings139
Total371

SpotBugs increased!

}

@Test
public void testConstraintsWithFailedUploads() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is pretty intimidating by it's size. I'd consider splitting that into smaller units.

@@ -988,61 +997,61 @@ public static void retryUpload(@NonNull Context context, @NonNull Account accoun
* Retry a subset of all the stored failed uploads.
*
* @param context Caller {@link Context}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superficial param description - safe to remove maybe?

* Get all uploads which where successfully completed.
*/
public OCUpload[] getFinishedUploads() {
public void removeUploadsWithExpiredUsers(List<Account> existingAccounts) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be a new method. Would it be possible to use List<User> instead of Account?

return;
}

// always clean up
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try { ... } finally { ... } can be used to deal with such situation.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants