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:
@@ -9,6 +9,8 @@ import app.tauri.annotation.Command
|
||||
import app.tauri.annotation.InvokeArg
|
||||
import app.tauri.annotation.TauriPlugin
|
||||
import app.tauri.plugin.Invoke
|
||||
import app.tauri.plugin.JSArray
|
||||
import app.tauri.plugin.JSObject
|
||||
import app.tauri.plugin.Plugin
|
||||
import java.io.File
|
||||
import java.util.UUID
|
||||
@@ -17,12 +19,18 @@ import java.util.concurrent.Executors
|
||||
@InvokeArg
|
||||
class SettingArgs { lateinit var name: String; var value: Boolean = false }
|
||||
|
||||
@InvokeArg
|
||||
class IntervalArgs { var minutes: Int = 0 }
|
||||
|
||||
@InvokeArg
|
||||
class GalleryArgs { var offset: Int = 0; var limit: Int = 48 }
|
||||
|
||||
@InvokeArg
|
||||
class DeleteImageArgs { lateinit var id: String }
|
||||
|
||||
@InvokeArg
|
||||
class DeleteImagesArgs { var ids: Array<String> = emptyArray() }
|
||||
|
||||
@InvokeArg
|
||||
class ImageCropArgs {
|
||||
lateinit var id: String
|
||||
@@ -36,7 +44,10 @@ class ImageCropArgs {
|
||||
class WallpaperPlugin(private val activity: Activity) : Plugin(activity) {
|
||||
private val io = Executors.newSingleThreadExecutor()
|
||||
|
||||
@Command fun getState(invoke: Invoke) = io.execute { invoke.resolve(WallpaperStore.state(activity)) }
|
||||
@Command fun getState(invoke: Invoke) {
|
||||
if (WallpaperStore.enabled(activity)) runCatching { WallpaperRotationService.start(activity) }
|
||||
io.execute { invoke.resolve(WallpaperStore.state(activity)) }
|
||||
}
|
||||
|
||||
@Command fun getGallery(invoke: Invoke) = io.execute {
|
||||
try {
|
||||
@@ -63,6 +74,19 @@ class WallpaperPlugin(private val activity: Activity) : Plugin(activity) {
|
||||
} catch (error: Exception) { invoke.reject(error.message ?: "Bild konnte nicht gelöscht werden") }
|
||||
}
|
||||
|
||||
@Command fun getImageIds(invoke: Invoke) = io.execute {
|
||||
val ids = JSArray().apply { WallpaperStore.imageIds(activity).forEach { put(it) } }
|
||||
invoke.resolve(JSObject().apply { put("ids", ids) })
|
||||
}
|
||||
|
||||
@Command fun deleteImages(invoke: Invoke) = io.execute {
|
||||
try {
|
||||
val args = invoke.parseArgs(DeleteImagesArgs::class.java)
|
||||
if (WallpaperStore.deleteMany(activity, args.ids.toList()) == 0) throw IllegalArgumentException("Keine Bilder gefunden")
|
||||
invoke.resolve(WallpaperStore.state(activity))
|
||||
} catch (error: Exception) { invoke.reject(error.message ?: "Bilder konnten nicht gelöscht werden") }
|
||||
}
|
||||
|
||||
@Command fun setImageCrop(invoke: Invoke) = io.execute {
|
||||
try {
|
||||
val args = invoke.parseArgs(ImageCropArgs::class.java)
|
||||
@@ -96,13 +120,19 @@ class WallpaperPlugin(private val activity: Activity) : Plugin(activity) {
|
||||
try {
|
||||
val args = invoke.parseArgs(SettingArgs::class.java)
|
||||
WallpaperStore.set(activity, args.name, args.value)
|
||||
if (args.name == "enabled") {
|
||||
if (args.value) WallpaperRotationService.start(activity) else WallpaperRotationService.stop(activity)
|
||||
}
|
||||
invoke.resolve(WallpaperStore.state(activity))
|
||||
invoke.resolve(WallpaperStore.state(activity, includePreviews = false))
|
||||
} catch (error: Exception) { invoke.reject(error.message ?: "Einstellung konnte nicht gespeichert werden") }
|
||||
}
|
||||
|
||||
@Command fun setInterval(invoke: Invoke) {
|
||||
try {
|
||||
val args = invoke.parseArgs(IntervalArgs::class.java)
|
||||
WallpaperStore.setInterval(activity, args.minutes)
|
||||
if (args.minutes > 0) WallpaperRotationService.restart(activity) else WallpaperRotationService.stop(activity)
|
||||
invoke.resolve(WallpaperStore.state(activity, includePreviews = false))
|
||||
} catch (error: Exception) { invoke.reject(error.message ?: "Wechselintervall konnte nicht gespeichert werden") }
|
||||
}
|
||||
|
||||
@Command fun nextWallpaper(invoke: Invoke) = io.execute {
|
||||
if (WallpaperStore.applyNext(activity)) invoke.resolve(WallpaperStore.state(activity)) else invoke.reject("Bitte wähle zuerst Bilder aus")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user