-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Refactor uploads #2981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor uploads #2981
Conversation
* Fix duplicate param information (#2515) * Bug fix issue #2476 (#2526) * Added wikidataEntityID in all db versions, handled db.execSql via method runQuery * Versioning and changelog for v2.10.2 (#2531) * Update changelog.md * Versioning for v2.10.2 * Update changelog.md * Bugfix/issue 2580 (#2584) * Corrected string placedholders in certain string files * Corrected string placedholders in certain string files[Bug fix #2580] * Bug Fix #2585 (#2647) * Bug Fix #2585 * Added null checks on view in SearchImageFragment when updating views from external sources * Disposed the disposables in SearchActivity and SearchImageFragment when no longer in active lifecycle * use FragmentUtils to verify fragment active state * Bug Fix issue #2648 (#2678) * Bug Fix issue #2648 * Handled external storage permission before file download * * Removed redudant check for permission in MediaDetailPagerFragment (Dexter already does that) * Removed duplicate code in PermissionUtil$checkPermissionsAndPerformAction, used the existing function with conditional extra parameters * string name typo correction * BugFix issue #2652 (#2706) * Addded null check on bookmark before operating on it * BugFix issue #2711 (#2712) * Added null checks in OkHttpJsonApiClient$searchImages MwQueryResponse * BugFix #2718 (#2719) * Handled null auth cookies * Fix #2791: NPE when nominating for deletion and leaving screen (#2792) * Bug Fix issue #2789 (#2790) * Handled Illegal State Exception for non existent appropriate view parents in ViewUtils$showShortSnackbar * BugFix #2720 (#2831) BugFix deprecated licenes #2720 * ui fixes, wip, upload * *Issue #2886, BugFix #2832[wip] * updated UploadActivity code * modified ui * Updated UploadPresenterTest * * updated interfaces names to follow names suffixed with Contract * added test cases * card view elevation * view pager disabled swipe * bug fix, duplicate image * used existing non-swipable view pager * Avoid image view resize with keyboard, added adjustPan and stateVisible as softinputMode for UploadActivity * retain UploadBaseFragment instances on orientation changes * * Added test cases for UploadMediaPresenter * Injected io and main thread schedulers * categories presenter test cased wip * Added CategoriesPresenter test * * Added the logic to show open map (with to be uploaded image's coordinates while uploading image) * codacy suggested changes * added java docs * Added travis_wait fot android-wait-for-emulator * ranamed interface onResponseCallback to Callback * * Added api to delete picture in UploadModel * cleanUp in UploadModel. once upload has been initiated * Removed unused methods from UploadModel and the corresponding test class * * Added tests for UploadPresenter * Travis suggested changes * Addded copy previous title and description * * Made the upload add descriptions visible when keyboard visible * add description request focus only when user manually requests it * Added JavaDocs, review suggested changes * Fix dagger injection * use DialogUtil to show info in descriptions * use activity context for DialogUtil * Minor changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ A review job has been created and sent to the PullRequest network.
Check the status or cancel PullRequest code review here.
@maskaravivek Can you ebaborate this one Ensure the same templates are added (not sure if this will be an issue if backend has not changed, but make sure you check) |
@ashishkumar468 I was checking for uploads for images. And currently I think we couldn't merge this branch into master. I have mostly focused on changing title to captions mostly the UI part. The image title for uploading the image is not the captions nor the filename. I'll take the task of First Caption as filename and sending through API. Till then we can focus on other Issues with this PR:) |
Just spoke to @ashishkumar468 and this is ready for testing now. I will start tomorrow - as it is a HUGE change, help with testing is always appreciated. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preliminary review: Looks good to me for the most part, thanks @ashishkumar468 ! :)
- Javadocs are mostly present but missing from a few classes.
- Code style needs to be fixed
- Codecov bot does not seem to have made the usual comment re: code coverage. Not sure why that is. :/
I will proceed with the manual testing now
app/src/main/java/fr/free/nrw/commons/repository/UploadRemoteDataSource.java
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/upload/categories/CategoriesPresenter.java
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/upload/license/MediaLicensePresenter.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending fixes mentioned in bold in opening comment edit.
Thanks for testing this out @misaochan. I will make the necessary changes and let you know :-) |
* merged with master * BugFix IllegalStateException * setRetainState(true), not required with FragmentStatePagerAdapter * Increase the ViewPager's Offscreen Limit, we want all the fragments to be active * BugFix, clear selected categoris for previous upload session * Clear Selected Categories * Addded JavaDocs for CategoriesModel * Code Formatting in app/src/main/java/fr/free/nrw/commons/upload/UploadModel.java * Added class level JavaDoc UploadRemoteDataSource * Added class level JavaDoc for UploadRepository * Added JavaDocs for ThumbnailsAdapter * Added JavaDocs for MediaLicensePresenter, CategoriesPresenter * Removed null check on category query * Show default catgeories based on image title and gps location when category text empty * Allow search for empty category search * Attached image scale listener to upload media image * Bug fix, reduced the add description edit text clickable bound
Just tested wikidata edits. They are working fine for me. |
Codecov Report
@@ Coverage Diff @@
## master #2981 +/- ##
=========================================
+ Coverage 3.74% 4.43% +0.69%
=========================================
Files 249 259 +10
Lines 12102 12261 +159
Branches 1070 1051 -19
=========================================
+ Hits 453 544 +91
- Misses 11615 11678 +63
- Partials 34 39 +5
Continue to review full report at Codecov.
|
* merged with master * BugFix IllegalStateException * setRetainState(true), not required with FragmentStatePagerAdapter * Increase the ViewPager's Offscreen Limit, we want all the fragments to be active * BugFix, clear selected categoris for previous upload session * Clear Selected Categories * Addded JavaDocs for CategoriesModel * Code Formatting in app/src/main/java/fr/free/nrw/commons/upload/UploadModel.java * Added class level JavaDoc UploadRemoteDataSource * Added class level JavaDoc for UploadRepository * Added JavaDocs for ThumbnailsAdapter * Added JavaDocs for MediaLicensePresenter, CategoriesPresenter * Removed null check on category query * Show default catgeories based on image title and gps location when category text empty * Allow search for empty category search * Attached image scale listener to upload media image * Bug fix, reduced the add description edit text clickable bound * Added tooltip in Title in UploadMediaFragment * BugFix recent categories * Updated test methods
Just checked the following:
These things are now working for me. There's still a memory leak happening which needs to be fixed (This is different from what I fixed in #3001 ). |
* merged with master * BugFix IllegalStateException * setRetainState(true), not required with FragmentStatePagerAdapter * Increase the ViewPager's Offscreen Limit, we want all the fragments to be active * BugFix, clear selected categoris for previous upload session * Clear Selected Categories * Addded JavaDocs for CategoriesModel * Code Formatting in app/src/main/java/fr/free/nrw/commons/upload/UploadModel.java * Added class level JavaDoc UploadRemoteDataSource * Added class level JavaDoc for UploadRepository * Added JavaDocs for ThumbnailsAdapter * Added JavaDocs for MediaLicensePresenter, CategoriesPresenter * Removed null check on category query * Show default catgeories based on image title and gps location when category text empty * Allow search for empty category search * Attached image scale listener to upload media image * Bug fix, reduced the add description edit text clickable bound * Added tooltip in Title in UploadMediaFragment * BugFix recent categories * Updated test methods * Avoid memory leak, free the adpater in MediaLicenseFragment.onDestroyView
@maskaravivek Thanks for pointing out the memory leak. I have added a fix for it as well. @misaochan @neslihanturan, The PR is up for testing :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Am happy to merge once @misaochan's review is also completed. :)
Hi @ashishkumar0207 , I get this error on your branch just after choosing and image from gallery. I am not sure if this is relevant with your changes though. On beta cluster, API 26 emulator.
|
@neslihanturan Thanks for helping with the logs, I have raise a PR fixing the Issue. please have a look #3012 |
* merged with master * BugFix IllegalStateException * setRetainState(true), not required with FragmentStatePagerAdapter * Increase the ViewPager's Offscreen Limit, we want all the fragments to be active * BugFix, clear selected categoris for previous upload session * Clear Selected Categories * Addded JavaDocs for CategoriesModel * Code Formatting in app/src/main/java/fr/free/nrw/commons/upload/UploadModel.java * Added class level JavaDoc UploadRemoteDataSource * Added class level JavaDoc for UploadRepository * Added JavaDocs for ThumbnailsAdapter * Added JavaDocs for MediaLicensePresenter, CategoriesPresenter * Removed null check on category query * Show default catgeories based on image title and gps location when category text empty * Allow search for empty category search * Attached image scale listener to upload media image * Bug fix, reduced the add description edit text clickable bound * Added tooltip in Title in UploadMediaFragment * BugFix recent categories * Updated test methods * Avoid memory leak, free the adpater in MediaLicenseFragment.onDestroyView * BugFix Illegal State Exception in ViewpPagerAdapter * Remove irrelevant comment
Sorry my mistake, it is not solved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I forgot approving it earlier:)
Refactor Upload Activities
Optimised UploadActivity, added fragments for various stages of upload, switched to MVP
Fixes #2886
To be tested
Uploads:
Camera upload
Camera nearby upload with successful wikidata edit
Single gallery upload
Google Photos upload
Multiple gallery upload
Gallery upload with successful wikidata edit - upload is successful but Wikidata edit is not. The toast is not even triggered.
Image taken date is correct
Suffixes are added if same title is used
In the current ShareActivity:
Tooltips for title, desc, license fields - tooltip not present for title
Language selector for desc
Prefilling of title and desc when upload initiated via Nearby
License selector
Link to license and Commons policies - works, but crashes app
Zoom in (and back out)
Open location of image on maps
Copy previous title/desc
Category suggestions/selection:
When search text field is empty, display:-Recent categories - does not work
Location-based category suggestions (if image has geolocation) - does not work
Title-based category suggestions - does not work
Wikidata item category (if image is uploaded via Nearby and if that Wikidata item has a category) - does not work
When user types in search text field:
Check for categories shortly after typing stops, repeatedly
Display exact matches at the top
Categories selected via both of these suggestion types need to be added to the list of category selections
BUG: Categories are not saved with multiple uploads, the final product in Commons is missing categories
Warnings:
If image is too dark
If image already exists in Commons (via hash check)
If user tries to submit empty title (do not allow to proceed)
If user does not select any categories
Image templates: