MTOfflinePack

Represents a downloadable offline region.

Types

Properties

Optional custom data, typically used to store application-specific context (e.g. JSON data).

The date when the pack expires.

val id: String

The unique identifier of the pack.

Returns true if the pack has passed its expiration date.

Returns true if the pack is beyond its grace period.

The metadata object linking state and region.

The current progress of the pack download.

A Kotlin Flow emitting the current progress of the pack download.

The region definition of the pack.

The current state of the pack download.

A Kotlin Flow emitting the current state of the pack download.

Functions

fun cancel()

Cancels the ongoing download.

suspend fun download(useBackground: Boolean = false)

Starts the download process for this pack. This generates the necessary manifest based on the pack's region definition and then begins downloading all required resources.

fun pause()

Pauses the ongoing download.

suspend fun refresh(useBackground: Boolean = false)

Refreshes an expired pack, validating or updating its resources and resetting its expiration limit.

suspend fun remove()

Deletes the offline pack. This stops any ongoing downloads and removes all associated files and metadata from disk.

suspend fun resume(useBackground: Boolean = false)

Resumes a previously paused or failed download.