From 2342c9685e96858ecf98936c01811b5dd96896ec Mon Sep 17 00:00:00 2001 From: mtgriego Date: Thu, 20 Jun 2024 11:06:05 -0700 Subject: [PATCH] [MBL-1541] Update viewmodel to always update if the play button is visible on project videos (#2060) * update viewmodel to always update if the play button is visible * fix tests --- .../viewmodels/projectpage/ProjectPageViewModel.kt | 1 - .../com/kickstarter/viewmodels/ProjectPageViewModelTest.kt | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/kickstarter/viewmodels/projectpage/ProjectPageViewModel.kt b/app/src/main/java/com/kickstarter/viewmodels/projectpage/ProjectPageViewModel.kt index 9f09eb70a4..b7d4185ce9 100644 --- a/app/src/main/java/com/kickstarter/viewmodels/projectpage/ProjectPageViewModel.kt +++ b/app/src/main/java/com/kickstarter/viewmodels/projectpage/ProjectPageViewModel.kt @@ -963,7 +963,6 @@ interface ProjectPageViewModel { .map { it.hasVideo() } - .distinctUntilChanged() .subscribe { this.playButtonIsVisible.onNext(it) } .addToDisposable(disposables) diff --git a/app/src/test/java/com/kickstarter/viewmodels/ProjectPageViewModelTest.kt b/app/src/test/java/com/kickstarter/viewmodels/ProjectPageViewModelTest.kt index 3e28c24413..63c0d3acb4 100644 --- a/app/src/test/java/com/kickstarter/viewmodels/ProjectPageViewModelTest.kt +++ b/app/src/test/java/com/kickstarter/viewmodels/ProjectPageViewModelTest.kt @@ -365,7 +365,7 @@ class ProjectPageViewModelTest : KSRobolectricTestCase() { this.vm.configureWith(Intent().putExtra(IntentKey.PROJECT, project)) - playButtonIsVisible.assertValues(false) + playButtonIsVisible.assertValues(false, false) } @Test @@ -385,7 +385,7 @@ class ProjectPageViewModelTest : KSRobolectricTestCase() { this.vm.configureWith(Intent().putExtra(IntentKey.PROJECT, project)) - playButtonIsVisible.assertValues(true) + playButtonIsVisible.assertValues(true, true) } @Test