toggleSounds method

void toggleSounds()

Toggles the sound state for navigation instructions. Updates the soundsEnabled state and state accordingly.

Implementation

void toggleSounds() {
  final categories =
      navigationManager.soundNotificationSettings.enabledSoundCategories;

  if (soundsEnabled) {
    categories.remove(sdk.SoundCategory.instructions);
  } else {
    categories.add(sdk.SoundCategory.instructions);
  }

  navigationManager.soundNotificationSettings.enabledSoundCategories =
      categories;

  _model.value = _model.value.copyWith(
    soundsEnabled: _isSoundEnabled(),
  );
}