mirror of
https://github.com/ProtonMail/android-mail.git
synced 2026-06-14 09:54:47 +00:00
Do not display the FloatingBottomBar on empty actions
ET-6283
This commit is contained in:
+5
-4
@@ -28,10 +28,11 @@ class BottomBarReducer @Inject constructor() {
|
||||
fun newStateFrom(currentState: BottomBarState, event: BottomBarEvent): BottomBarState {
|
||||
return when (event) {
|
||||
is BottomBarEvent.ActionsData -> currentState.toNewStateForActionData(event)
|
||||
is BottomBarEvent.ShowAndUpdateActionsData -> BottomBarState.Data.Shown(
|
||||
event.target,
|
||||
event.actionUiModels
|
||||
)
|
||||
is BottomBarEvent.ShowAndUpdateActionsData -> if (event.actionUiModels.isEmpty()) {
|
||||
BottomBarState.Data.Hidden(event.target, event.actionUiModels)
|
||||
} else {
|
||||
BottomBarState.Data.Shown(event.target, event.actionUiModels)
|
||||
}
|
||||
|
||||
is BottomBarEvent.HideBottomSheet -> currentState.toNewStateForHiding()
|
||||
is BottomBarEvent.ShowBottomSheet -> currentState.toNewStateForShowing()
|
||||
|
||||
+7
@@ -19,6 +19,7 @@
|
||||
package ch.protonmail.android.mailcommon.presentation.reducer
|
||||
|
||||
import arrow.core.nonEmptyListOf
|
||||
import ch.protonmail.android.mailcommon.presentation.model.ActionUiModel
|
||||
import ch.protonmail.android.mailcommon.presentation.model.BottomBarEvent
|
||||
import ch.protonmail.android.mailcommon.presentation.model.BottomBarState
|
||||
import ch.protonmail.android.mailcommon.presentation.model.BottomBarTarget
|
||||
@@ -48,6 +49,7 @@ internal class BottomBarReducerTest(
|
||||
|
||||
private val actions = nonEmptyListOf(ActionUiModelTestData.markUnread).toImmutableList()
|
||||
private val updatedActions = listOf(ActionUiModelTestData.archive).toImmutableList()
|
||||
private val emptyActions = emptyList<ActionUiModel>().toImmutableList()
|
||||
private val mailboxTarget = BottomBarTarget.Mailbox
|
||||
private val convoTarget = BottomBarTarget.Conversation
|
||||
private val messageTarget = BottomBarTarget.Message(id = "messageId")
|
||||
@@ -73,6 +75,11 @@ internal class BottomBarReducerTest(
|
||||
currentState = BottomBarState.Loading,
|
||||
operation = BottomBarEvent.Offline,
|
||||
expectedState = BottomBarState.Offline
|
||||
),
|
||||
TestInput(
|
||||
currentState = BottomBarState.Loading,
|
||||
operation = BottomBarEvent.ShowAndUpdateActionsData(convoTarget, emptyActions),
|
||||
expectedState = BottomBarState.Data.Hidden(convoTarget, emptyActions)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user