Coverage Summary for Class: HttpLogManagerImpl (dev.skymansandy.wiretap.domain.orchestrator)
| Class |
Method, %
|
Branch, %
|
Line, %
|
Instruction, %
|
| HttpLogManagerImpl |
100%
(13/13)
|
|
100%
(22/22)
|
100%
(168/168)
|
| HttpLogManagerImpl$clearHttpLogs$1 |
|
| HttpLogManagerImpl$deleteHttpLog$1 |
|
| HttpLogManagerImpl$logHttp$1 |
|
| HttpLogManagerImpl$logHttpAndGetId$1 |
|
| HttpLogManagerImpl$updateHttp$1 |
|
| Total |
100%
(13/13)
|
|
100%
(22/22)
|
100%
(168/168)
|
/*
* Copyright (c) 2026 skymansandy. All rights reserved.
*/
package dev.skymansandy.wiretap.domain.orchestrator
import androidx.paging.PagingData
import dev.skymansandy.wiretap.domain.model.HttpLog
import dev.skymansandy.wiretap.domain.model.HttpLogFilter
import dev.skymansandy.wiretap.domain.repository.HttpRepository
import dev.skymansandy.wiretap.helper.launcher.WiretapNotificationHook
import kotlinx.coroutines.flow.Flow
internal class HttpLogManagerImpl(
private val httpRepository: HttpRepository,
private val notificationHook: WiretapNotificationHook,
) : HttpLogManager {
override fun flowHttpLogs(): Flow<List<HttpLog>> = httpRepository.flowAll()
override fun flowDistinctHosts(): Flow<List<String>> = httpRepository.flowDistinctHosts()
override fun flowPagedHttpLogsForSearchQuery(
query: String,
filter: HttpLogFilter,
): Flow<PagingData<HttpLog>> = httpRepository.flowPagesLogs(query, filter)
override fun flowHttpLogById(id: Long): Flow<HttpLog?> = httpRepository.flowById(id)
override suspend fun logHttp(entry: HttpLog) {
httpRepository.save(entry)
notificationHook.onNewHttpLog(entry)
}
override suspend fun logHttpAndGetId(entry: HttpLog): Long {
val id = httpRepository.saveAndGetId(entry)
val entryWithId = entry.copy(id = id)
notificationHook.onNewHttpLog(entryWithId)
return id
}
override suspend fun updateHttp(entry: HttpLog) {
httpRepository.update(entry)
notificationHook.onNewHttpLog(entry)
}
override suspend fun getHttpLogById(id: Long): HttpLog? = httpRepository.getById(id)
override suspend fun deleteHttpLog(id: Long) {
httpRepository.deleteById(id)
notificationHook.onDeleteHttpLog(id)
}
override suspend fun clearHttpLogs() {
httpRepository.clearAll()
notificationHook.onClearHttpLogs()
}
override suspend fun purgeHttpLogsOlderThan(cutoffMs: Long) {
httpRepository.deleteOlderThan(cutoffMs)
}
override suspend fun markHttpCancelledIfInProgress(id: Long) {
httpRepository.markCancelledIfInProgress(id)
}
}