MosaicNetwork
Functions
Link copied to clipboard
abstract suspend fun downloadFile(url: String, headers: Map<String, String>? = null, body: Any?, httpMethod: HttpMethod, targetFileName: String, mimeType: String? = null, onProgress: suspend (Float) -> Unit = {}, onDownloadFinished: suspend () -> Unit = {}, onDownloadFailure: suspend (Throwable) -> Unit = {}): Result<Unit>
Downloads a file into the device's public/general storage (system Downloads location). Behavior is platform-specific — see dev.catbit.mosaic.core.data.schemas.event.events.networking.DownloadFileEventSchema.
Link copied to clipboard
abstract suspend fun downloadFileToDisk(url: String, headers: Map<String, String>? = null, body: Any?, httpMethod: HttpMethod, targetFileName: String, onProgress: suspend (Float) -> Unit = {}, onDownloadFinished: suspend () -> Unit = {}, onDownloadFailure: suspend (Throwable) -> Unit = {}): Result<Unit>
Streams the response body straight to targetFileName, without ever holding the full file in memory.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Short-timeout version check meant to run before getInitialGraph at startup without blocking it.
Link copied to clipboard
Probes whether the device currently has an active internet connection by issuing a lightweight GET to a captive-portal-style endpoint. Any exception (no connection, DNS failure, timeout) is treated as "no connection" rather than propagated.
Link copied to clipboard
Link copied to clipboard
abstract suspend fun uploadFile(url: String?, headers: Map<String, String>? = null, httpMethod: HttpMethod, contentType: String?, platformFile: PlatformFile, onProgress: suspend (Float) -> Unit = {}): Result<UploadResult>