mirror of
https://github.com/bitwarden/android.git
synced 2024-11-25 19:06:05 +03:00
BIT-2159: Update .json (Encrypted) text to .json (Password Protected) (#1182)
This commit is contained in:
parent
0a65b37a65
commit
8f94d48297
4 changed files with 24 additions and 10 deletions
|
@ -206,14 +206,15 @@ private fun ExportVaultScreenContent(
|
|||
Spacer(modifier = Modifier.height(16.dp))
|
||||
}
|
||||
|
||||
val resources = LocalContext.current.resources
|
||||
BitwardenMultiSelectButton(
|
||||
label = stringResource(id = R.string.file_format),
|
||||
options = ExportVaultFormat.entries.map { it.displayLabel }.toImmutableList(),
|
||||
selectedOption = state.exportFormat.displayLabel,
|
||||
options = ExportVaultFormat.entries.map { it.displayLabel() }.toImmutableList(),
|
||||
selectedOption = state.exportFormat.displayLabel(),
|
||||
onOptionSelected = { selectedOptionLabel ->
|
||||
val selectedOption = ExportVaultFormat
|
||||
.entries
|
||||
.first { it.displayLabel == selectedOptionLabel }
|
||||
.first { it.displayLabel(resources) == selectedOptionLabel }
|
||||
onExportFormatOptionSelected(selectedOption)
|
||||
},
|
||||
isEnabled = !state.policyPreventsExport,
|
||||
|
|
|
@ -1,15 +1,20 @@
|
|||
package com.x8bit.bitwarden.ui.platform.util
|
||||
|
||||
import com.x8bit.bitwarden.R
|
||||
import com.x8bit.bitwarden.ui.platform.base.util.Text
|
||||
import com.x8bit.bitwarden.ui.platform.base.util.asText
|
||||
import com.x8bit.bitwarden.ui.platform.feature.settings.exportvault.model.ExportVaultFormat
|
||||
|
||||
/**
|
||||
* Provides a human-readable label for the export format.
|
||||
*/
|
||||
val ExportVaultFormat.displayLabel: String
|
||||
val ExportVaultFormat.displayLabel: Text
|
||||
get() = when (this) {
|
||||
ExportVaultFormat.JSON -> ".json"
|
||||
ExportVaultFormat.CSV -> ".csv"
|
||||
ExportVaultFormat.JSON_ENCRYPTED -> ".json (Encrypted)"
|
||||
ExportVaultFormat.JSON -> R.string.json_extension.asText()
|
||||
ExportVaultFormat.CSV -> R.string.csv_extension.asText()
|
||||
ExportVaultFormat.JSON_ENCRYPTED -> R.string.json_extension_formatted.asText(
|
||||
R.string.password_protected.asText(),
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name" translatable="false">Bitwarden Dev</string>
|
||||
<string name="csv_extension" translatable="false">.csv</string>
|
||||
<string name="duo_title" translatable="false">Duo</string>
|
||||
<string name="duo_org_title" translatable="false">Duo (%1$s)</string>
|
||||
<string name="json_extension" translatable="false">.json</string>
|
||||
<string name="json_extension_formatted" translatable="false">.json (%1$s)</string>
|
||||
<!-- TODO BIT-2140: Update typeform strings -->
|
||||
<string name="give_feedback" translatable="false">Give Feedback</string>
|
||||
<string name="continue_to_give_feedback" translatable="false">Continue to Give Feedback?</string>
|
||||
<string name="continue_to_provide_feedback" translatable="false">Select continue to provide feedback on your experience in a web form.</string>
|
||||
<string name="password_protected" translatable="false">Password Protected</string>
|
||||
</resources>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.x8bit.bitwarden.ui.platform.util
|
||||
|
||||
import com.x8bit.bitwarden.R
|
||||
import com.x8bit.bitwarden.ui.platform.base.util.asText
|
||||
import com.x8bit.bitwarden.ui.platform.feature.settings.exportvault.model.ExportVaultFormat
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Test
|
||||
|
@ -8,9 +10,11 @@ class ExportVaultFormatExtensionTest {
|
|||
@Test
|
||||
fun `displayLabel should return the correct value for each type`() {
|
||||
mapOf(
|
||||
ExportVaultFormat.JSON to ".json",
|
||||
ExportVaultFormat.CSV to ".csv",
|
||||
ExportVaultFormat.JSON_ENCRYPTED to ".json (Encrypted)",
|
||||
ExportVaultFormat.JSON to R.string.json_extension.asText(),
|
||||
ExportVaultFormat.CSV to R.string.csv_extension.asText(),
|
||||
ExportVaultFormat.JSON_ENCRYPTED to R.string.json_extension_formatted.asText(
|
||||
R.string.password_protected.asText(),
|
||||
),
|
||||
)
|
||||
.forEach { (type, label) ->
|
||||
assertEquals(
|
||||
|
|
Loading…
Reference in a new issue