From 1be9e40948deaa0087e98b6b3af3650b4c1f5432 Mon Sep 17 00:00:00 2001 From: Arif Burak Demiray Date: Thu, 16 Jul 2026 11:53:17 +0300 Subject: [PATCH] fix: nomodule entries break await resources in contents --- CHANGELOG.md | 2 + .../sdk/CountlyWebViewClientTests.java | 33 ++++++++++ .../android/sdk/CountlyWebViewClient.java | 61 +++++++++++-------- 3 files changed, 72 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 680ccee6e..1dce25fbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ * Improved link handling for content and feedback widgets, so links that carry their own query parameters, such as deep links, are parsed correctly. * Added a content configuration option to provide a handler for links opened from the content web view, so the app can route its own deep links instead of the SDK opening the system browser, set via `setContentUrlHandler(ContentUrlHandler)`. +* Mitigated an issue where content could fail to be displayed on some devices, as the content web view could stay hidden even after its resources had finished loading. + ## 26.1.4 * ! Minor breaking change ! Deprecated the static field "CountlyPush.useAdditionalIntentRedirectionChecks". It is now a no-op; use "CountlyConfigPush.enableAdditionalIntentRedirectionChecks()" instead, otherwise the stricter push intent redirection checks stay disabled. diff --git a/sdk/src/androidTest/java/ly/count/android/sdk/CountlyWebViewClientTests.java b/sdk/src/androidTest/java/ly/count/android/sdk/CountlyWebViewClientTests.java index ef6a69c20..1a41d4c6c 100644 --- a/sdk/src/androidTest/java/ly/count/android/sdk/CountlyWebViewClientTests.java +++ b/sdk/src/androidTest/java/ly/count/android/sdk/CountlyWebViewClientTests.java @@ -453,4 +453,37 @@ public void shouldInterceptRequest_allowlistMode() { CountlyWebViewClient httpAllowed = new CountlyWebViewClient(new HashSet<>(Arrays.asList("http"))); Assert.assertNull(httpAllowed.shouldInterceptRequest(null, fakeRequest("http://example.com/a.png", false))); } + + // ===================================== + // Readiness gate (regression) + // ===================================== + + /** + * Regression: a nomodule {@code " + + "content"; + runOnMainSync(() -> { + wv.setWebViewClient(client); + wv.loadDataWithBaseURL("https://example.com/", html, "text/html", "utf-8", null); + }); + + Assert.assertTrue("readiness callback did not fire under the 60s timeout — readyState gate regressed", + latch.await(20, TimeUnit.SECONDS)); + Assert.assertEquals(1, callbackResults.size()); + Assert.assertFalse("content must be shown (failed=false), not discarded", callbackResults.get(0)); + } } diff --git a/sdk/src/main/java/ly/count/android/sdk/CountlyWebViewClient.java b/sdk/src/main/java/ly/count/android/sdk/CountlyWebViewClient.java index 1735f12d0..a8f1671ed 100644 --- a/sdk/src/main/java/ly/count/android/sdk/CountlyWebViewClient.java +++ b/sdk/src/main/java/ly/count/android/sdk/CountlyWebViewClient.java @@ -89,20 +89,25 @@ public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceReque private static final long POLL_INTERVAL_MS = 100; private static final long TIMEOUT_MS = 60_000; - // Checks all and