-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat: add and remove conversation favorite [WPB-11639] #3653
Conversation
@Composable | ||
internal fun ConversationMainSheetContent( | ||
conversationSheetContent: ConversationSheetContent, | ||
// TODO(profile): enable when implemented | ||
// addConversationToFavourites: () -> Unit, | ||
changeFavoriteState: (dialogState: GroupDialogState, addToFavorite: Boolean) -> Unit, |
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.
suggestion: move the // TODO(profile): enable when implemented
line below this one so that it's right next to commented line // moveConversationToFolder: () -> Unit,
|
||
if (conversationSheetContent.canAddToFavourite() && !conversationSheetContent.isArchived) { | ||
conversationSheetContent.isFavorite?.let { isFavorite -> | ||
if (isFavorite) { |
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.
in fact there are only 2 differences in this if else
: title
of item and boolean parameter for changeFavoriteState
.
So it will save a lot of lines to have something like:
add {
MenuBottomSheetItem(
title = stringResource(if (isFavorite) R.string.label_remove_from_favourites else R.string.label_add_to_favourites),
leading = {
MenuItemIcon(
id = R.drawable.ic_favourite,
contentDescription = null,
)
},
onItemClick = {
changeFavoriteState(
GroupDialogState(
conversationSheetContent.conversationId,
conversationSheetContent.title
),
!isFavorite
)
}
)
}
leading = { | ||
MenuItemIcon( | ||
id = R.drawable.ic_favourite, | ||
contentDescription = stringResource(R.string.content_description_remove_from_favourites), |
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.
please, use contentDescription = null
if icon is not clickable and it's just duplicating title that goes after the icon.
Otherwise Talkback will have a bit broken behaviour ;P
Quality Gate passedIssues Measures |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #3653 +/- ##
===========================================
+ Coverage 46.04% 46.12% +0.07%
===========================================
Files 472 472
Lines 16108 16110 +2
Branches 2666 2666
===========================================
+ Hits 7417 7430 +13
+ Misses 7917 7906 -11
Partials 774 774
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
PR Submission Checklist for internal contributors
The PR Title
SQPIT-764
The PR Description
What's new in this PR?
add_to_favorites.mov