mirror of
https://github.com/bitwarden/android.git
synced 2026-04-28 20:08:27 -05:00
BITAU-185 Show "Local codes" header on item list screen (#269)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user