Skip to content

Conversation

@neslihanturan
Copy link
Collaborator

@neslihanturan neslihanturan commented Dec 13, 2018

Description (required)

Fixes #1556 Allow users to easily re-upload failed uploads... Currently, fail and cancel buttons moved to contrib list and they works as intended.
But we don not give any reason about fail. Because I couldn't find any table of Mediawiki API error codes. Maybe someone can help me.
It gives a possible solution for badtoken error code.

Meanwhile this can be merged.

What changes did you make and why?

Tests performed (required)

Tested API 26, betaDebug

Screenshots showing what changed (optional - for UI changes)
image

@codecov-io
Copy link

codecov-io commented Dec 13, 2018

Codecov Report

Merging #2112 into master will increase coverage by 0.08%.
The diff coverage is 2.38%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2112      +/-   ##
=========================================
+ Coverage     5.6%   5.69%   +0.08%     
=========================================
  Files         225     233       +8     
  Lines       11379   11614     +235     
  Branches     1065    1077      +12     
=========================================
+ Hits          638     661      +23     
- Misses      10689   10898     +209     
- Partials       52      55       +3
Impacted Files Coverage Δ
...w/commons/contributions/ContributionsFragment.java 0% <ø> (ø) ⬆️
...java/fr/free/nrw/commons/upload/UploadService.java 0% <ø> (ø) ⬆️
...ee/nrw/commons/media/MediaDetailPagerFragment.java 0% <ø> (ø) ⬆️
.../commons/contributions/ContributionViewHolder.java 0% <0%> (ø) ⬆️
...ommons/contributions/ContributionsListAdapter.java 0% <0%> (ø) ⬆️
...rw/commons/mwapi/ApacheHttpClientMediaWikiApi.java 3.94% <25%> (+0.27%) ⬆️
...a/fr/free/nrw/commons/utils/ContributionUtils.java 7.14% <0%> (-4.98%) ⬇️
...n/java/fr/free/nrw/commons/CommonsApplication.java 41.77% <0%> (-2.81%) ⬇️
...n/java/fr/free/nrw/commons/auth/LoginActivity.java 0% <0%> (ø) ⬆️
... and 29 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2175ba2...47f10cb. Read the comment docs.

* @param cursor cursor which will be deleted
*/
public void deleteUpload(Cursor cursor) {
if (NetworkUtils.isInternetConnectionEstablished(mContext)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This deletes the thing from the local db right, do we need to have a check for Network Connection ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Very valid concern but yes, since we can not make sure db is up to date. If we network off during upload, then click to retry or cancel, cursor displays latest uploaded item and it says "Skipping deletion for non-failed contrib [previous contrib]" . It points to wrong contrib. For retry it was same. You can go
f3818c6 commit and see. Thanks for reviewing though:)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ohh, if that is the case, then yeah it is required

@neslihanturan
Copy link
Collaborator Author

We can switch from toast to any other thing to display this solutions. If you have any idea pleas share

@neslihanturan neslihanturan changed the title Retry failed uploads [Part 1] - #1556 Allow users to easily re-upload failed uploads... Retry failed uploads - #1556 Allow users to easily re-upload failed uploads... Dec 14, 2018
@commons-app commons-app deleted a comment Dec 15, 2018
@misaochan
Copy link
Member

Thanks for the PR, @neslihanturan . Unfortunately I have no failed uploads and thus cannot test this. The code looks good to me however. If @maskaravivek or @ashishkumar468 can take a look at the code and approve it as well, I think we can just merge... and let our alpha users test it. ;)

<string name="display_location_permission_explanation">Ask for location permission when needed for nearby notification card view feature.</string>

<string name="this_function_needs_network_connection">This function requires network connection, please check your connection settings.</string>
<string name="bad_token_error_proposed_solution">Upload failed with "badtoken" error. Logging out and in again usually help to solve this issue. Meanwhile, we are working to prevent this error. </string>
Copy link
Member

Choose a reason for hiding this comment

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

Upload failed due to issues with edit token. Please try logging out and in again.

@neslihanturan
Copy link
Collaborator Author

@misaochan you can test it like this: Upload something, disable network during connection. It will fail and you can test it. This is how I did during development:)

@neslihanturan
Copy link
Collaborator Author

String is fixed, thanks @misaochan :)

Copy link
Contributor

@maskaravivek maskaravivek left a comment

Choose a reason for hiding this comment

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

The changes look good to me. Even I do not have a failed upload on my device as of now. :(

We can probably merge it and let our alpha users test it.

Also, if we are suggesting users to log out for bad token error, we should persist the pending contributions otherwise he will have to again upload the same file. For him, the easiest thing to do would be to simply click on retry after re-login.

The flow could be:

try an upload > badtoken error > show a snackbar prompting him to login > take him to login page without clearing shared prefs and DBs > on relogin let him retry the upload.

We just need the user to refresh his user session, so there's no need to clear other data.

@neslihanturan
Copy link
Collaborator Author

You can manage to create failed uploads with technique I mentioned above. Anyway, I consistently created and retry button worked for me.

@misaochan
Copy link
Member

@neslihanturan Could you please rebase on master so that @maskaravivek 's Travis fixes are included? The Travis build is failing, probably because of that.

@neslihanturan
Copy link
Collaborator Author

It was just old Travis report, currently it passed. You can go ahead and merge:)

@neslihanturan
Copy link
Collaborator Author

@misaochan pinging:) So that I can mark this iğssue as solved on #2171

@misaochan misaochan merged commit 21edcb7 into commons-app:master Dec 19, 2018
@misaochan
Copy link
Member

Yes you can mark the issue as solved. ;)

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.

5 participants