Fixed 4616 : Option for editing depictions#4725
Fixed 4616 : Option for editing depictions#4725nicolas-raoul merged 63 commits intocommons-app:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4725 +/- ##
============================================
+ Coverage 50.59% 51.04% +0.45%
- Complexity 2228 2293 +65
============================================
Files 338 341 +3
Lines 15599 15960 +361
Branches 1370 1410 +40
============================================
+ Hits 7892 8147 +255
- Misses 7114 7193 +79
- Partials 593 620 +27
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Thanks, that is extremely helpful!
I noticed a few issues:
- After saving, depiction does not appear immediately in the media details (above the pen).
- Pressing the "Back" button in the depictions editor sometimes does nothing at first, the UI freezes, then all of the backs are done very quickly. I observed something similar in the categories editor pull request.
- The nearby banner appears at the top, if you open the dialog fast enough after starting the app.
|
@nicolas-raoul I think "Depictions not updating instantly" issue is resolved now. |
|
Would you mind solving the conflict? Sorry for the delay in reviewing, and thanks for your patience! |
|
@nicolas-raoul I resolved the conflicts and also could you please review #4515 once? the requested changes are made a long ago. |
nicolas-raoul
left a comment
There was a problem hiding this comment.
I noticed another issue: On a picture that already has a depiction, the Edit Depicts dialog does not show that depiction. If I search for it, it is shown as checked.
Desired behavior: When opening Edit Depicts, it should show all current depictions (with the checkbox checked).
Thanks a lot!
nicolas-raoul
left a comment
There was a problem hiding this comment.
Also, pressing Back should bring back to the media details.
Currently, pressing back brings me to the list of media (one level too far).
To show all existing depicts at the top we have to make a call to get DepictedItems because only Depicted IDs are available as existing depicts. In this PR I just compared the existing IDs with the search result and changed their checked states accordingly. |
|
So you would have to call the API (with the depicted IDs) to get the information required for displaying them, right? That sounds doable, and I think it is important to have a consistent behavior with the Upload Wizard :-) |
|
Great, the UI now shows already existing depictions! :-) Remaining bugs:
|
@nicolas-raoul Currently the depictions of the previous picture are appearing as checked. I will remove the checked state of previous depictions. Is this ok with you or the previous ones should not appear at all? |
Sounds good! :-) |
|
codeconv says that this pull request reduces unit test coverage significantly... would you mind trying to add more unit tests? @madhurgupta10 any recommendations maybe? |
The diff coverage is @Ayan-10 Try to break your code blocks into smaller blocks to test individual units (TDD) |
|
@madhurgupta10 Thanks a lot for the suggestion. But I think I added tests for most of the new lines. I think the problem here is a lot of lines gets auto intended that's why even if I didn't change anything on those lines, those lines are showing as changed lines. I will try to reverse the indentation. Other than that I added tests for all the lines that I really added or edited. @nicolas-raoul I think that will increase the diff coverage. Thanks. |
…ndroid-commons into 4616_edit_depicts
|
Thanks for reversing the indentation changes, that makes the pull request much clearer! :-) The code coverage now looks much better, but still some effort needed before a good coverage rate is reached. Would you mind following Madhur's advice breaking your code blocks into smaller blocks to test individual units? Thanks a lot! |
|
@nicolas-raoul Yes, I can surely break the codes into small test individual units. But according to codecov/patch all the large blocks are already covered, among the left ones most of them are individual units. The problem that I found here is most of the uncovered lines need a real device for testing otherwise they will show errors in unit testing for example @madhurgupta10 please have a look and if I am wrong somewhere please give your input. Thanks a lot. |
|
I think the coverage is sufficient for this PR to be merged, you can add instrumentation tests in future if needed. |
nicolas-raoul
left a comment
There was a problem hiding this comment.
Minor variable name refactoring
app/src/main/java/fr/free/nrw/commons/upload/depicts/DepictsContract.java
Show resolved
Hide resolved
| </LinearLayout> | ||
|
|
||
| <Button | ||
| android:id="@+id/depictEditButton" |
There was a problem hiding this comment.
depictEditButton -> depictionsEditButton
| * By clicking on the edit depicts button, it will send user to depict fragment | ||
| */ | ||
| @OnClick(R.id.depictEditButton) | ||
| public void onDepictEditButtonClicked() { |
There was a problem hiding this comment.
onDepictEditButtonClicked -> onDepictionsEditButtonClicked
| public static final int NOTIFICATION_EDIT_CATEGORY = 2; | ||
| public static final int NOTIFICATION_EDIT_COORDINATES = 3; | ||
| public static final int NOTIFICATION_EDIT_DESCRIPTION = 4; | ||
| public static final int NOTIFICATION_EDIT_DEPICT = 5; |
There was a problem hiding this comment.
NOTIFICATION_EDIT_DEPICT -> NOTIFICATION_EDIT_DEPICTIONS
app/src/main/res/values/strings.xml
Outdated
| <item quantity="one">Depiction %1$s is added.</item> | ||
| <item quantity="other">Depictions %1$s are added.</item> | ||
| </plurals> | ||
| <string name="depict_edit_helper_edit_message_else">Could not add depictions.</string> |
There was a problem hiding this comment.
depict_edit_helper_edit_message_else -> depictions_edit_helper_edit_message_else
app/src/main/res/values/strings.xml
Outdated
| <string name="contributions_of_user">Contributions of User: %s</string> | ||
| <string name="achievements_of_user">Achievements of User: %s</string> | ||
| <string name="menu_view_user_page">View user page</string> | ||
| <string name="edit_depicts">Edit depictions</string> |
There was a problem hiding this comment.
edit_depicts -> edit_depictions
| * and saves them in local storage | ||
| */ | ||
| @SuppressLint("CheckResult") | ||
| override fun updateDepicts(media: Media) { |
There was a problem hiding this comment.
updateDepicts -> updateDepictions
| }) | ||
| { | ||
| Timber.e( | ||
| "Failed to update depicts" |
|
|
||
| void goBackToPreviousScreen(); | ||
|
|
||
| List<String> getExistingDepicts(); |
There was a problem hiding this comment.
getExistingDepicts -> getExistingDepictions
|
Thanks Ayan! That's a great feature to have, it was not easy but thanks for your perseverance! |
|
Thanks for your appreciation. |
Description (required)
Made option for editing depictions.
Fixes #4616
What changes did you make and why?
In the current app depicts can be added only while uploading, it's very necessary for a user to edit depictions.
Tests performed (required)
Tested lastest master betaDebug and ProdDebug on Pixel 3 with API level 30.
TODO
All tested with latest version after resetting data