feat(ecualizador): include equalizer on/off toggle in export/import
The backup envelope carried favorites, EQ presets, alarms and the multi-device toggle but not EstadoEcualizador's own on/off flag, so restoring a backup on another device silently kept that device's existing toggle state instead of the source device's. Bumps the backup schema to v4 (additive over v3): the flag is only written when explicitly provided, so old exports stay at v2/v3. Importing an old backup without the field leaves the current toggle untouched rather than defaulting it. Applying the imported value reuses EstadoEcualizador.cambiarActivo so it persists and pushes to the live audio engine exactly like a manual toggle.
This commit is contained in:
@@ -695,12 +695,21 @@ class EstadoEcualizador extends ChangeNotifier {
|
||||
|
||||
/// Replaces the whole EQ configuration (backup import path): persists it,
|
||||
/// re-applies the preset effective for the current station and notifies.
|
||||
///
|
||||
/// [activo] is the imported on/off toggle (S4-R4/eq-export-toggle). When
|
||||
/// `null` — an old backup with no `ecualizadorActivo` field — the CURRENT
|
||||
/// toggle is left untouched: an absent flag must never flip the user's live
|
||||
/// setting to an arbitrary value. When non-null, applies it through
|
||||
/// [cambiarActivo], the same path a manual toggle uses, so the import
|
||||
/// persists it AND pushes it to the live audio engine instead of just
|
||||
/// updating [_activo] in memory.
|
||||
Future<void> importarConfiguracion({
|
||||
required PresetEcualizador principal,
|
||||
required Map<String, PresetEcualizador> porEmisora,
|
||||
Map<String, PresetEcualizador>? presetsDispositivo,
|
||||
Map<String, PresetEcualizador>? presetsMatriz,
|
||||
bool? eqMultiDeviceEnabled,
|
||||
bool? activo,
|
||||
}) async {
|
||||
_presetPrincipal = principal;
|
||||
_presetsEmisoraMap
|
||||
@@ -735,6 +744,11 @@ class EstadoEcualizador extends ChangeNotifier {
|
||||
final presetEfectivoActual =
|
||||
uuid == null ? _presetPrincipal : _resolverPresetActivo();
|
||||
await aplicarPresetActivo(presetEfectivoActual);
|
||||
|
||||
if (activo != null) {
|
||||
await cambiarActivo(activo);
|
||||
}
|
||||
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user