Skip to content

Commit e817e67

Browse files
refactor: Clean code (#2151)
2 parents 087074c + 80c153e commit e817e67

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

app/src/main/java/com/infomaniak/mail/ui/main/thread/actions/MultiSelectBottomSheetDialog.kt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,38 +63,38 @@ class MultiSelectBottomSheetDialog : ActionsBottomSheetDialog() {
6363

6464
// This `.toSet()` is used to make an immutable local copy of `selectedThreads`.
6565
val threads = selectedThreads.toSet()
66-
val selectedThreadsUids = threads.map { it.uid }
67-
val selectedThreadsCount = selectedThreadsUids.count()
66+
val threadsUids = threads.map { it.uid }
67+
val threadsCount = threadsUids.count()
6868
val (shouldRead, shouldFavorite) = ThreadListMultiSelection.computeReadFavoriteStatus(threads)
6969

7070
setStateDependentUi(shouldRead, shouldFavorite)
7171

7272
binding.mainActions.setClosingOnClickListener(shouldCloseMultiSelection = true) { id: Int ->
7373
when (id) {
7474
R.id.actionMove -> {
75-
trackMultiSelectActionEvent(ACTION_MOVE_NAME, selectedThreadsCount, isFromBottomSheet = true)
75+
trackMultiSelectActionEvent(ACTION_MOVE_NAME, threadsCount, isFromBottomSheet = true)
7676
animatedNavigation(
7777
directions = ThreadListFragmentDirections.actionThreadListFragmentToMoveFragment(
78-
threadsUids = selectedThreadsUids.toTypedArray(),
78+
threadsUids = threadsUids.toTypedArray(),
7979
),
8080
currentClassName = currentClassName,
8181
)
8282
}
8383
R.id.actionReadUnread -> {
84-
trackMultiSelectActionEvent(ACTION_MARK_AS_SEEN_NAME, selectedThreadsCount, isFromBottomSheet = true)
85-
toggleThreadsSeenStatus(selectedThreadsUids, shouldRead)
84+
trackMultiSelectActionEvent(ACTION_MARK_AS_SEEN_NAME, threadsCount, isFromBottomSheet = true)
85+
toggleThreadsSeenStatus(threadsUids, shouldRead)
8686
}
8787
R.id.actionArchive -> {
88-
trackMultiSelectActionEvent(ACTION_ARCHIVE_NAME, selectedThreadsCount, isFromBottomSheet = true)
89-
archiveThreads(selectedThreadsUids)
88+
trackMultiSelectActionEvent(ACTION_ARCHIVE_NAME, threadsCount, isFromBottomSheet = true)
89+
archiveThreads(threadsUids)
9090
}
9191
R.id.actionDelete -> {
9292
descriptionDialog.deleteWithConfirmationPopup(
9393
folderRole = getActionFolderRole(threads.firstOrNull()),
94-
count = selectedThreadsCount,
94+
count = threadsCount,
9595
) {
96-
trackMultiSelectActionEvent(ACTION_DELETE_NAME, selectedThreadsCount, isFromBottomSheet = true)
97-
deleteThreads(selectedThreadsUids)
96+
trackMultiSelectActionEvent(ACTION_DELETE_NAME, threadsCount, isFromBottomSheet = true)
97+
deleteThreads(threadsUids)
9898
}
9999
}
100100
}
@@ -108,14 +108,14 @@ class MultiSelectBottomSheetDialog : ActionsBottomSheetDialog() {
108108
// }
109109

110110
binding.spam.setClosingOnClickListener(shouldCloseMultiSelection = true) {
111-
trackMultiSelectActionEvent(ACTION_SPAM_NAME, selectedThreadsCount, isFromBottomSheet = true)
112-
toggleThreadsSpamStatus(selectedThreadsUids)
111+
trackMultiSelectActionEvent(ACTION_SPAM_NAME, threadsCount, isFromBottomSheet = true)
112+
toggleThreadsSpamStatus(threadsUids)
113113
isMultiSelectOn = false
114114
}
115115

116116
binding.favorite.setClosingOnClickListener(shouldCloseMultiSelection = true) {
117-
trackMultiSelectActionEvent(ACTION_FAVORITE_NAME, selectedThreadsCount, isFromBottomSheet = true)
118-
toggleThreadsFavoriteStatus(selectedThreadsUids, shouldFavorite)
117+
trackMultiSelectActionEvent(ACTION_FAVORITE_NAME, threadsCount, isFromBottomSheet = true)
118+
toggleThreadsFavoriteStatus(threadsUids, shouldFavorite)
119119
isMultiSelectOn = false
120120
}
121121
}

0 commit comments

Comments
 (0)