Skip to content

Include author name in thanks message and replace Toast with Snackbar - #6840

Open
Kota-Jagadeesh wants to merge 17 commits into
commons-app:mainfrom
Kota-Jagadeesh:feature/thanks-toast-author-name
Open

Include author name in thanks message and replace Toast with Snackbar#6840
Kota-Jagadeesh wants to merge 17 commits into
commons-app:mainfrom
Kota-Jagadeesh:feature/thanks-toast-author-name

Conversation

@Kota-Jagadeesh

Copy link
Copy Markdown
Collaborator

Description (required)

Follow-up to #5211

updated the thanks toast message shown during review to include the author’s name along with the filename. Previously, the toast was only displayed the filename, which did not clearly indicate who was being thanked.

and as per the discussions in the PR #5211, replaced the toast with snackbar to properly handle longer filenames and usernames, since toast is limited to two lines on newer versions and truncates text

What changes did you make and why?

  • updated ReviewController to include author name (firstRevision.user()) in all thanks-related messages.
  • replaced Toast with Snackbar for better ux and to avoid text truncation.
  • modified string resources to support two parameters (filename and author name)

Tests performed (required)

Tested ProdDebug on Redmi Note 13 Pro API level 36.

Screenshots (for UI changes only)

Snackbar now displays:
"Sending thanks for "filename" to "author"
image

image

Comment thread app/src/main/java/fr/free/nrw/commons/review/ReviewController.kt Outdated
Comment thread app/src/main/java/fr/free/nrw/commons/review/ReviewController.kt Outdated
@Kota-Jagadeesh

Copy link
Copy Markdown
Collaborator Author

@neeldoshii updated the changes to keep the diff minimal by using context and existing ViewUtil methods.
and also updated tests to handle the additional author name parameter in the messages, please review it 🙂

Comment thread app/src/main/java/fr/free/nrw/commons/review/ReviewController.kt Outdated
Comment thread app/src/main/java/fr/free/nrw/commons/review/ReviewController.kt Outdated
Comment thread app/src/main/java/fr/free/nrw/commons/review/ReviewController.kt Outdated
@Kota-Jagadeesh

Copy link
Copy Markdown
Collaborator Author

@neeldoshii Made the required changes, and tsted them, the changes worked well

@Kota-Jagadeesh

Copy link
Copy Markdown
Collaborator Author

@neeldoshii, did you get time to review the changes above? LMK if any changes are needed 🙂

@github-actions

Copy link
Copy Markdown

✅ Generated APK variants!

@chrisdebian chrisdebian left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The message content change (adding the author's name, with a sensible fallback string when there's no author) looks correct and is well tested.

One thing worth flagging: the description says this replaces Toast with Snackbar specifically to avoid truncation on longer filename+username combinations, but the diff still calls `ViewUtil.showShortToast()` everywhere, which wraps `Toast.makeText(...)` (checked directly) — no Snackbar anywhere in this PR, and the tests still assert against `ShadowToast`. So as written, this makes the truncation risk the PR describes worse rather than better, since the message is now longer (filename + author) but still going through the same 2-line-limited Toast.

Was the Snackbar swap perhaps meant for a follow-up PR, or did it get dropped somewhere along the way? Happy to take another look once that's clarified.

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