realm-kotlin icon indicating copy to clipboard operation
realm-kotlin copied to clipboard

SyncSession - ProgressListeners

Open sync-by-unito[bot] opened this issue 4 years ago • 2 comments

Implement relevant progress listener API's similar to Realm Java

enum class ProgressMode {
  CURRENT_CHANGES,
  INDEFINETELY
}

data class Progress(val transferredBytes: Long, val transferableBytes: Long) {
  val fractionTransferred: Double
  val transferComplete: Boolean
}
typealias ProgressListener = (progress: Progress) -> Unit

class SyncSession {
  fun addDownloadProgressListener(mode: ProgressMode, listener: ProgressListener): Cancellable 
 fun addUploadProgressListener(mode: ProgressMode, listener: ProgressListener): Cancellable
  fun uploadAllLocalChanges(timeout: Long = Long.MAX_VALUE, unit = TimeUnit.SECONDS)  
 fun downloadAllServerChanges(timeout: Long = Long.MAX_VALUE, unit = TimeUnit.SECONDS) 
}

sync-by-unito[bot] avatar Sep 02 '21 11:09 sync-by-unito[bot]

Are there any upcoming plans to have a ProgressListener available?

szyman avatar Jul 25 '22 09:07 szyman

Note, that progress listeners have issues on Flexible Sync Realms (cannot remember exactly what), so we need to figure out if we need to handle those kinds of Realms in a special way.

cmelchior avatar Sep 07 '22 07:09 cmelchior