@@ -47,19 +47,19 @@ class RealWebViewCompatTestHelper @Inject constructor(
4747 private val adapter = moshi.adapter(WebViewCompatFeatureSettings ::class .java)
4848
4949 override suspend fun configureWebViewForWebViewCompatTest (webView : DuckDuckGoWebView ) {
50- withContext(dispatchers.main()) {
51- val script = withContext(dispatchers.io()) {
52- if (! webViewCompatFeature.self().isEnabled()) return @withContext null
50+ val script = withContext(dispatchers.io()) {
51+ if (! webViewCompatFeature.self().isEnabled()) return @withContext null
5352
54- val webViewCompatSettings = webViewCompatFeature.self().getSettings()?.let {
55- adapter.fromJson(it)
56- }
57- webView.resources?.openRawResource(R .raw.webviewcompat_test_script)?.bufferedReader().use { it?.readText() }.orEmpty()
58- .replace(delay, webViewCompatSettings?.jsInitialPingDelay?.toString() ? : " 0" )
59- .replace(postInitialPing, webViewCompatFeature.jsSendsInitialPing().isEnabled().toString())
60- .replace(replyToNativeMessages, webViewCompatFeature.jsRepliesToNativeMessages().isEnabled().toString())
61- } ? : return @withContext
53+ val webViewCompatSettings = webViewCompatFeature.self().getSettings()?.let {
54+ adapter.fromJson(it)
55+ }
56+ webView.resources?.openRawResource(R .raw.webviewcompat_test_script)?.bufferedReader().use { it?.readText() }.orEmpty()
57+ .replace(delay, webViewCompatSettings?.jsInitialPingDelay?.toString() ? : " 0" )
58+ .replace(postInitialPing, webViewCompatFeature.jsSendsInitialPing().isEnabled().toString())
59+ .replace(replyToNativeMessages, webViewCompatFeature.jsRepliesToNativeMessages().isEnabled().toString())
60+ } ? : return
6261
62+ withContext(dispatchers.main()) {
6363 webViewCompatWrapper.addDocumentStartJavaScript(webView, script, setOf (" *" ))
6464 }
6565 }
0 commit comments