[PM-39978] Fix compilation errors caused by Item type Send support in… - #7224
[PM-39978] Fix compilation errors caused by Item type Send support in…#7224mcamirault wants to merge 1 commit into
Conversation
🤖 Bitwarden Claude Code ReviewOverall Assessment: REQUEST CHANGES This PR restores compilation after the SDK added Code Review Details
Also noted, no action strictly required: an |
| enum class SendItemType { | ||
| FILE, | ||
| TEXT, | ||
| ITEM, |
There was a problem hiding this comment.
❌ CRITICAL: Adding ITEM here exposes an unimplemented "Item" option in the user-facing new-Send dialog.
Details and fix
SendScreen.kt:257 builds the SelectSendAddType dialog rows from SendItemType.entries:
SendItemType.entries.forEach {
BitwardenBasicDialogRow(text = it.selectionText(), onClick = { onAddSendSelected(it) })
}With ITEM added (and selectionText → BitwardenString.item = "Item"), every user now sees a third "Item" row. The path from there is fully reachable and broken:
SendViewModel.handleAddSendSelectedonly special-casesFILE, soITEMnavigates straight to Add Send.AddEditSendViewModelbuildsSendType.Item(data = ""), andAddEditSendContent.kt:138renders an empty branch → the form shows name/options/Save but no content field.- Tapping Save reaches
SendManagerImpland fails with the hardcoded English "Item Sends are not yet available".
Since this PR is only meant to restore compilation against the new SDK enum, keep ITEM out of the selectable set until the feature exists — e.g. filter the dialog source (SendItemType.entries.filter { it != SendItemType.ITEM }) or gate it behind a feature flag, and mirror that in VaultItemListingViewModel.kt:916.
| SendType.ITEM -> Result.success( | ||
| CreateSendJsonResponse.Invalid( | ||
| message = "Item Sends are not yet available", | ||
| validationErrors = null | ||
| ) | ||
| ) |
There was a problem hiding this comment.
Details and fix
InvalidJsonResponse.firstValidationErrorMessage falls back to message when validationErrors is null, so this string flows into CreateSendResult.Error(message = ...) and then into AddEditSendViewModel (line 264), which displays result.message verbatim. Users in any locale would see untranslated text.
Prefer failing with an exception so the existing localized generic error is shown:
SendType.ITEM -> IllegalStateException("Item Sends are not supported").asFailure()That yields CreateSendResult.Error(message = null, error = ...) → generic_error_message, and keeps the developer-facing detail in the throwable instead of the UI.
… the SDK
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-39978
📔 Objective
Tools is adding a new type of Send to support temporary item sharing. The logic hasn't been added to the SDK yet but the new SendType enum has, and this causes compilation errors which are fixed by this PR.
📸 Screenshots
None