WidgetFeedStorage

Platform filesystem operations for the generation-versioned export. Implement it yourself for a custom location; the defaults are AndroidWidgetFeedStorage and IosWidgetFeedStorage.

Contract for readGenerationCandidates order: pointer current, then pointer previous in order, then every other non-temp generation directory sorted descending by id. Unsafe ids and directories without feed.json are skipped. Never throws for corrupt files.

Inheritors

AndroidWidgetFeedStorage
IosWidgetFeedStorage

Functions

Link copied to clipboard
abstract fun assetPath(generationDirectory: String, fileName: String): String?

Absolute path of assets/<fileName> inside generationDirectory, or null when unsafe or missing.

Link copied to clipboard
abstract fun clear()

Removes every generation and the pointer.

Link copied to clipboard
Link copied to clipboard
abstract fun writeGeneration(generationId: String, feedBytes: ByteArray, assets: List<WidgetAsset>, keepPrevious: Int)

Writes a complete generation, promotes it atomically, updates the pointer, prunes to keepPrevious old ones.