Skip to content

Conversation

@arinmodi
Copy link
Contributor

Fixes #4906

What changes did you make and why?

Replaced notification with snackbar

Tests performed

Tested build variant on ASUS_X00TD with API level 28

Tested {build variant, e.g. ProdDebug} on {name of device or emulator} with API level {API level}.

@codecov
Copy link

codecov bot commented Mar 21, 2022

Codecov Report

Merging #4914 (cd4a951) into master (0d25c24) will decrease coverage by 0.01%.
The diff coverage is 44.44%.

❗ Current head cd4a951 differs from pull request most recent head cf2190b. Consider uploading reports for the commit cf2190b to get more accurate results

@@             Coverage Diff              @@
##             master    #4914      +/-   ##
============================================
- Coverage     51.42%   51.40%   -0.02%     
+ Complexity     2327     2324       -3     
============================================
  Files           345      345              
  Lines         16194    16196       +2     
  Branches       1430     1430              
============================================
- Hits           8327     8326       -1     
- Misses         7236     7237       +1     
- Partials        631      633       +2     
Impacted Files Coverage Δ
...a/fr/free/nrw/commons/review/ReviewController.java 89.77% <44.44%> (+10.70%) ⬆️
.../nrw/commons/category/CategoryContentProvider.java 12.50% <0.00%> (-14.29%) ⬇️
...w/commons/upload/categories/BaseDelegateAdapter.kt 35.29% <0.00%> (-11.77%) ⬇️
...va/fr/free/nrw/commons/category/CategoriesModel.kt 57.62% <0.00%> (-1.70%) ⬇️
...ns/upload/categories/UploadCategoriesFragment.java 86.95% <0.00%> (-1.45%) ⬇️

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 2bb2cbc...cf2190b. Read the comment docs.

@nicolas-raoul
Copy link
Member

I just tried, this is pretty annoying, I feel like I can't press buttons because the snackbar just appeared...

@neslihanturan any UI advice on showing to the user that the thank was sent, without obstructing the UI? screenshot

@4D17Y4
Copy link
Contributor

4D17Y4 commented Mar 22, 2022

I just tried, this is pretty annoying, I feel like I can't press buttons because the snackbar just appeared...

@neslihanturan any UI advice on showing to the user that the thank was sent, without obstructing the UI? screenshot

I think length short would work just fine. It won't solve the issue of ui here but would not obstruct the ui for long.
We can go with custom time if that feels too long.

@madhurgupta10
Copy link
Collaborator

madhurgupta10 commented Mar 24, 2022

IMO a toast would make better sense here than snackbar since it doesn't block the UI.

@arinmodi
Copy link
Contributor Author

@nicolas-raoul, what i have to implement snackbar with length_short or toast

According to me, toast will be better

But @nicolas-raoul, please update
Thanks

@misaochan
Copy link
Member

Another vote for toast here. :)

@nicolas-raoul
Copy link
Member

nicolas-raoul commented Mar 26, 2022

OK, let's go with a short toast :-)

@arinmodi
Copy link
Contributor Author

@nicolas-raoul, changes the snackbar to short lenght toast

Copy link
Contributor

@4D17Y4 4D17Y4 left a 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 otherwise.

import android.app.NotificationManager;
import android.content.Context;

import android.view.View;
Copy link
Contributor

Choose a reason for hiding this comment

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

These Imports are not needed anymore.


showNotification(title, message);

ViewUtil.showShortToast(context,message);
Copy link
Contributor

Choose a reason for hiding this comment

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

This statement was not covered in tests.
Add a test for this line ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@4D17Y4, how can i cover the code inside of the Observable.defer ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe it should be possible, can u look at the present instances in the codebase if there are any ?
I think we have similar code but not sure if they are covered by tests. Let me know in any case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@4D17Y4, Sorry but I tried to find on internet and in the codebase also but not able to figure it out

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@madhurgupta10, can you please help in this ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't have access to my computer for a few days, maybe you can look at some samples in the codebase or maybe @devarsh-mavani-19 or @Ayan-10 can help you if they faced similar issues before.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have access to my computer for a few days, maybe you can look at some samples in the codebase or maybe @devarsh-mavani-19 or @Ayan-10 can help you if they faced similar issues before.

I told him solution over call a few hours ago. As we were from same college previously and we are in touch with each other.

The way i handled it is by putting code of defer method in a separate function and writing tests for that function. i have implemented it previously in 1 of my PRs will update if i find it. Thanks

@arinmodi
Copy link
Contributor Author

@4D17Y4 , changes are done

Copy link
Contributor

@4D17Y4 4D17Y4 left a comment

Choose a reason for hiding this comment

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

Looks good otherwise, nice work.


showNotification(title, message);
@SuppressLint("StringFormatInvalid")
private void displayToast(final Context context, final boolean result){
Copy link
Contributor

Choose a reason for hiding this comment

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

displayToast is too generic. I would suggest displayThanksToast as this function is specific to the use case.
Also add some documentation to this function.

@arinmodi
Copy link
Contributor Author

arinmodi commented Apr 5, 2022

@4D17Y4, please review this and sorry for the delay i was working on another project.

@arinmodi
Copy link
Contributor Author

arinmodi commented Apr 5, 2022

@4D17Y4, I was trying to run a test but it gives me the invalid res directory name error.

@4D17Y4
Copy link
Contributor

4D17Y4 commented Apr 6, 2022

This could be related to #1059

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.

Looks correct to me, thanks @arinmodi :) Just waiting tests to be done to merge

@neslihanturan neslihanturan merged commit 1ae013d into commons-app:master Apr 25, 2022
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.

Peer review: "thank the contributor" should show snackbar instead of notification

7 participants