From 4708597ffa926d860519458f029f38ef64f8c8ca Mon Sep 17 00:00:00 2001 From: Renan Lukas <14964993+RenanLukas@users.noreply.github.com> Date: Thu, 2 Jun 2022 14:13:51 -0300 Subject: [PATCH] Fix PR comment: tracking inverted prompt switch state --- .../ui/bloggingreminders/BloggingRemindersViewModel.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/bloggingreminders/BloggingRemindersViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/bloggingreminders/BloggingRemindersViewModel.kt index be6ef4486c17..1847ae4aff85 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/bloggingreminders/BloggingRemindersViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/bloggingreminders/BloggingRemindersViewModel.kt @@ -158,8 +158,9 @@ class BloggingRemindersViewModel @Inject constructor( private fun togglePromptSwitch() { _bloggingRemindersModel.value?.let { currentState -> - analyticsTracker.trackRemindersIncludePromptPressed(currentState.isPromptIncluded) - _bloggingRemindersModel.value = currentState.copy(isPromptIncluded = !currentState.isPromptIncluded) + val newState = !currentState.isPromptIncluded + analyticsTracker.trackRemindersIncludePromptPressed(newState) + _bloggingRemindersModel.value = currentState.copy(isPromptIncluded = newState) } }