From 3f2d47c4bbad0621e18f9ee45ee750839b62f8d9 Mon Sep 17 00:00:00 2001 From: Aitor Viana Date: Fri, 30 Aug 2024 13:00:14 +0100 Subject: [PATCH] removeRedditEmptyCookie in io() (#4964) Task/Issue URL: https://app.asana.com/0/1198194956794324/1208180779425187/f ### Description Fix potential ANR during reddit workaround ### Steps to test this PR Repeat test in https://github.com/duckduckgo/Android/pull/4591 --- .../networkprotection/impl/reddit/RedditBlockWorkaround.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/reddit/RedditBlockWorkaround.kt b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/reddit/RedditBlockWorkaround.kt index 0ea81e2bc975..95a6ca0a2f19 100644 --- a/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/reddit/RedditBlockWorkaround.kt +++ b/network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/reddit/RedditBlockWorkaround.kt @@ -50,7 +50,9 @@ class RedditBlockWorkaround @Inject constructor( } } override fun onPause(owner: LifecycleOwner) { - removeRedditEmptyCookie() + owner.lifecycleScope.launch(dispatcherProvider.io()) { + removeRedditEmptyCookie() + } } private suspend fun addRedditEmptyCookie() {