Skip to content

Commit 015c15d

Browse files
committed
Reload script before page reload when changing protection status
1 parent aeb1bfb commit 015c15d

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

app/src/main/java/com/duckduckgo/app/browser/BrowserTabFragment.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,11 +1935,17 @@ class BrowserTabFragment :
19351935
is Command.ShowFireproofWebSiteConfirmation -> fireproofWebsiteConfirmation(it.fireproofWebsiteEntity)
19361936
is Command.DeleteFireproofConfirmation -> removeFireproofWebsiteConfirmation(it.fireproofWebsiteEntity)
19371937
is Command.RefreshAndShowPrivacyProtectionEnabledConfirmation -> {
1938+
webView?.let {
1939+
webViewClient.configureWebView(it, null)
1940+
}
19381941
refresh()
19391942
privacyProtectionEnabledConfirmation(it.domain)
19401943
}
19411944

19421945
is Command.RefreshAndShowPrivacyProtectionDisabledConfirmation -> {
1946+
webView?.let {
1947+
webViewClient.configureWebView(it, null)
1948+
}
19431949
refresh()
19441950
privacyProtectionDisabledConfirmation(it.domain)
19451951
}

app/src/main/java/com/duckduckgo/app/browser/BrowserWebViewClient.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,13 +469,15 @@ class BrowserWebViewClient @Inject constructor(
469469
webView.settings.mediaPlaybackRequiresUserGesture = mediaPlayback.doesMediaPlaybackRequireUserGestureForUrl(url)
470470
}
471471

472-
fun configureWebView(webView: DuckDuckGoWebView, callback: WebViewCompatMessageCallback) {
472+
fun configureWebView(webView: DuckDuckGoWebView, callback: WebViewCompatMessageCallback?) {
473473
addDocumentStartJavascriptPlugins.getPlugins().forEach { plugin ->
474474
plugin.addDocumentStartJavaScript(webView)
475475
}
476476

477-
webMessagingPlugins.getPlugins().forEach { plugin ->
478-
plugin.register(callback, webView)
477+
callback?.let {
478+
webMessagingPlugins.getPlugins().forEach { plugin ->
479+
plugin.register(callback, webView)
480+
}
479481
}
480482
}
481483

0 commit comments

Comments
 (0)