Giter Club home page Giter Club logo

timbru31 / cordova-plugin-android-dark-mode-support Goto Github PK

View Code? Open in Web Editor NEW
12.0 4.0 1.0 264 KB

๐ŸŒš/๐ŸŒž Apache Cordova plugin to enable proper dark mode support for Android WebView's

Home Page: https://www.npmjs.com/package/cordova-plugin-android-dark-mode-support

License: MIT License

JavaScript 14.86% Kotlin 85.14%
android cordova-plugin kotlin ionic phonegap phonegap-plugin dark-mode cordova-android cordova-android-plugin ionic-plugin

cordova-plugin-android-dark-mode-support's Introduction

cordova-plugin-android-dark-mode-support's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar github-actions[bot] avatar timbru31 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

oriolsr

cordova-plugin-android-dark-mode-support's Issues

Darkmode targetSDK 33 Android (might need to adjust)

Since the targetSDK 33 on Android WebView the behaviour of darkmode has changed.
It now could 'work' without the plugin however out of the box it does not function at all.
That includes whilst using this plugin.

My finding are based on using using ionic-webview

The change that one should make in order for it to work (again) is change the style of the app theme in
cordova/platforms/android/app/src/main/res/values/styles.xml

@style/Theme.AppCompat.Light.NoActionBar to @style/Theme.AppCompat.DayNight.NoActionBar

Note that with this change it does not propagate when the phone theme is changed (ligt, dark) while the app is still open.

Old:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
    <style name="AppTheme" parent="@style/Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowBackground">@android:color/white</item>
        <item name="android:statusBarColor">@android:color/white</item>
        <item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
    </style>
</resources>

new

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
    <style name="AppTheme" parent="@style/Theme.AppCompat.DayNight.NoActionBar">
        <item name="android:windowBackground">@android:color/white</item>
        <item name="android:statusBarColor">@android:color/white</item>
        <item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
    </style>

Error adding plugin de.dustplanet.cordova.AndroidDarkModeSupport.

Hi i installed your plugin today and now my app ist crasching even after i uninstaled it.
it has the problem that is trys to load de.dustplanet.cordova.AndroidDarkModeSupport.

Stacktrace:

System.err: java.lang.ClassNotFoundException: de.dustplanet.cordova.AndroidDarkModeSupport
System.err:    at java.lang.Class.classForName(Native Method)
System.err:    at java.lang.Class.forName(Class.java:453)
System.err:    at java.lang.Class.forName(Class.java:378)
System.err:    at org.apache.cordova.PluginManager.instantiatePlugin(PluginManager.java:564)
System.err:    at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:183)
System.err:    at org.apache.cordova.PluginManager.startupPlugins(PluginManager.java:108)
System.err:    at org.apache.cordova.PluginManager.init(PluginManager.java:96)
System.err:    at org.apache.cordova.CordovaWebViewImpl.init(CordovaWebViewImpl.java:119)
System.err:    at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:152)
System.err:    at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:227)
System.err:    at de.terraconnect.smarthome.MainActivity.onCreate(MainActivity.java:39)
System.err:    at android.app.Activity.performCreate(Activity.java:7327)
System.err:    at android.app.Activity.performCreate(Activity.java:7318)
System.err:    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
System.err:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3094)
System.err:    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3257)
System.err:    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
System.err:    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
System.err:    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
System.err:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1948)
System.err:    at android.os.Handler.dispatchMessage(Handler.java:106)
System.err:    at android.os.Looper.loop(Looper.java:214)
System.err:    at android.app.ActivityThread.main(ActivityThread.java:7050)
System.err:    at java.lang.reflect.Method.invoke(Native Method)
System.err:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
System.err:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "de.dustplanet.cordova.AndroidDarkModeSupport" on path: DexPathList[[zip file "/data/app/de.terraconnect.smarthome-dUL3NQv8pLh0Bq2aJlXJUw==/base.apk"],nativeLibraryDirectories=[/data/app/de.terraconnect.smarthome-dUL3NQv8pLh0Bq2aJlXJUw==/lib/arm64, /system/lib64, /system/vendor/lib64]]
System.err:    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
System.err:    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
System.err:    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
System.err:    ... 26 more
System.out: Error adding plugin de.dustplanet.cordova.AndroidDarkModeSupport.
AndroidRuntime: Shutting down VM

App falsely marked as "Virus detected" when using this plugin

This is not an issue with the plugin. The plugin works fine. I'm purely writing this to see if anybody else has experienced (and solved) the same issue.

Whenever I try to install the debug build of my app, a big red message flashes up, warning me of a "trojan" inside the app. This is a "feature" in Xioami brand mobile phones that's based on the the "Avast" engine. I can reproduce the same issue on virustotal.com. The "Avast-Mobile" engine detects something, while all of the otther engines have no issues:

image

I disabled one plugin after another and only this one triggers the false positive. I checked all of the code and of course found nothing.

Interestingly, when disabling "GradlePluginKotlinEnabled", the app crashes on startup (as expected), but in that case it doesn't get detected by Avast. So I suppose it might have to do something with the bytecode generated by Kotlin?

Any help or idea is appreciated. I'm thinking about rewriting the Kotlin part in Java to see if that helps, but maybe somebody else has been able to solve the same issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.