feat(tank-presets): hide individual built-in tank presets from the pickers - #2315
alpheios-one wants to merge 5 commits into
Conversation
…ckers Each built-in preset on the Tank Presets page gets a switch that hides it from every tank picker (tank editor, cylinder configurations, weight planner, transmitters, blender). The settings page keeps listing all of them, dimmed when hidden, so a preset can be shown again. - New per-diver setting hiddenTankPresetIds, stored as a JSON list in diver_settings.hidden_tank_preset_ids (schema v227, additive column with a beforeOpen backstop; the sync floor stays). - tankPresetsProvider filters hidden built-in presets; custom presets are never hidden, and the default preset always stays offered. - The default preset has no switch and cannot be hidden. Starring a hidden preset makes it the default and shows it again. - A tank, transmitter or weight-planner rig that already uses a hidden preset keeps showing it in its dropdown. - Import matching and default resolution still read the full catalog. Closes submersion-app#2305
- Weight planner: keep a hidden preset only in the dropdown of the tank that uses it, instead of offering it to every tank in the rig. - tankPresetsProvider selects the hidden set by content, so a reload that decodes an equal set does not re-run it. - setDefaultTankPreset only rewrites the hidden set when the new default was actually hidden. - A hidden preset's tile is dimmed rather than disabled, since its star and switch stay usable (and are announced as such). - Drop the unreachable null branch of the switch's onChanged. Refs submersion-app#2305
- setDefaultTankPreset also drops a stale hidden entry for the outgoing default, so a synced row that hid the default cannot make it vanish the moment the diver picks another default. - tankPresetsProvider selects the effectively hidden set (hidden minus the default) in one content-compared key, so starring a visible preset does not re-query the presets. - The tank editor and transmitter preset dropdowns keep their current value on reload instead of flashing a progress bar. - Test doubles guard the default preset like the real notifier. Refs submersion-app#2305
aae3ed3 to
0e3d95b
Compare
|
📦 Build artifacts for this PR · commit
Artifacts expire in 7 days. Downloading requires being signed in to GitHub. macOS needs two extractions: unzip the downloaded artifact, then unzip the Updated automatically on each push. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved same-slug preset identity issues and a weight-planner reload state issue affect expected behavior.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (2)
What changed in this PR
Adds per-diver hiding of built-in tank presets, including persistence, migration, picker filtering, settings UI, localization, and retained existing selections.
Changes:
- Adds
hidden_tank_preset_idswith schema migration v227. - Filters hidden built-ins across tank-related pickers while preserving current selections.
- Adds settings controls, translations, and comprehensive tests.
| File | Summary |
|---|---|
test/helpers/mock_providers.dart |
Updates settings test providers. |
test/features/tank_presets/presentation/providers/tank_preset_providers_test.dart |
Tests filtering and default behavior. |
test/features/tank_presets/presentation/pages/tank_presets_page_test.dart |
Tests visibility controls and defaults. |
test/features/tank_presets/domain/services/tank_preset_visibility_test.dart |
Tests visibility and retained selections. |
test/features/statistics/presentation/pages/records_page_test.dart |
Updates settings test setup. |
test/features/settings/presentation/providers/settings_notifier_real_test.dart |
Tests hidden-preset state changes. |
test/features/settings/presentation/pages/settings_page_test.dart |
Updates settings page tests. |
test/features/settings/presentation/pages/settings_page_shared_data_test.dart |
Updates shared settings test data. |
test/features/settings/data/repositories/diver_settings_repository_hidden_tank_presets_test.dart |
Tests persistence and malformed JSON handling. |
test/features/dive_log/presentation/widgets/tank_editor_test.dart |
Tests retaining hidden current presets. |
test/core/database/migration_v227_hidden_tank_presets_test.dart |
Tests migration v227. |
test/core/database/migration_v226_media_cloud_asset_id_test.dart |
Adjusts migration v226 expectations. |
lib/l10n/arb/app_zh.arb |
Adds Chinese translations. |
lib/l10n/arb/app_pt.arb |
Adds Portuguese translations. |
lib/l10n/arb/app_nl.arb |
Adds Dutch translations. |
lib/l10n/arb/app_localizations.dart |
Updates localization accessors. |
lib/l10n/arb/app_localizations_zh.dart |
Adds generated Chinese localization data. |
lib/l10n/arb/app_localizations_pt.dart |
Adds generated Portuguese localization data. |
lib/l10n/arb/app_localizations_nl.dart |
Adds generated Dutch localization data. |
lib/l10n/arb/app_localizations_it.dart |
Adds generated Italian localization data. |
lib/l10n/arb/app_localizations_hu.dart |
Adds generated Hungarian localization data. |
lib/l10n/arb/app_localizations_he.dart |
Adds generated Hebrew localization data. |
lib/l10n/arb/app_localizations_fr.dart |
Adds generated French localization data. |
lib/l10n/arb/app_localizations_es.dart |
Adds generated Spanish localization data. |
lib/l10n/arb/app_localizations_en.dart |
Adds generated English localization data. |
lib/l10n/arb/app_localizations_de.dart |
Adds generated German localization data. |
lib/l10n/arb/app_localizations_ar.dart |
Adds generated Arabic localization data. |
lib/l10n/arb/app_it.arb |
Adds Italian translations. |
lib/l10n/arb/app_hu.arb |
Adds Hungarian translations. |
lib/l10n/arb/app_he.arb |
Adds Hebrew translations. |
lib/l10n/arb/app_fr.arb |
Adds French translations. |
lib/l10n/arb/app_es.arb |
Adds Spanish translations. |
lib/l10n/arb/app_en.arb |
Adds English source strings. |
lib/l10n/arb/app_de.arb |
Adds German translations. |
lib/l10n/arb/app_ar.arb |
Adds Arabic translations. |
lib/features/weight_planner/presentation/widgets/rig_composer.dart |
Applies filtering; reloads can temporarily empty the list. |
lib/features/transmitters/presentation/pages/transmitter_edit_page.dart |
Retains hidden selected presets. |
lib/features/tank_presets/presentation/providers/tank_preset_providers.dart |
Filters picker results; same-slug custom/default identity needs distinction. |
lib/features/tank_presets/presentation/pages/tank_presets_page.dart |
Adds switches and dimmed rows; same-slug defaults can suppress a built-in switch. |
lib/features/tank_presets/domain/services/tank_preset_visibility.dart |
Implements filtering; name-only matching can lose hidden built-in selections. |
lib/features/settings/presentation/providers/settings_providers.dart |
Adds hidden-preset state; same-slug custom presets can be misidentified as built-in defaults. |
lib/features/settings/data/repositories/diver_settings_repository.dart |
Persists hidden preset IDs. |
lib/features/dive_log/presentation/widgets/tank_editor.dart |
Retains hidden selected presets. |
lib/core/database/database.dart |
Adds the v227 hidden-preset column and migration backstop. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
tankPresetsProvider watches the hidden-preset setting, so hiding or showing a preset reloads it through a dependency. valueOrNull drops the previous list during that reload, which briefly disabled Add tank and emptied the rig's tank dropdowns; value keeps it until the filtered list lands. Refs submersion-app#2305
|
@alpheios-one would you mind posting screenshots of the visual/UI changes (it makes reviewing much easier)? Thanks! |
|
@ericgriffin The screenshots are in the comment above. Thanks for the hint. I will think about how to present my changes better in the future so the review is more efficient, for example with screenshots directly in the PR description. |



Related Issue
Closes #2305
Summary
Divers can now hide built-in tank presets they never use. On Settings > Tank Presets each built-in preset gets a switch; a hidden preset no longer appears in any tank picker, but stays listed (dimmed) on the settings page so it can be shown again. The selection is stored per diver and syncs.
Changes
hiddenTankPresetIds, stored as a JSON list indiver_settings.hidden_tank_preset_ids. Schema v227 (225 is held by feat(import): keep the tissue loading the dive computer recorded (#1977) #1978, 226 is the media cloud asset id): additive nullable column with abeforeOpenbackstop; the sync compatibility floor stays at 224, since an older reader simply shows every built-in preset.tankPresetsProviderleaves hidden built-in presets out, so the tank editor, cylinder configurations, weight planner, transmitters and the blender cylinder menu all follow.tankPresetListNotifierProvider, which backs the settings page, stays unfiltered. The provider selects the effectively hidden set by content, so a settings reload or starring a visible preset does not re-query it.withKeptTankPresets), without offering it elsewhere. The tank editor and transmitter dropdowns no longer flash a progress bar when the list reloads.TankPresets.byName,matchBySpecs) and the default preset for imports still read the full catalog.How to Test
Test Plan
flutter analyzepasses