Skip to content
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

Merged
merged 8 commits into from
Nov 25, 2024

Conversation

Garzas
Copy link
Contributor

@Garzas Garzas commented Nov 21, 2024

StoryWPB-11639 [Android] User Story for Add to favourites/Remove from favourites


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

  • implemented adding conversation to favorites folder
  • implemented removing conversation from favorite folder
  • extracted favorite add/remove management to smaller view model to not duplicate it in 3 places (OtherUserScreen, ConversationDetailsScreen, ConversationListScreen)
add_to_favorites.mov

@Garzas Garzas self-assigned this Nov 21, 2024
@echoes-hq echoes-hq bot added the echoes: product-roadmap Work aligned with the customer-announced roadmap, targeting a specific release date. label Nov 21, 2024
@Composable
internal fun ConversationMainSheetContent(
conversationSheetContent: ConversationSheetContent,
// TODO(profile): enable when implemented
// addConversationToFavourites: () -> Unit,
changeFavoriteState: (dialogState: GroupDialogState, addToFavorite: Boolean) -> Unit,
Copy link
Contributor

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) {
Copy link
Contributor

@borichellow borichellow Nov 25, 2024

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),
Copy link
Contributor

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

@Garzas Garzas enabled auto-merge November 25, 2024 15:09
@Garzas Garzas added this pull request to the merge queue Nov 25, 2024
@codecov-commenter
Copy link

codecov-commenter commented Nov 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 46.12%. Comparing base (c911271) to head (3d797f4).
Report is 1 commits behind head on develop.

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              
Files with missing lines Coverage Δ
...tlin/com/wire/android/mapper/ConversationMapper.kt 68.04% <100.00%> (+0.67%) ⬆️
...n/kotlin/com/wire/android/model/SnackBarMessage.kt 75.00% <100.00%> (+75.00%) ⬆️
...tions/details/GroupConversationDetailsViewModel.kt 67.21% <100.00%> (+0.54%) ⬆️
...roupConversationDetailsBottomSheetEventsHandler.kt 0.00% <ø> (ø)
...ome/conversationslist/ConversationListViewModel.kt 32.35% <ø> (+0.26%) ⬆️
...i/home/conversationslist/model/ConversationItem.kt 77.63% <100.00%> (+0.91%) ⬆️
...serprofile/other/OtherUserProfileEventsHandlers.kt 0.00% <ø> (ø)
...erprofile/other/OtherUserProfileScreenViewModel.kt 59.09% <100.00%> (+0.50%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c911271...3d797f4. Read the comment docs.

---- 🚨 Try these New Features:

Merged via the queue into develop with commit 955306a Nov 25, 2024
11 of 13 checks passed
@Garzas Garzas deleted the feat/favorite-folder-management branch November 25, 2024 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
echoes: product-roadmap Work aligned with the customer-announced roadmap, targeting a specific release date. size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants