feat(setup): bootstrap Android plugin and web UI
This initial commit adds a multi-part scaffold for Wechselbild, including a web UI and an Android plugin. It introduces frontend assets and a package.json-based dev setup, plus plugin scaffolding for Android with Kotlin sources and Cargo.toml for the Tauri plugin. - Adds Android wallpaper plugin with Kotlin sources and manifest - Includes web UI scaffold with index.html and package.json - Adds Tauri plugin scaffold with Cargo.toml and build config
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
use tauri::{
|
||||
plugin::{Builder, TauriPlugin},
|
||||
Manager, Runtime,
|
||||
};
|
||||
|
||||
pub use models::*;
|
||||
|
||||
#[cfg(desktop)]
|
||||
mod desktop;
|
||||
#[cfg(mobile)]
|
||||
mod mobile;
|
||||
|
||||
mod commands;
|
||||
mod error;
|
||||
mod models;
|
||||
|
||||
pub use error::{Error, Result};
|
||||
|
||||
#[cfg(desktop)]
|
||||
use desktop::Wallpaper;
|
||||
#[cfg(mobile)]
|
||||
use mobile::Wallpaper;
|
||||
|
||||
/// Extensions to [`tauri::App`], [`tauri::AppHandle`] and [`tauri::Window`] to access the wallpaper APIs.
|
||||
pub trait WallpaperExt<R: Runtime> {
|
||||
fn wallpaper(&self) -> &Wallpaper<R>;
|
||||
}
|
||||
|
||||
impl<R: Runtime, T: Manager<R>> crate::WallpaperExt<R> for T {
|
||||
fn wallpaper(&self) -> &Wallpaper<R> {
|
||||
self.state::<Wallpaper<R>>().inner()
|
||||
}
|
||||
}
|
||||
|
||||
/// Initializes the plugin.
|
||||
pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
||||
Builder::new("wallpaper")
|
||||
.invoke_handler(tauri::generate_handler![commands::get_state, commands::select_images, commands::set_setting, commands::next_wallpaper])
|
||||
.setup(|app, api| {
|
||||
#[cfg(mobile)]
|
||||
let wallpaper = mobile::init(app, api)?;
|
||||
#[cfg(desktop)]
|
||||
let wallpaper = desktop::init(app, api)?;
|
||||
app.manage(wallpaper);
|
||||
Ok(())
|
||||
})
|
||||
.build()
|
||||
}
|
||||
Reference in New Issue
Block a user