From 55b8a0fa47cc00e32e7c4db96e1a4f5c113a5840 Mon Sep 17 00:00:00 2001 From: Cris Barreiro Date: Thu, 7 Nov 2024 17:45:25 +0100 Subject: [PATCH] Remove debug/test logs --- .../brokensite/impl/BrokenSitePromptInMemoryStore.kt | 2 -- .../duckduckgo/brokensite/impl/RealBrokenSitePrompt.kt | 8 -------- .../brokensite/impl/RealBrokenSitePromptTest.kt | 6 +++++- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/broken-site/broken-site-impl/src/main/java/com/duckduckgo/brokensite/impl/BrokenSitePromptInMemoryStore.kt b/broken-site/broken-site-impl/src/main/java/com/duckduckgo/brokensite/impl/BrokenSitePromptInMemoryStore.kt index ab677998dd14..6ab6bea14240 100644 --- a/broken-site/broken-site-impl/src/main/java/com/duckduckgo/brokensite/impl/BrokenSitePromptInMemoryStore.kt +++ b/broken-site/broken-site-impl/src/main/java/com/duckduckgo/brokensite/impl/BrokenSitePromptInMemoryStore.kt @@ -22,7 +22,6 @@ import com.squareup.anvil.annotations.ContributesBinding import dagger.SingleInstanceIn import java.time.LocalDateTime import javax.inject.Inject -import timber.log.Timber interface BrokenSitePromptInMemoryStore { fun resetRefreshCount() @@ -62,7 +61,6 @@ class RealBrokenSitePromptInMemoryStore @Inject constructor() : BrokenSitePrompt return refreshes?.let { val time = it.time.filter { time -> time.isAfter(t1) && time.isBefore(t2) } refreshes = it.copy(time = time) - Timber.d("Cris. $refreshes") time.size } ?: 0 } diff --git a/broken-site/broken-site-impl/src/main/java/com/duckduckgo/brokensite/impl/RealBrokenSitePrompt.kt b/broken-site/broken-site-impl/src/main/java/com/duckduckgo/brokensite/impl/RealBrokenSitePrompt.kt index a6e2e824ccd1..fa2e2c1040e1 100644 --- a/broken-site/broken-site-impl/src/main/java/com/duckduckgo/brokensite/impl/RealBrokenSitePrompt.kt +++ b/broken-site/broken-site-impl/src/main/java/com/duckduckgo/brokensite/impl/RealBrokenSitePrompt.kt @@ -24,7 +24,6 @@ import com.duckduckgo.common.utils.CurrentTimeProvider import com.duckduckgo.di.scopes.AppScope import com.squareup.anvil.annotations.ContributesBinding import javax.inject.Inject -import timber.log.Timber @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) internal const val REFRESH_COUNT_WINDOW = 20L @@ -44,7 +43,6 @@ class RealBrokenSitePrompt @Inject constructor( override suspend fun userDismissedPrompt() { if (!_featureEnabled) return - Timber.d("Cris. Dismiss streak: ${brokenSiteReportRepository.getDismissStreak()}") if (brokenSiteReportRepository.getDismissStreak() >= brokenSiteReportRepository.getMaxDismissStreak() - 1) { brokenSiteReportRepository.resetDismissStreak() val nextShownDate = brokenSiteReportRepository.getNextShownDate() @@ -52,9 +50,6 @@ class RealBrokenSitePrompt @Inject constructor( if (nextShownDate == null || newNextShownDate.isAfter(nextShownDate)) { brokenSiteReportRepository.setNextShownDate(newNextShownDate) - Timber.d("Cris. Dismiss. New next shown date: $newNextShownDate") - } else { - Timber.d("Cris. Dismiss. Next shown date not updated to $newNextShownDate, keeping existing value: $nextShownDate") } } else { brokenSiteReportRepository.incrementDismissStreak() @@ -104,9 +99,6 @@ class RealBrokenSitePrompt @Inject constructor( val newNextShownDate = currentTimeProvider.localDateTimeNow().plusDays(brokenSiteReportRepository.getCoolDownDays()) if (nextShownDate == null || newNextShownDate.isAfter(nextShownDate)) { brokenSiteReportRepository.setNextShownDate(newNextShownDate) - Timber.d("Cris. Shown. New next shown date: $newNextShownDate") - } else { - Timber.d("Cris. Shown. Next shown date not updated to $newNextShownDate, keeping existing value: $nextShownDate") } } } diff --git a/broken-site/broken-site-impl/src/test/java/com/duckduckgo/brokensite/impl/RealBrokenSitePromptTest.kt b/broken-site/broken-site-impl/src/test/java/com/duckduckgo/brokensite/impl/RealBrokenSitePromptTest.kt index 56894e3cdbf5..96388231ff5c 100644 --- a/broken-site/broken-site-impl/src/test/java/com/duckduckgo/brokensite/impl/RealBrokenSitePromptTest.kt +++ b/broken-site/broken-site-impl/src/test/java/com/duckduckgo/brokensite/impl/RealBrokenSitePromptTest.kt @@ -45,6 +45,8 @@ class RealBrokenSitePromptTest { @Test fun whenUserDismissedPromptAndNoNextShownDateThenIncrementDismissStreakAndDoNotUpdateNextShownDate() = runTest { whenever(mockBrokenSiteReportRepository.getNextShownDate()).thenReturn(null) + whenever(mockBrokenSiteReportRepository.getMaxDismissStreak()).thenReturn(3) + whenever(mockBrokenSiteReportRepository.getDismissStreak()).thenReturn(0) testee.userDismissedPrompt() @@ -69,10 +71,12 @@ class RealBrokenSitePromptTest { } @Test - fun whenUserDismissedPromptMaxDismissStreakTimesAndNextShownDateLaterThanCooldownDaysThenResetDismissStreakAndDoNotUpdateNextShownDate() = + fun whenUserDismissedPromptMaxDismissStreakTimesAndNextShownDateLaterThanDismissStreakDaysThenResetDismissStreakAndDoNotUpdateNextShownDate() = runTest { whenever(mockBrokenSiteReportRepository.getNextShownDate()).thenReturn(LocalDateTime.now().plusDays(11)) whenever(mockBrokenSiteReportRepository.getDismissStreak()).thenReturn(2) + whenever(mockBrokenSiteReportRepository.getMaxDismissStreak()).thenReturn(3) + whenever(mockBrokenSiteReportRepository.getDismissStreakResetDays()).thenReturn(2) whenever(mockCurrentTimeProvider.localDateTimeNow()).thenReturn(LocalDateTime.now()) testee.userDismissedPrompt()