Skip to content

Fixes #2815 - Nominating for deletion is cancelled on leaving the media details #4295

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

Merged
merged 9 commits into from
Jun 4, 2021

Conversation

Pratham2305
Copy link
Contributor

Description (required)

Fixes #2815

What changes did you make and why?

The issue was because as on clicking back, all the added disposables cleared with compositeDisposable.clear()
So now I have not added the deletion disposable to the container and also added a progress bar to tell the user that the app is working on it as the process is kinda slow

Tests performed (required)

Tested betaDebug on Pixel 3 with API level 29.

Screenshots (for UI changes only)

Screenshot_1616074496

Copy link
Collaborator

@neslihanturan neslihanturan left a comment

Choose a reason for hiding this comment

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

Approving by reading the code, tomorrow I will manually test it. Thanks @Pratham2305 :)

Copy link
Collaborator

@neslihanturan neslihanturan left a comment

Choose a reason for hiding this comment

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

Hey @Pratham2305 , thanks a lot for these changes. It mostly works but I have some additional ideas:

  • Select image and jump on media details
  • Click on nominate and nominate image for deletion, progressbar appeared as expected
  • Click to back button and jump on contributions list
  • Select the image again
  • Expected behavior is to see a progressbar to describe a nomination for deletion is in progress here. What I see is just the nominate for deletion button with no progressbar.
  • After image is nominated while I am staring at media details screen, expected behavior is the button (with progressbar) will be changed with banner as soon as the process completed. What currently happens is that I still see the button (not the banner) even after the image is nominated (process is done). I have to go back to contributions list and come back again to see "this image is nominated" banner.

This fix solves it functionally, however UI flows are not perfect yet.

@Pratham2305
Copy link
Contributor Author

Thanks for the review @neslihanturan, I am able to notice the issue and will try to resolve it ASAP.

@neslihanturan
Copy link
Collaborator

Hey @Pratham2305 , wanted to ping you to make sure you don't claim any other issues before this review is done :)

@codecov-io
Copy link

Codecov Report

Merging #4295 (1c19449) into master (4bca142) will decrease coverage by 0.03%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #4295      +/-   ##
============================================
- Coverage     10.22%   10.19%   -0.04%     
  Complexity      469      469              
============================================
  Files           342      342              
  Lines         13084    13126      +42     
  Branches       1062     1064       +2     
============================================
  Hits           1338     1338              
- Misses        11678    11720      +42     
  Partials         68       68              
Impacted Files Coverage Δ Complexity Δ
...rw/commons/bookmarks/BookmarkListRootFragment.java 8.25% <0.00%> (-0.57%) 1.00 <0.00> (ø)
.../nrw/commons/category/CategoryDetailsActivity.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...w/commons/contributions/ContributionsFragment.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...e/nrw/commons/explore/ExploreListRootFragment.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...va/fr/free/nrw/commons/explore/SearchActivity.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...xplore/depictions/WikidataItemDetailsActivity.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...nrw/commons/explore/media/PageableMediaFragment.kt 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...fr/free/nrw/commons/media/MediaDetailFragment.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...ee/nrw/commons/media/MediaDetailPagerFragment.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)

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 4bca142...1c19449. Read the comment docs.

@Pratham2305
Copy link
Contributor Author

I have made the changes, @neslihanturan Can you please review them. Thanks!

@neslihanturan
Copy link
Collaborator

Hey @Pratham2305 , I keep getting the same/similar crash on this PR. Here is logcat:

USER_COMMENT=notified for deletion, went back to contrib list, came back to media details again, notification progress shown as ot should then crashed
APP_VERSION_CODE=876
APP_VERSION_NAME=3.0.0-debug-Pratham2305-fix-issue-2815
ANDROID_VERSION=10
PHONE_MODEL=Redmi Note 8
STACK_TRACE=java.lang.IllegalStateException: The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged! Expected adapter item count: 180, found: 320 Pager id: fr.free.nrw.commons.beta:id/mediaDetailsPager Pager class: class androidx.viewpager.widget.ViewPager Problematic adapter: class fr.free.nrw.commons.media.MediaDetailPagerFragment$MediaDetailAdapter
	at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1143)
	at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1092)
	at androidx.viewpager.widget.ViewPager.onMeasure(ViewPager.java:1622)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at android.view.View.measure(View.java:25086)
	at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:735)
	at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:481)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at com.android.internal.policy.DecorView.onMeasure(DecorView.java:742)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:3083)
	at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1857)
	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2146)
	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1745)
	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7768)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:967)
	at android.view.Choreographer.doCallbacks(Choreographer.java:791)
	at android.view.Choreographer.doFrame(Choreographer.java:726)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:952)
	at android.os.Handler.handleCallback(Handler.java:883)
	at android.os.Handler.dispatchMessage(Handler.java:100)
	at android.os.Looper.loop(Looper.java:214)
	at android.app.ActivityThread.main(ActivityThread.java:7356)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940)

IS_SILENT=false
USER_EMAIL=
USER_CRASH_DATE=2021-04-19T16:20:41.620+03:00
REPORT_ID=b7e9a768-8b14-4185-a1a6-5508730e0d83

another one:

USER_COMMENT=closed on notify for deletion very fast
APP_VERSION_CODE=876
APP_VERSION_NAME=3.0.0-debug-Pratham2305-fix-issue-2815
ANDROID_VERSION=10
PHONE_MODEL=Redmi Note 8
STACK_TRACE=java.lang.IllegalStateException: The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged! Expected adapter item count: 50, found: 60 Pager id: fr.free.nrw.commons.beta:id/mediaDetailsPager Pager class: class androidx.viewpager.widget.ViewPager Problematic adapter: class fr.free.nrw.commons.media.MediaDetailPagerFragment$MediaDetailAdapter
	at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1143)
	at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1092)
	at androidx.viewpager.widget.ViewPager.onMeasure(ViewPager.java:1622)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at android.view.View.measure(View.java:25086)
	at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:735)
	at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:481)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at com.android.internal.policy.DecorView.onMeasure(DecorView.java:742)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:3083)
	at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1857)
	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2146)
	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1745)
	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7768)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:967)
	at android.view.Choreographer.doCallbacks(Choreographer.java:791)
	at android.view.Choreographer.doFrame(Choreographer.java:726)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:952)
	at android.os.Handler.handleCallback(Handler.java:883)
	at android.os.Handler.dispatchMessage(Handler.java:100)
	at android.os.Looper.loop(Looper.java:214)
	at android.app.ActivityThread.main(ActivityThread.java:7356)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940)

IS_SILENT=false
USER_EMAIL=
USER_CRASH_DATE=2021-04-19T16:16:18.396+03:00
REPORT_ID=5299f9b8-263b-4bc2-98e1-4a38bfdcc70f

another one:

USER_COMMENT=open a media detail very fast
APP_VERSION_CODE=876
APP_VERSION_NAME=3.0.0-debug-Pratham2305-fix-issue-2815
ANDROID_VERSION=10
PHONE_MODEL=Redmi Note 8
STACK_TRACE=java.lang.IllegalStateException: The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged! Expected adapter item count: 40, found: 50 Pager id: fr.free.nrw.commons.beta:id/mediaDetailsPager Pager class: class androidx.viewpager.widget.ViewPager Problematic adapter: class fr.free.nrw.commons.media.MediaDetailPagerFragment$MediaDetailAdapter
	at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1143)
	at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1092)
	at androidx.viewpager.widget.ViewPager.onMeasure(ViewPager.java:1622)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at android.view.View.measure(View.java:25086)
	at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:735)
	at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:481)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at com.android.internal.policy.DecorView.onMeasure(DecorView.java:742)
	at android.view.View.measure(View.java:25086)
	at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:3083)
	at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1857)
	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2146)
	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1745)
	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7768)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:967)
	at android.view.Choreographer.doCallbacks(Choreographer.java:791)
	at android.view.Choreographer.doFrame(Choreographer.java:726)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:952)
	at android.os.Handler.handleCallback(Handler.java:883)
	at android.os.Handler.dispatchMessage(Handler.java:100)
	at android.os.Looper.loop(Looper.java:214)
	at android.app.ActivityThread.main(ActivityThread.java:7356)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940)

IS_SILENT=false
USER_EMAIL=
USER_CRASH_DATE=2021-04-19T16:15:35.768+03:00
REPORT_ID=749bdebd-d747-41e7-938b-3f7d91c22d32

Copy link
Collaborator

@neslihanturan neslihanturan left a comment

Choose a reason for hiding this comment

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

I have reported crashes, tested on beta debug and fresh installs.

@Pratham2305
Copy link
Contributor Author

@neslihanturan Sorry but I am not able to reproduce any of these crashes. I think it can be again related to the number of contributions made, Have you also noticed these crashes on explore tab?

@Pratham2305
Copy link
Contributor Author

I am able to reproduce it now while testing on an account with lots of contributions, but I have also noticed this same crash on the latest master

Here the screen recording(prodDebug, latest Master):

screen_recorder_app_crash.mp4

I have made the changes that will fix the crashes, @neslihanturan can you please re-test this PR. Thanks!

@neslihanturan
Copy link
Collaborator

Hey @Pratham2305 , sorry for my delay to review. Can you please fix conflicts?

@codecov-commenter
Copy link

codecov-commenter commented May 10, 2021

Codecov Report

Merging #4295 (67c56ea) into master (2b62d84) will decrease coverage by 0.02%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #4295      +/-   ##
============================================
- Coverage     10.28%   10.26%   -0.03%     
- Complexity      476      482       +6     
============================================
  Files           342      343       +1     
  Lines         13149    13301     +152     
  Branches       1076     1092      +16     
============================================
+ Hits           1353     1365      +12     
- Misses        11728    11865     +137     
- Partials         68       71       +3     
Impacted Files Coverage Δ
...rw/commons/bookmarks/BookmarkListRootFragment.java 8.10% <0.00%> (-0.55%) ⬇️
.../nrw/commons/category/CategoryDetailsActivity.java 0.00% <0.00%> (ø)
...w/commons/contributions/ContributionsFragment.java 0.00% <0.00%> (ø)
...mmons/contributions/ContributionsListFragment.java 0.00% <0.00%> (ø)
...e/nrw/commons/explore/ExploreListRootFragment.java 0.00% <0.00%> (ø)
...va/fr/free/nrw/commons/explore/SearchActivity.java 0.00% <0.00%> (ø)
...xplore/depictions/WikidataItemDetailsActivity.java 0.00% <0.00%> (ø)
...nrw/commons/explore/media/PageableMediaFragment.kt 0.00% <0.00%> (ø)
...fr/free/nrw/commons/media/MediaDetailFragment.java 0.00% <0.00%> (ø)
...ee/nrw/commons/media/MediaDetailPagerFragment.java 0.00% <0.00%> (ø)
... and 17 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 2b62d84...67c56ea. Read the comment docs.

@Pratham2305
Copy link
Contributor Author

I have resolved the conflicts. @neslihanturan Can you please review the PR again. Thanks!

Copy link
Member

@nicolas-raoul nicolas-raoul left a comment

Choose a reason for hiding this comment

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

Browsing recent mobile uploads I found 3 pictures necessitating deletion nomination, and nominated then, pressing "Back" immediately 2 of these 3 times.
Everything worked as expected :-)
I noted a few things that might need improvement in the code.

@@ -339,6 +350,12 @@ public void onResume() {
media = getArguments().getParcelable("media");
}

media = detailProvider.getMediaAtPosition(index);

if(media != null && applicationKvStore.getBoolean("Nominating " + media.getDisplayTitle(), false)) {
Copy link
Member

Choose a reason for hiding this comment

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

The KV store is used to keep track of what files are being nominated, if I understand correctly?
How about a final static String rather than this inline String which seems to be duplicated several times below?
Also, does getDisplayTitle give the best identifier? We need something that does not change and is unique. I don't remember exactly but getDisplayTitle might return the same for several different images (screenshot showing pics I uploaded yesterday, same label displayed for two different pictures), and might also change if I change the locale?
adb

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review, I will make the required changes and I got your point. How about we use ImageUrl instead of display title, I think that will be unique for each image.

Copy link
Member

Choose a reason for hiding this comment

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

Yes good idea!

@@ -228,6 +231,8 @@ public static MediaDetailFragment forMedia(int index, boolean editable, boolean
*/
private int minimumHeightOfMetadata = 200;

final static String NOMINATING_MEDIA = "Nominating %s";
Copy link
Member

Choose a reason for hiding this comment

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

Would you mind making NOMINATING_FOR_DELETION_MEDIA = "Nominating for deletion %s"? It will be more understandable. Thanks!

@nicolas-raoul nicolas-raoul merged commit ca18763 into commons-app:master Jun 4, 2021
@nicolas-raoul
Copy link
Member

Thanks Pratham, great enhancement!

ashishkumar468 pushed a commit to ashishkumar468/apps-android-commons that referenced this pull request Jul 5, 2021
…ing the media details (commons-app#4295)

* fix issue with nominating for deletion

* Fix UI issue

* minor improvements

* fix App crash

* Added Javadoc and other minor improvements

* Updated string name

Co-authored-by: Pratham2305 <Pratham2305@users.noreply.github.com>
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.

Nominating for deletion is cancelled on leaving the media details
5 participants