Skip to content

Commit

Permalink
Remove Deprecated Force Dark strategy for WebView (#4257)
Browse files Browse the repository at this point in the history
<!--
Note: This checklist is a reminder of our shared engineering
expectations.
The items in Bold are required
If your PR involves UI changes:
1. Upload screenshots or screencasts that illustrate the changes before
/ after
2. Add them under the UI changes section (feel free to add more columns
if needed)
If your PR does not involve UI changes, you can remove the **UI
changes** section

At a minimum, make sure your changes are tested in API 23 and one of the
more recent API levels available.
-->

Task/Issue URL:
https://app.asana.com/0/1174433894299346/1206764056479583/f

### Description
Remove Depreacted Force Dark strategy

### Steps to test this PR

_App in light theme_
- [x] Navigate to sites with dark theme support (reddit.com)
- [x] Verify site displays in light mode
- [x] Navigate to sites without dark theme support (as.com)
- [x] Verify site displays in light mode

_App in dark theme_
- [x] Navigate to sites with dark theme support (reddit.com)
- [x] Verify site displays in dark mode
- [x] Navigate to sites without dark theme support (as.com)
- [x] Verify site displays in light mode
  • Loading branch information
malmstein authored Mar 7, 2024
1 parent 4e74b9d commit a483bea
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 64 deletions.
10 changes: 0 additions & 10 deletions app/src/main/java/com/duckduckgo/app/browser/BrowserTabFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,6 @@ import com.duckduckgo.common.utils.FragmentViewModelFactory
import com.duckduckgo.common.utils.extensions.html
import com.duckduckgo.common.utils.extensions.websiteFromGeoLocationsApiOrigin
import com.duckduckgo.common.utils.plugins.PluginPoint
import com.duckduckgo.common.utils.webview.enableDarkMode
import com.duckduckgo.common.utils.webview.enableLightMode
import com.duckduckgo.di.scopes.FragmentScope
import com.duckduckgo.downloads.api.DOWNLOAD_SNACKBAR_DELAY
import com.duckduckgo.downloads.api.DOWNLOAD_SNACKBAR_LENGTH
Expand Down Expand Up @@ -2091,7 +2089,6 @@ class BrowserTabFragment :
setSupportMultipleWindows(true)
disableWebSql(this)
setSupportZoom(true)
configureDarkThemeSupport(this)
if (accessibilitySettingsDataStore.overrideSystemFontSize) {
textZoom = accessibilitySettingsDataStore.fontSize.toInt()
}
Expand Down Expand Up @@ -2313,13 +2310,6 @@ class BrowserTabFragment :
dialog.show(childFragmentManager, tag)
}

private fun configureDarkThemeSupport(webSettings: WebSettings) {
when (appTheme.isLightModeEnabled()) {
true -> webSettings.enableLightMode()
false -> webSettings.enableDarkMode()
}
}

private fun configureSwipeRefresh() {
val metrics = resources.displayMetrics
val distanceToTrigger = (DEFAULT_CIRCLE_TARGET_TIMES_1_5 * metrics.density).toInt()
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package com.duckduckgo.privacy.dashboard.impl.ui
import android.annotation.SuppressLint
import android.os.Bundle
import android.webkit.WebResourceRequest
import android.webkit.WebSettings
import android.webkit.WebView
import android.webkit.WebViewClient
import androidx.lifecycle.Lifecycle.State.STARTED
Expand All @@ -35,8 +34,6 @@ import com.duckduckgo.browser.api.brokensite.BrokenSiteNav
import com.duckduckgo.common.ui.DuckDuckGoActivity
import com.duckduckgo.common.ui.store.AppTheme
import com.duckduckgo.common.ui.viewbinding.viewBinding
import com.duckduckgo.common.utils.webview.enableDarkMode
import com.duckduckgo.common.utils.webview.enableLightMode
import com.duckduckgo.di.scopes.ActivityScope
import com.duckduckgo.navigation.api.getActivityParams
import com.duckduckgo.privacy.dashboard.api.ui.PrivacyDashboardHybridScreen.PrivacyDashboardHybridWithTabIdParam
Expand Down Expand Up @@ -152,7 +149,6 @@ class PrivacyDashboardHybridActivity : DuckDuckGoActivity() {
with(webView.settings) {
builtInZoomControls = false
javaScriptEnabled = true
configureDarkThemeSupport(this)
}

webView.webViewClient = object : WebViewClient() {
Expand Down Expand Up @@ -181,13 +177,6 @@ class PrivacyDashboardHybridActivity : DuckDuckGoActivity() {
}
}

private fun configureDarkThemeSupport(webSettings: WebSettings) {
when (appTheme.isLightModeEnabled()) {
true -> webSettings.enableLightMode()
false -> webSettings.enableDarkMode()
}
}

private fun configViewStateObserver() {
lifecycleScope.launch {
viewModel.viewState()
Expand Down

0 comments on commit a483bea

Please sign in to comment.