Add Capacitor Android project and native Tiptoi plugin
Checked-in android/ Capacitor project plus the native TiptoiPlugin (Kotlin): SAF directory picker for the pen, listing/copying/deleting .gme files on the pen, and downloading GME/cover files into app-private storage.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { registerPlugin } from '@capacitor/core'
|
||||
import type { PluginListenerHandle } from '@capacitor/core'
|
||||
|
||||
export interface CopyProgressEvent {
|
||||
filename: string
|
||||
bytes: number
|
||||
total: number
|
||||
}
|
||||
|
||||
export interface TiptoiPlugin {
|
||||
/** Öffnet Android-Verzeichnis-Picker (SAF) und persistiert die Berechtigung */
|
||||
requestPenAccess(): Promise<{ uri: string }>
|
||||
/** Gibt die zuletzt gespeicherte SAF-URI zurück */
|
||||
getPenUri(): Promise<{ uri: string | null }>
|
||||
/** Listet .gme-Dateien im gewählten Stift-Verzeichnis */
|
||||
listPenFiles(options: { uri: string }): Promise<{ files: string[] }>
|
||||
/** Kopiert eine Datei aus dem App-Cache auf den Stift */
|
||||
copyToPen(options: { uri: string; filename: string }): Promise<void>
|
||||
/** Listet heruntergeladene GME-Dateien im App-Cache */
|
||||
listDownloads(): Promise<{ books: Array<{ filename: string; coverPath: string | null; size: number }> }>
|
||||
/** Lädt eine GME-Datei von URL in den App-Cache */
|
||||
downloadGme(options: { url: string; filename: string }): Promise<{ filename: string }>
|
||||
/** Lädt ein Cover-Bild in den App-Cache (Fehler werden ignoriert) */
|
||||
downloadCover(options: { url: string; filename: string }): Promise<void>
|
||||
/** Löscht eine heruntergeladene GME-Datei (inkl. Cover) aus dem App-Cache */
|
||||
deleteDownload(options: { filename: string }): Promise<void>
|
||||
/** Löscht eine GME-Datei vom Stift */
|
||||
deletePenFile(options: { uri: string; filename: string }): Promise<void>
|
||||
/** Fortschritts-Events beim Kopieren auf den Stift */
|
||||
addListener(event: 'copyProgress', listener: (data: CopyProgressEvent) => void): Promise<PluginListenerHandle>
|
||||
}
|
||||
|
||||
export const Tiptoi = registerPlugin<TiptoiPlugin>('Tiptoi')
|
||||
Reference in New Issue
Block a user