1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! The system's light or dark setting, where the web view cannot see it.
//!
//! An Android WebView does not report the system theme to the page. From
//! target SDK 33 its `prefers-color-scheme` follows the app's own theme
//! instead (`isLightTheme`), and the Activity `dx` generates uses a light
//! AppCompat theme, so the page is told "light" whatever the phone is set to.
//! Asking the system directly is the way round it. Browsers and iOS's
//! WKWebView already report the real setting, so there this answers `None`
//! and leaves the page to its own media query.
//!
//! Changing the system theme recreates the Android Activity (the generated
//! manifest does not handle `uiMode` itself), which restarts the app, so one
//! read at startup stays true for the life of the page.
/// Declared for its side effect: this is what tells `dx` to build and bundle
/// the Kotlin module. Android calls go through [`crate::android_bridge`] so
/// they resolve the class through the app's loader on Dioxus worker threads.
unsafe extern "Kotlin"
const APPEARANCE_CLASS: &str = "dev.dioxus.g3_native_plugins.appearance.AppearancePlugin";
/// Reads whether the system is set to dark mode.