From 46d0dbb96c97bc845074a9bcf6c017dbdc9fdf22 Mon Sep 17 00:00:00 2001 From: Cris Barreiro Date: Wed, 6 Nov 2024 10:27:41 +0100 Subject: [PATCH] Make isFeatureEnabled a suspend function --- app/src/main/java/com/duckduckgo/app/cta/ui/CtaViewModel.kt | 2 +- .../main/java/com/duckduckgo/brokensite/api/BrokenSitePrompt.kt | 2 +- .../java/com/duckduckgo/brokensite/impl/RealBrokenSitePrompt.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/duckduckgo/app/cta/ui/CtaViewModel.kt b/app/src/main/java/com/duckduckgo/app/cta/ui/CtaViewModel.kt index fe7e36f0e33a..513fd85ad1c1 100644 --- a/app/src/main/java/com/duckduckgo/app/cta/ui/CtaViewModel.kt +++ b/app/src/main/java/com/duckduckgo/app/cta/ui/CtaViewModel.kt @@ -303,7 +303,7 @@ class CtaViewModel @Inject constructor( } if (!canShowOnboardingDaxDialogCta()) { - return if (brokenSitePrompt.isFeatureEnabled()) { + return if (withContext(dispatchers.io()) { brokenSitePrompt.isFeatureEnabled() }) { // TODO (cbarreiro) Add logic to decide whether or not to show the prompt BrokenSitePromptDialogCta() } else { diff --git a/broken-site/broken-site-api/src/main/java/com/duckduckgo/brokensite/api/BrokenSitePrompt.kt b/broken-site/broken-site-api/src/main/java/com/duckduckgo/brokensite/api/BrokenSitePrompt.kt index 73b87fcf9247..6fd87d21c278 100644 --- a/broken-site/broken-site-api/src/main/java/com/duckduckgo/brokensite/api/BrokenSitePrompt.kt +++ b/broken-site/broken-site-api/src/main/java/com/duckduckgo/brokensite/api/BrokenSitePrompt.kt @@ -22,5 +22,5 @@ interface BrokenSitePrompt { suspend fun userAcceptedPrompt() - fun isFeatureEnabled(): Boolean + suspend fun isFeatureEnabled(): Boolean } 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 ad1f52bc6506..4af64baab5f9 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 @@ -52,7 +52,7 @@ class RealBrokenSitePrompt @Inject constructor( brokenSiteReportRepository.setNextShownDate(null) } - override fun isFeatureEnabled(): Boolean { + override suspend fun isFeatureEnabled(): Boolean { return _featureEnabled } }