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:
+26
-1
@@ -3,6 +3,7 @@ import { invoke } from "@tauri-apps/api/core";
|
||||
export type WallpaperState = {
|
||||
imageCount: number;
|
||||
enabled: boolean;
|
||||
intervalMinutes: number;
|
||||
shuffle: boolean;
|
||||
lockScreenOnly: boolean;
|
||||
currentIndex: number;
|
||||
@@ -27,6 +28,7 @@ export type GalleryPage = {
|
||||
const demoState: WallpaperState = {
|
||||
imageCount: 3,
|
||||
enabled: true,
|
||||
intervalMinutes: 30,
|
||||
shuffle: true,
|
||||
lockScreenOnly: true,
|
||||
currentIndex: 0,
|
||||
@@ -68,6 +70,20 @@ export async function deleteImage(id: string): Promise<WallpaperState> {
|
||||
return { ...demoState, imageUrls: [...demoState.imageUrls] };
|
||||
}
|
||||
|
||||
export async function getImageIds(): Promise<string[]> {
|
||||
if (inTauri()) return invoke<string[]>("plugin:wallpaper|get_image_ids");
|
||||
return demoState.imageUrls.map((_, index) => `demo-${index}`);
|
||||
}
|
||||
|
||||
export async function deleteImages(ids: string[]): Promise<WallpaperState> {
|
||||
if (inTauri()) return invoke<WallpaperState>("plugin:wallpaper|delete_images", { ids });
|
||||
const indexes = new Set(ids.map(id => Number(id.replace("demo-", ""))).filter(Number.isInteger));
|
||||
demoState.imageUrls = demoState.imageUrls.filter((_, index) => !indexes.has(index));
|
||||
demoState.imageCount = demoState.imageUrls.length;
|
||||
demoState.currentIndex = Math.min(demoState.currentIndex, Math.max(0, demoState.imageCount - 1));
|
||||
return { ...demoState, imageUrls: [...demoState.imageUrls] };
|
||||
}
|
||||
|
||||
export async function setImageCrop(image: GalleryImage): Promise<GalleryImage> {
|
||||
const payload = {
|
||||
id: image.id,
|
||||
@@ -86,11 +102,20 @@ export async function setImageCrop(image: GalleryImage): Promise<GalleryImage> {
|
||||
return { ...image };
|
||||
}
|
||||
|
||||
export async function setSetting(name: "enabled" | "shuffle" | "lockScreenOnly", value: boolean) {
|
||||
export async function setSetting(name: "shuffle" | "lockScreenOnly", value: boolean) {
|
||||
if (!inTauri()) return { ...demoState, [name]: value };
|
||||
return invoke<WallpaperState>("plugin:wallpaper|set_setting", { name, value });
|
||||
}
|
||||
|
||||
export async function setIntervalMinutes(value: number) {
|
||||
if (!inTauri()) {
|
||||
demoState.intervalMinutes = value;
|
||||
demoState.enabled = value > 0;
|
||||
return { ...demoState };
|
||||
}
|
||||
return invoke<WallpaperState>("plugin:wallpaper|set_interval", { minutes: value });
|
||||
}
|
||||
|
||||
export async function nextWallpaper(): Promise<WallpaperState> {
|
||||
if (!inTauri()) {
|
||||
demoState.currentIndex = (demoState.currentIndex + 1) % demoState.imageUrls.length;
|
||||
|
||||
Reference in New Issue
Block a user