Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Improve duplicate handling #1668
I was very confused when using the IgnoreDuplicate Property of the SnackBar as it did the exact opposite of what i expected it to do. I think the wording "IgnoreDuplicate" implies that duplicates are in fact ignored and not that the IgnoreDuplicate property is ignored.
These changes aim to clarify what these properties actually do, along with a bit of simplification in the comparison logic.
I am aware that breaking the public API might not be the best idea, however I think this clarification is a good QoL change.
Renamed IgnoreDuplicate to ShowAlways. Added MessageExpired method. Added appropriate Equals method. Added autogenerated GetHashCode method. ShowAlways more closely represented what that property actually does. IgnoreDuplicate is not very telling in the context of a SnachkBarMessageQueueItem. MessageExpired serves as a helper to determine if a message already exceeded it's duration. Equals and HashCode simplify comparisons of SnackBarMessageQueueItems, especially useful in the determining if a message is a duplicate.
Changed IgnoreDuplicate to DiscardDuplicates This reflects the changes to the Snackbar. Negating the selection is not necessary anymore.
Keboo left a comment
Really nice work. Thank you for the contribution. Because this is a breaking API change, I am going to flag it for the 4.0.0 release.
Also +1 for the unit tests. This has been an area of confusion in the API that could certainly use some.