Skip to content

feat: Un-deprecate plugin and make it Capacitor v4 compatible #10

@piotr-cz

Description

@piotr-cz

Is your feature request related to a problem? Please describe:
As stated in readme, Capacitor v4 supports dark mode on Android - however it doesn't work for WebView versions lower than ~ v100.
At the same time, Capacitor v4 supports Android WebView 60+

Describe the solution you'd like:

  • Un-depreacate plugin
  • Add Capacitor v4 compatibility (constant has changed in androidx.webkit 1.3)
    src/main/java/dev/robingenz/capacitor/androiddarkmodesupport.java
     if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK_STRATEGY)) {
    -    WebSettingsCompat.setForceDarkStrategy(settings, WebSettingsCompat.WEB_THEME_DARKENING_ONLY);
    +    WebSettingsCompat.setForceDarkStrategy(settings, WebSettingsCompat.DARK_STRATEGY_WEB_THEME_DARKENING_ONLY);
     }
  • Add note that plugin is required for older WebView versions

Describe alternatives you've considered:
I've tried @aparajita/capacitor-dark-mode however it's not a straight forward drop-in solution as this plugin is

Additional context:
Some of related issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions