#[cfg(any(feature = "ios", feature = "android"))]
use crate::error::Error;
#[cfg(any(feature = "ios", feature = "android"))]
use crate::helpers::*;
use serde::{Deserialize, Serialize};
#[cfg(any(feature = "ios", feature = "android"))]
use crate::extern_functions::*;
pub struct StatusBar;
impl StatusBar {
#[cfg(any(feature = "ios", feature = "android"))]
pub async fn show() -> Result<(), Error> {
run_unit_unit(status_bar_show).await
}
#[cfg(any(feature = "ios", feature = "android"))]
pub async fn hide() -> Result<(), Error> {
run_unit_unit(status_bar_hide).await
}
#[cfg(any(feature = "ios", feature = "android"))]
pub async fn set_style(options: impl Into<StyleOptions>) -> Result<(), Error> {
run_value_unit(options, status_bar_set_style).await
}
#[cfg(any(feature = "ios", feature = "android"))]
pub async fn set_background_color(
options: impl Into<BackgroundColorOptions>,
) -> Result<(), Error> {
run_value_unit(options, status_bar_set_background_color).await
}
#[cfg(any(feature = "ios", feature = "android"))]
pub async fn set_overlays_web_view(
options: impl Into<SetOverlaysWebViewOptions>,
) -> Result<(), Error> {
run_value_unit(options, status_bar_set_overlays_web_view).await
}
}
#[derive(Clone, Default, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct BackgroundColorOptions {
pub color: String,
}
impl From<&str> for BackgroundColorOptions {
fn from(value: &str) -> Self {
Self {
color: value.to_string(),
}
}
}
#[derive(Copy, Clone, Default, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct StyleOptions {
#[serde(rename = "style")]
pub style: Style,
}
impl From<Style> for StyleOptions {
fn from(style: Style) -> Self {
Self { style }
}
}
#[derive(Copy, Clone, Default, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "UPPERCASE")]
pub enum Style {
#[default]
Default,
Dark,
Light,
}
#[derive(Copy, Clone, Default, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct SetOverlaysWebViewOptions {
pub overlay: bool,
}
impl From<bool> for SetOverlaysWebViewOptions {
fn from(overlay: bool) -> Self {
Self { overlay }
}
}