Coverage Summary for Class: SyncVersionGateImpl (com.georgeci.moneysurfer.data.sync)
| Class |
Method, %
|
Branch, %
|
Line, %
|
Instruction, %
|
| SyncVersionGateImpl |
100%
(3/3)
|
100%
(4/4)
|
100%
(8/8)
|
100%
(46/46)
|
| SyncVersionGateImpl$refresh$1 |
|
| Total |
100%
(3/3)
|
100%
(4/4)
|
100%
(8/8)
|
100%
(46/46)
|
package com.georgeci.moneysurfer.data.sync
import com.georgeci.moneysurfer.domain.model.AppVersionStatus
import com.georgeci.moneysurfer.domain.repositories.AppVersionGate
import com.georgeci.moneysurfer.sync.version.SyncVersionGate
import com.georgeci.moneysurfer.sync.version.SyncVersionStatus
import org.koin.core.annotation.Single
/**
* Adapter: maps [AppVersionGate] (domain) → [SyncVersionGate] (sync engine).
* Lives in `:sync-impl` so the engine module stays domain-free.
*/
@Single(binds = [SyncVersionGate::class])
class SyncVersionGateImpl(
private val appVersionGate: AppVersionGate,
) : SyncVersionGate {
override suspend fun refresh(): SyncVersionStatus = when (val s = appVersionGate.refresh()) {
AppVersionStatus.Supported,
is AppVersionStatus.UpdateAvailable,
-> SyncVersionStatus.Allowed
is AppVersionStatus.Unsupported -> SyncVersionStatus.Blocked(s.message)
}
override fun isSyncAllowed(): Boolean = appVersionGate.isSyncAllowed()
}