feat(wallpapers): add Immich integration with caching and rotation
This patch adds Immich integration for remote images with local caching and pruning. It adds image rotation to the crop flow and stores rotation with the crop state. It adds progress tracking and size checks during image download to avoid oversized assets. - Add Immich caching with size limits and automatic pruning - Extend crop handling to support rotation and persist it - Improve download progress and error messaging
This commit is contained in:
@@ -44,6 +44,7 @@ pub(crate) async fn set_image_crop<R: Runtime>(
|
||||
zoom: f64,
|
||||
position_x: f64,
|
||||
position_y: f64,
|
||||
rotation: i32,
|
||||
) -> Result<GalleryImage> {
|
||||
app.wallpaper().set_image_crop(ImageCropRequest {
|
||||
id,
|
||||
@@ -51,6 +52,7 @@ pub(crate) async fn set_image_crop<R: Runtime>(
|
||||
zoom,
|
||||
position_x,
|
||||
position_y,
|
||||
rotation,
|
||||
})
|
||||
}
|
||||
#[command]
|
||||
|
||||
@@ -47,6 +47,7 @@ impl<R: Runtime> Wallpaper<R> {
|
||||
crop_zoom: 1.0,
|
||||
crop_position_x: 0.5,
|
||||
crop_position_y: 0.5,
|
||||
crop_rotation: 0,
|
||||
})
|
||||
.collect();
|
||||
Ok(GalleryPage { total: 3, items })
|
||||
@@ -77,6 +78,7 @@ impl<R: Runtime> Wallpaper<R> {
|
||||
crop_zoom: payload.zoom,
|
||||
crop_position_x: payload.position_x,
|
||||
crop_position_y: payload.position_y,
|
||||
crop_rotation: payload.rotation,
|
||||
})
|
||||
}
|
||||
pub fn set_setting(&self, payload: SettingRequest) -> crate::Result<WallpaperState> {
|
||||
|
||||
@@ -58,6 +58,7 @@ pub struct ImageCropRequest {
|
||||
pub zoom: f64,
|
||||
pub position_x: f64,
|
||||
pub position_y: f64,
|
||||
pub rotation: i32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
|
||||
@@ -70,6 +71,7 @@ pub struct GalleryImage {
|
||||
pub crop_zoom: f64,
|
||||
pub crop_position_x: f64,
|
||||
pub crop_position_y: f64,
|
||||
pub crop_rotation: i32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
|
||||
|
||||
Reference in New Issue
Block a user