chore: add project scaffolding and resources
This initial commit scaffolds the project with essential docs, assets, and build configs. It adds Android icons, design assets, and release metadata to support mobile targets. A fastlane config and F-Droid manifest are included to streamline builds. - Adds F-Droid configuration for automated builds - Includes license and privacy policy documents - Provides app icons and assets for Android and design system
This commit is contained in:
@@ -29,6 +29,14 @@ pub(crate) async fn delete_image<R: Runtime>(
|
||||
app.wallpaper().delete_image(DeleteImageRequest { id })
|
||||
}
|
||||
#[command]
|
||||
pub(crate) async fn get_image_ids<R: Runtime>(app: AppHandle<R>) -> Result<Vec<String>> {
|
||||
app.wallpaper().get_image_ids()
|
||||
}
|
||||
#[command]
|
||||
pub(crate) async fn delete_images<R: Runtime>(app: AppHandle<R>, ids: Vec<String>) -> Result<WallpaperState> {
|
||||
app.wallpaper().delete_images(DeleteImagesRequest { ids })
|
||||
}
|
||||
#[command]
|
||||
pub(crate) async fn set_image_crop<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
id: String,
|
||||
@@ -54,6 +62,10 @@ pub(crate) async fn set_setting<R: Runtime>(
|
||||
app.wallpaper().set_setting(SettingRequest { name, value })
|
||||
}
|
||||
#[command]
|
||||
pub(crate) async fn set_interval<R: Runtime>(app: AppHandle<R>, minutes: usize) -> Result<WallpaperState> {
|
||||
app.wallpaper().set_interval(IntervalRequest { minutes })
|
||||
}
|
||||
#[command]
|
||||
pub(crate) async fn next_wallpaper<R: Runtime>(app: AppHandle<R>) -> Result<WallpaperState> {
|
||||
app.wallpaper().next_wallpaper()
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ impl<R: Runtime> Wallpaper<R> {
|
||||
WallpaperState {
|
||||
image_count: 3,
|
||||
enabled: true,
|
||||
interval_minutes: 30,
|
||||
shuffle: true,
|
||||
lock_screen_only: true,
|
||||
current_index: 0,
|
||||
@@ -56,6 +57,12 @@ impl<R: Runtime> Wallpaper<R> {
|
||||
pub fn delete_image(&self, _payload: DeleteImageRequest) -> crate::Result<WallpaperState> {
|
||||
Ok(Self::demo())
|
||||
}
|
||||
pub fn get_image_ids(&self) -> crate::Result<Vec<String>> {
|
||||
Ok((0..Self::demo().image_count).map(|index| format!("demo-{index}")).collect())
|
||||
}
|
||||
pub fn delete_images(&self, _payload: DeleteImagesRequest) -> crate::Result<WallpaperState> {
|
||||
Ok(Self::demo())
|
||||
}
|
||||
pub fn set_image_crop(&self, payload: ImageCropRequest) -> crate::Result<GalleryImage> {
|
||||
let url = Self::demo()
|
||||
.image_urls
|
||||
@@ -82,6 +89,12 @@ impl<R: Runtime> Wallpaper<R> {
|
||||
};
|
||||
Ok(state)
|
||||
}
|
||||
pub fn set_interval(&self, payload: IntervalRequest) -> crate::Result<WallpaperState> {
|
||||
let mut state = Self::demo();
|
||||
state.interval_minutes = payload.minutes;
|
||||
state.enabled = payload.minutes > 0;
|
||||
Ok(state)
|
||||
}
|
||||
pub fn next_wallpaper(&self) -> crate::Result<WallpaperState> {
|
||||
let mut state = Self::demo();
|
||||
state.current_index = 1;
|
||||
|
||||
@@ -40,8 +40,11 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
||||
commands::get_gallery,
|
||||
commands::select_images,
|
||||
commands::delete_image,
|
||||
commands::get_image_ids,
|
||||
commands::delete_images,
|
||||
commands::set_image_crop,
|
||||
commands::set_setting,
|
||||
commands::set_interval,
|
||||
commands::next_wallpaper
|
||||
])
|
||||
.setup(|app, api| {
|
||||
|
||||
@@ -43,6 +43,13 @@ impl<R: Runtime> Wallpaper<R> {
|
||||
.run_mobile_plugin("deleteImage", payload)
|
||||
.map_err(Into::into)
|
||||
}
|
||||
pub fn get_image_ids(&self) -> crate::Result<Vec<String>> {
|
||||
let response: ImageIdsResponse = self.0.run_mobile_plugin("getImageIds", ())?;
|
||||
Ok(response.ids)
|
||||
}
|
||||
pub fn delete_images(&self, payload: DeleteImagesRequest) -> crate::Result<WallpaperState> {
|
||||
self.0.run_mobile_plugin("deleteImages", payload).map_err(Into::into)
|
||||
}
|
||||
pub fn set_image_crop(&self, payload: ImageCropRequest) -> crate::Result<GalleryImage> {
|
||||
self.0
|
||||
.run_mobile_plugin("setImageCrop", payload)
|
||||
@@ -53,6 +60,11 @@ impl<R: Runtime> Wallpaper<R> {
|
||||
.run_mobile_plugin("setSetting", payload)
|
||||
.map_err(Into::into)
|
||||
}
|
||||
pub fn set_interval(&self, payload: IntervalRequest) -> crate::Result<WallpaperState> {
|
||||
self.0
|
||||
.run_mobile_plugin("setInterval", payload)
|
||||
.map_err(Into::into)
|
||||
}
|
||||
pub fn next_wallpaper(&self) -> crate::Result<WallpaperState> {
|
||||
self.0
|
||||
.run_mobile_plugin("nextWallpaper", ())
|
||||
|
||||
@@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
|
||||
pub struct WallpaperState {
|
||||
pub image_count: usize,
|
||||
pub enabled: bool,
|
||||
pub interval_minutes: usize,
|
||||
pub shuffle: bool,
|
||||
pub lock_screen_only: bool,
|
||||
pub current_index: usize,
|
||||
@@ -18,6 +19,12 @@ pub struct SettingRequest {
|
||||
pub value: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct IntervalRequest {
|
||||
pub minutes: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct GalleryRequest {
|
||||
@@ -31,6 +38,18 @@ pub struct DeleteImageRequest {
|
||||
pub id: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct DeleteImagesRequest {
|
||||
pub ids: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ImageIdsResponse {
|
||||
pub ids: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ImageCropRequest {
|
||||
|
||||
Reference in New Issue
Block a user