feat(android): switch to screen-on rotation service and updated scheduler
The rotation service now responds to screen on/off events via a dedicated ScreenOnRotationService, reducing background work and avoiding perpetual wakeful states. Manifest and receiver logic were adjusted to align with the new behavior and energy constraints. Scheduling and enablement now consistently use timed-based rules and screen-on preferences, with the boot and alarm paths updated to honor these settings. This avoids unnecessary foreground services and keeps the app compliant with Doze and battery optimizations. Immich image handling improvements include throttled progress updates, larger cache allowances, and a connectivity-aware automatic download check to avoid unwanted network usage. - Use ScreenOnRotationService for screen-on based rotation scheduling - Centralize enablement via timed-enabled paths and AlarmManager windowing - Improve Immich cache and progress reporting with connectivity checks
This commit is contained in:
@@ -64,7 +64,7 @@ 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> {
|
||||
pub(crate) async fn set_interval<R: Runtime>(app: AppHandle<R>, minutes: i32) -> Result<WallpaperState> {
|
||||
app.wallpaper().set_interval(IntervalRequest { minutes })
|
||||
}
|
||||
#[command]
|
||||
|
||||
@@ -96,7 +96,7 @@ impl<R: Runtime> Wallpaper<R> {
|
||||
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;
|
||||
state.enabled = payload.minutes != 0;
|
||||
Ok(state)
|
||||
}
|
||||
pub fn next_wallpaper(&self) -> crate::Result<WallpaperState> {
|
||||
|
||||
@@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
|
||||
pub struct WallpaperState {
|
||||
pub image_count: usize,
|
||||
pub enabled: bool,
|
||||
pub interval_minutes: usize,
|
||||
pub interval_minutes: i32,
|
||||
pub shuffle: bool,
|
||||
pub lock_screen_only: bool,
|
||||
pub current_index: usize,
|
||||
@@ -24,7 +24,7 @@ pub struct SettingRequest {
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct IntervalRequest {
|
||||
pub minutes: usize,
|
||||
pub minutes: i32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
|
||||
Reference in New Issue
Block a user