From 10bd4210168b0cf1c4daa1984066c9477ab9ce08 Mon Sep 17 00:00:00 2001 From: ggurdin <46800240+ggurdin@users.noreply.github.com> Date: Tue, 25 Mar 2025 15:25:57 -0400 Subject: [PATCH] chore: don't reset instruction profile info on save learning settings, don't update toggle status if value has not changed (#2221) --- lib/pangea/instructions/instructions_enum.dart | 15 ++++++++++----- .../pages/settings_learning.dart | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/pangea/instructions/instructions_enum.dart b/lib/pangea/instructions/instructions_enum.dart index 9bc63da4a..a242d34d0 100644 --- a/lib/pangea/instructions/instructions_enum.dart +++ b/lib/pangea/instructions/instructions_enum.dart @@ -138,9 +138,14 @@ extension InstructionsEnumExtension on InstructionsEnum { MatrixState.pangeaController.userController.profile.instructionSettings .getStatus(this); - void setToggledOff(bool value) => - MatrixState.pangeaController.userController.updateProfile((profile) { - profile.instructionSettings.setStatus(this, value); - return profile; - }); + void setToggledOff(bool value) { + final userController = MatrixState.pangeaController.userController; + final instructionSettings = userController.profile.instructionSettings; + if (instructionSettings.getStatus(this) == value) return; + + userController.updateProfile((profile) { + profile.instructionSettings.setStatus(this, value); + return profile; + }); + } } diff --git a/lib/pangea/learning_settings/pages/settings_learning.dart b/lib/pangea/learning_settings/pages/settings_learning.dart index 8bd97840f..29c7deedd 100644 --- a/lib/pangea/learning_settings/pages/settings_learning.dart +++ b/lib/pangea/learning_settings/pages/settings_learning.dart @@ -124,6 +124,7 @@ class SettingsLearningController extends State { } Future resetInstructionTooltips() async { + _profile.instructionSettings = InstructionSettings(); await showFutureLoadingDialog( context: context, future: () async => pangeaController.userController.updateProfile(