mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-10-06 03:38:23 +00:00
fix(napplet): drop algorithmic darkening so dark-by-default sites aren't corrupted
setAlgorithmicDarkeningAllowed(true) was added to force-darken pages that don't implement prefers-color-scheme. Combined with nightThemedContext (which forces the embed WebView's isLightTheme=false), it now also runs on pages that are ALREADY dark but don't declare CSS color-scheme support — e.g. ditto.pub, which ships <html class="dark"> by default — and algorithmically inverts their nav bars to light, leaving "dark content, light bars". prefers-color-scheme: dark is driven by isLightTheme (nightThemedContext) INDEPENDENTLY of algorithmic darkening — device-verified: embedded pages still report prefersDark=true with darkening off — so dropping it keeps real dark-aware sites dark while no longer corrupting dark-by-default ones. The trade-off (a site with no dark mode of its own renders light instead of being force-inverted) matches how a real mobile browser behaves. Removed from all four embed/host WebView configs (browser + nsite/napplet, embedded + full-screen) along with the now-unused WebSettingsCompat import. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
4b6e4be942
commit
c6575a0888
-4
@@ -60,7 +60,6 @@ import androidx.webkit.JavaScriptReplyProxy
|
||||
import androidx.webkit.ProxyConfig
|
||||
import androidx.webkit.ProxyController
|
||||
import androidx.webkit.WebMessageCompat
|
||||
import androidx.webkit.WebSettingsCompat
|
||||
import androidx.webkit.WebViewCompat
|
||||
import androidx.webkit.WebViewFeature
|
||||
import com.vitorpamplona.amethyst.commons.browser.OmniboxInput
|
||||
@@ -315,9 +314,6 @@ class NappletBrowserActivity : ComponentActivity() {
|
||||
safeBrowsingEnabled = true
|
||||
}
|
||||
}
|
||||
if (WebViewFeature.isFeatureSupported(WebViewFeature.ALGORITHMIC_DARKENING)) {
|
||||
WebSettingsCompat.setAlgorithmicDarkeningAllowed(wv.settings, true)
|
||||
}
|
||||
WebView.setWebContentsDebuggingEnabled(false)
|
||||
wv.webViewClient = BrowserClient()
|
||||
wv.webChromeClient = BrowserChromeClient()
|
||||
|
||||
-4
@@ -48,7 +48,6 @@ import androidx.annotation.RequiresApi
|
||||
import androidx.privacysandbox.ui.provider.toCoreLibInfo
|
||||
import androidx.webkit.JavaScriptReplyProxy
|
||||
import androidx.webkit.WebMessageCompat
|
||||
import androidx.webkit.WebSettingsCompat
|
||||
import androidx.webkit.WebViewCompat
|
||||
import androidx.webkit.WebViewFeature
|
||||
import com.vitorpamplona.amethyst.commons.browser.OmniboxInput
|
||||
@@ -313,9 +312,6 @@ class NappletBrowserService : Service() {
|
||||
safeBrowsingEnabled = true
|
||||
}
|
||||
}
|
||||
if (WebViewFeature.isFeatureSupported(WebViewFeature.ALGORITHMIC_DARKENING)) {
|
||||
WebSettingsCompat.setAlgorithmicDarkeningAllowed(wv.settings, true)
|
||||
}
|
||||
WebView.setWebContentsDebuggingEnabled(false)
|
||||
wv.webViewClient = BrowserClient(tab)
|
||||
wv.webChromeClient = BrowserChromeClient(tab)
|
||||
|
||||
-4
@@ -62,7 +62,6 @@ import androidx.webkit.JavaScriptReplyProxy
|
||||
import androidx.webkit.ProxyConfig
|
||||
import androidx.webkit.ProxyController
|
||||
import androidx.webkit.WebMessageCompat
|
||||
import androidx.webkit.WebSettingsCompat
|
||||
import androidx.webkit.WebViewCompat
|
||||
import androidx.webkit.WebViewFeature
|
||||
import com.vitorpamplona.amethyst.commons.napplet.NappletWebContract
|
||||
@@ -507,9 +506,6 @@ class NappletHostActivity : ComponentActivity() {
|
||||
safeBrowsingEnabled = true
|
||||
}
|
||||
}
|
||||
if (WebViewFeature.isFeatureSupported(WebViewFeature.ALGORITHMIC_DARKENING)) {
|
||||
WebSettingsCompat.setAlgorithmicDarkeningAllowed(webView.settings, true)
|
||||
}
|
||||
// Disable the overscroll stretch/glow: forcing a scroll past the content edge stretched the
|
||||
// WebView's output and exposed the shell document's background behind the applet iframe at the
|
||||
// seam (a stray white band at the bottom). The applet's own content still scrolls normally.
|
||||
|
||||
-4
@@ -50,7 +50,6 @@ import androidx.webkit.JavaScriptReplyProxy
|
||||
import androidx.webkit.ProxyConfig
|
||||
import androidx.webkit.ProxyController
|
||||
import androidx.webkit.WebMessageCompat
|
||||
import androidx.webkit.WebSettingsCompat
|
||||
import androidx.webkit.WebViewCompat
|
||||
import androidx.webkit.WebViewFeature
|
||||
import com.vitorpamplona.amethyst.commons.napplet.NappletWebContract
|
||||
@@ -340,9 +339,6 @@ class NappletHostService : Service() {
|
||||
safeBrowsingEnabled = true
|
||||
}
|
||||
}
|
||||
if (WebViewFeature.isFeatureSupported(WebViewFeature.ALGORITHMIC_DARKENING)) {
|
||||
WebSettingsCompat.setAlgorithmicDarkeningAllowed(wv.settings, true)
|
||||
}
|
||||
wv.overScrollMode = View.OVER_SCROLL_NEVER
|
||||
WebView.setWebContentsDebuggingEnabled(false)
|
||||
wv.webViewClient = HostClient(tab)
|
||||
|
||||
Reference in New Issue
Block a user