-
Notifications
You must be signed in to change notification settings - Fork 232
Make sure Snackbars are only displayed once #1175
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
Make sure Snackbars are only displayed once #1175
Conversation
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #1175 +/- ##
===========================================
- Coverage 56.87% 56.86% -0.01%
===========================================
Files 1039 1039
Lines 26812 26817 +5
Branches 5544 5549 +5
===========================================
+ Hits 15248 15250 +2
+ Misses 9168 9167 -1
- Partials 2396 2400 +4
☔ View full report in Codecov by Sentry. |
data class SnackbarMessage( | ||
/** The message to be displayed. */ |
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.
Shouldn't these lines go in the class's docstring?
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.
Yes, you're right.
fun clear() { | ||
if (snackBarMessageQueue.isNotEmpty()) { | ||
snackBarMessageQueue.removeFirstOrNull() | ||
if (queueMutex.isLocked) queueMutex.unlock() |
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.
I am wondering if it would be useful to add some unit test to cover this.
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.
True, it should be easier to test now.
Kudos, SonarCloud Quality Gate passed! |
Type of change
Content
SnackbarDispatcher.snackbarMessage
a Flow backed by a queue.SnackbarMessage.isDisplayed
property to check if the message is already being displayed.SnackbarDispatcher
queue too when the coroutine displaying the current message is cancelled.Motivation and context
Fixes #928.
Tests
In an unverified session:
An alternative test is to go to your home screen and then back to the app.
Tested devices
Checklist