SyncStateManager

Manages wallet synchronization state.

Purpose:

  • Track current sync progress (which event we're at)

  • Provide reactive sync progress updates

  • Determine when wallet is fully synced

Usage:

val syncManager = SyncStateManager()

// Update progress as events are processed
syncManager.updateProgress(currentEventId = 100, maxEventId = 1000)

// Observe sync progress in UI
syncManager.getSyncProgress().collect { progress ->
println("Sync: ${(progress * 100).toInt()}%")
}

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun getCurrentEventId(): Flow<Long>

Get current event ID.

Link copied to clipboard
fun getMaxEventId(): Flow<Long>

Get max event ID.

Link copied to clipboard
fun getSyncProgress(): Flow<Float>

Get current sync progress as percentage (0.0 to 1.0).

Link copied to clipboard
fun isFullySynced(): Flow<Boolean>

Check if wallet is fully synced.

Link copied to clipboard
fun reset()

Reset sync state.

Link copied to clipboard
fun updateProgress(currentEventId: Long, maxEventId: Long)

Update sync progress.