Skip to content

Instantly share code, notes, and snippets.

@lordcodes
Created February 25, 2020 20:22
Show Gist options
  • Save lordcodes/0090ef42c8260e89327f04fca876c9a8 to your computer and use it in GitHub Desktop.
Save lordcodes/0090ef42c8260e89327f04fca876c9a8 to your computer and use it in GitHub Desktop.
Code for the article: "Uploading a file with progress in Kotlin"
uploader.uploadAttachment(request.filename, request.file, request.mimeType)
.subscribeOn(appRxSchedulers.io)
.observeOn(appRxSchedulers.main)
.subscribeBy(
onError = { error ->
// Display error alert
},
onComplete = {
// Display completed Snackbar
},
onNext = { progress ->
// Update progress bar
}
)
.addTo(disposeBag)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment