use tauri::{command, AppHandle, Runtime};
use crate::error::Result;
use crate::models::{IconOptions, ResetOptions};
#[cfg(mobile)]
use crate::AppIconExt;
#[command]
pub async fn is_supported<R: Runtime>(app: AppHandle<R>) -> Result<serde_json::Value> {
#[cfg(mobile)]
{
app.app_icon().is_supported()
}
#[cfg(not(mobile))]
{
let _ = app;
Ok(serde_json::json!({ "value": false }))
}
}
#[command]
pub async fn get_name<R: Runtime>(app: AppHandle<R>) -> Result<serde_json::Value> {
#[cfg(mobile)]
{
app.app_icon().get_name()
}
#[cfg(not(mobile))]
{
let _ = app;
Ok(serde_json::json!({ "value": null }))
}
}
#[command]
pub async fn change<R: Runtime>(
app: AppHandle<R>,
options: IconOptions,
) -> Result<()> {
#[cfg(mobile)]
{
app.app_icon().change(options)
}
#[cfg(not(mobile))]
{
let _ = (app, options);
Ok(())
}
}
#[command]
pub async fn reset<R: Runtime>(
app: AppHandle<R>,
options: ResetOptions,
) -> Result<()> {
#[cfg(mobile)]
{
app.app_icon().reset(options)
}
#[cfg(not(mobile))]
{
let _ = (app, options);
Ok(())
}
}