BITAU-185 Show "Local codes" header on item list screen (#269)

This commit is contained in:
Andrew Haisting
2024-11-08 15:30:10 -06:00
committed by GitHub
parent 0643ecc00b
commit 5184be0e98
3 changed files with 29 additions and 1 deletions

View File

@@ -487,6 +487,17 @@ private fun ItemListingContent(
}
}
if (state.shouldShowLocalHeader) {
item {
BitwardenListHeaderText(
label = stringResource(id = R.string.local_codes),
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp),
)
}
}
items(state.itemList) {
VaultVerificationCodeItem(
authCode = it.authCode,

View File

@@ -693,7 +693,21 @@ data class ItemListingState(
val favoriteItems: List<VerificationCodeDisplayItem>,
val itemList: List<VerificationCodeDisplayItem>,
val sharedItems: SharedCodesDisplayState,
) : ViewState()
) : ViewState() {
/**
* Whether or not there should be a "Local codes" header shown above local codes.
*/
val shouldShowLocalHeader
get() =
// Only show header if there are shared items
!sharedItems.isEmpty() &&
// And also local items
itemList.isNotEmpty() &&
// But there are no favorite items
// (If there are favorite items, the favorites header will take care of us)
favoriteItems.isEmpty()
}
}
/**

View File

@@ -143,4 +143,7 @@
<string name="choose_save_location_message">Save this authenticator key here, or add it to a login in your Bitwarden app.</string>
<string name="save_option_as_default">Save option as default</string>
<string name="account_synced_from_bitwarden_app">Account synced from Bitwarden app</string>
<string name="add_code_to_bitwarden">Add code to Bitwarden</string>
<string name="add_code_locally">Add code locally</string>
<string name="local_codes">Local codes</string>
</resources>