Skip to content

Commit 88d68d5

Browse files
authored
Fix: Bailout toggle sometimes shown on non-diluent cylinders (#184)
The bailout toggle was visible when editing any cylinder whose gas appeared in a dive segment, while it should only appear on dedicated diluent cylinders.
1 parent 0e7a6a2 commit 88d68d5

2 files changed

Lines changed: 1 addition & 6 deletions

File tree

composeApp/src/commonMain/kotlin/org/neotech/app/abysner/presentation/screens/planner/PlanScreen.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ fun PlannerScreen(
267267
configuration = uiState.configuration,
268268
diveMode = uiState.diveMode,
269269
cylinders = uiState.availableGas,
270-
segments = uiState.segments,
271270
unitSystem = uiState.settingsModel.unitSystem,
272271
onDismiss = { cylinderSheet = null },
273272
onAddCylinder = onAddCylinder,

composeApp/src/commonMain/kotlin/org/neotech/app/abysner/presentation/screens/planner/cylinders/CylinderPickerBottomSheet.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ import org.neotech.app.abysner.domain.core.model.Environment
5151
import org.neotech.app.abysner.domain.core.model.Gas
5252
import org.neotech.app.abysner.domain.core.model.UnitSystem
5353
import org.neotech.app.abysner.domain.core.physics.PSI_PER_BAR
54-
import org.neotech.app.abysner.domain.diveplanning.model.DiveProfileSection
5554
import org.neotech.app.abysner.domain.diveplanning.model.PlannedCylinderModel
5655
import org.neotech.app.abysner.presentation.utilities.ModalTarget
5756
import org.neotech.app.abysner.presentation.component.GasPickerComponent
@@ -73,7 +72,6 @@ internal fun CylinderPickerBottomSheetHost(
7372
configuration: Configuration,
7473
diveMode: DiveMode = DiveMode.OPEN_CIRCUIT,
7574
cylinders: List<PlannedCylinderModel> = emptyList(),
76-
segments: List<DiveProfileSection> = emptyList(),
7775
unitSystem: UnitSystem,
7876
onDismiss: () -> Unit,
7977
onAddCylinder: (Cylinder) -> Unit,
@@ -87,11 +85,9 @@ internal fun CylinderPickerBottomSheetHost(
8785
}
8886
val lockGas = plannedCylinder?.isCcrOxygen == true
8987

90-
val gasesInSegments = segments.mapTo(mutableSetOf()) { it.cylinder.gas }
9188
val showBailoutToggle = diveMode.isCcr
9289
&& plannedCylinder != null
93-
&& !plannedCylinder.isCcrOxygen
94-
&& plannedCylinder.cylinder.gas in gasesInSegments
90+
&& plannedCylinder.isCcrDiluent
9591

9692
CylinderPickerBottomSheet(
9793
sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true),

0 commit comments

Comments
 (0)