PM-19780: Fix incorrect sub header on authenticator search screen (#5488)

This commit is contained in:
David Perez 2025-07-07 10:57:25 -05:00 committed by GitHub
parent 7db8f040e4
commit fd9bdfa228
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 24 deletions

View File

@ -33,7 +33,7 @@ fun ItemSearchContent(
if (viewState.hasLocalAndSharedItems) {
item {
BitwardenListHeaderText(
label = stringResource(id = R.string.local_codes),
label = viewState.localListHeader(),
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp),

View File

@ -1,7 +1,6 @@
package com.bitwarden.authenticator.ui.authenticator.feature.search
import android.widget.Toast
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.ExperimentalMaterial3Api
@ -75,29 +74,24 @@ fun ItemSearchScreen(
)
},
) { innerPadding ->
Column(
modifier = Modifier
.fillMaxSize()
.padding(innerPadding),
) {
val innerModifier = Modifier
.fillMaxSize()
when (val viewState = state.viewState) {
is ItemSearchState.ViewState.Content -> {
ItemSearchContent(
viewState = viewState,
searchHandlers = searchHandlers,
modifier = Modifier
.fillMaxSize()
.padding(paddingValues = innerPadding),
)
}
when (val viewState = state.viewState) {
is ItemSearchState.ViewState.Content -> {
ItemSearchContent(
viewState = viewState,
searchHandlers = searchHandlers,
modifier = innerModifier,
)
}
is ItemSearchState.ViewState.Empty -> {
ItemSearchEmptyContent(
viewState = viewState,
modifier = innerModifier,
)
}
is ItemSearchState.ViewState.Empty -> {
ItemSearchEmptyContent(
viewState = viewState,
modifier = Modifier
.fillMaxSize()
.padding(paddingValues = innerPadding),
)
}
}
}

View File

@ -221,6 +221,11 @@ data class ItemSearchState(
val itemList: List<VerificationCodeDisplayItem>,
val sharedItems: SharedCodesDisplayState,
) : ViewState() {
/**
* The header to display for the local codes.
*/
val localListHeader: Text get() = R.string.local_codes.asText(itemList.size)
/**
* Whether or not there should be a "Local codes" header shown above local codes.
*/