mirror of
https://github.com/bitwarden/android.git
synced 2025-02-18 04:50:01 +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))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val resources = LocalContext.current.resources
|
||||||
BitwardenMultiSelectButton(
|
BitwardenMultiSelectButton(
|
||||||
label = stringResource(id = R.string.file_format),
|
label = stringResource(id = R.string.file_format),
|
||||||
options = ExportVaultFormat.entries.map { it.displayLabel }.toImmutableList(),
|
options = ExportVaultFormat.entries.map { it.displayLabel() }.toImmutableList(),
|
||||||
selectedOption = state.exportFormat.displayLabel,
|
selectedOption = state.exportFormat.displayLabel(),
|
||||||
onOptionSelected = { selectedOptionLabel ->
|
onOptionSelected = { selectedOptionLabel ->
|
||||||
val selectedOption = ExportVaultFormat
|
val selectedOption = ExportVaultFormat
|
||||||
.entries
|
.entries
|
||||||
.first { it.displayLabel == selectedOptionLabel }
|
.first { it.displayLabel(resources) == selectedOptionLabel }
|
||||||
onExportFormatOptionSelected(selectedOption)
|
onExportFormatOptionSelected(selectedOption)
|
||||||
},
|
},
|
||||||
isEnabled = !state.policyPreventsExport,
|
isEnabled = !state.policyPreventsExport,
|
||||||
|
|
|
@ -1,15 +1,20 @@
|
||||||
package com.x8bit.bitwarden.ui.platform.util
|
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
|
import com.x8bit.bitwarden.ui.platform.feature.settings.exportvault.model.ExportVaultFormat
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a human-readable label for the export format.
|
* Provides a human-readable label for the export format.
|
||||||
*/
|
*/
|
||||||
val ExportVaultFormat.displayLabel: String
|
val ExportVaultFormat.displayLabel: Text
|
||||||
get() = when (this) {
|
get() = when (this) {
|
||||||
ExportVaultFormat.JSON -> ".json"
|
ExportVaultFormat.JSON -> R.string.json_extension.asText()
|
||||||
ExportVaultFormat.CSV -> ".csv"
|
ExportVaultFormat.CSV -> R.string.csv_extension.asText()
|
||||||
ExportVaultFormat.JSON_ENCRYPTED -> ".json (Encrypted)"
|
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"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name" translatable="false">Bitwarden Dev</string>
|
<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_title" translatable="false">Duo</string>
|
||||||
<string name="duo_org_title" translatable="false">Duo (%1$s)</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 -->
|
<!-- TODO BIT-2140: Update typeform strings -->
|
||||||
<string name="give_feedback" translatable="false">Give Feedback</string>
|
<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_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="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>
|
</resources>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.x8bit.bitwarden.ui.platform.util
|
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 com.x8bit.bitwarden.ui.platform.feature.settings.exportvault.model.ExportVaultFormat
|
||||||
import org.junit.jupiter.api.Assertions.assertEquals
|
import org.junit.jupiter.api.Assertions.assertEquals
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
@ -8,9 +10,11 @@ class ExportVaultFormatExtensionTest {
|
||||||
@Test
|
@Test
|
||||||
fun `displayLabel should return the correct value for each type`() {
|
fun `displayLabel should return the correct value for each type`() {
|
||||||
mapOf(
|
mapOf(
|
||||||
ExportVaultFormat.JSON to ".json",
|
ExportVaultFormat.JSON to R.string.json_extension.asText(),
|
||||||
ExportVaultFormat.CSV to ".csv",
|
ExportVaultFormat.CSV to R.string.csv_extension.asText(),
|
||||||
ExportVaultFormat.JSON_ENCRYPTED to ".json (Encrypted)",
|
ExportVaultFormat.JSON_ENCRYPTED to R.string.json_extension_formatted.asText(
|
||||||
|
R.string.password_protected.asText(),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.forEach { (type, label) ->
|
.forEach { (type, label) ->
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
|
Loading…
Add table
Reference in a new issue