Created
September 15, 2021 10:19
-
-
Save Priyansh-Kedia/2567421d248f8d0b7f2f62f6b2e842ba to your computer and use it in GitHub Desktop.
Observing file upload status RxJava
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LiveSubject.FILE_UPLOAD_FILE.subscribe({ | |
when(it) { | |
is UploadFileStatus.Complete -> { | |
Glide.with(this).load(it.s3Url).into(image) | |
toast("Uploaded image") | |
logD("complete upload") | |
} | |
is UploadFileStatus.Error -> { | |
logE("could not upload") | |
} | |
is UploadFileStatus.FileStatus -> { | |
logV("status is ${it.status}") | |
progress.progress = it.status | |
} | |
is UploadFileStatus.Start -> { | |
logD("Upload started") | |
} | |
} | |
}, { | |
logE("Rx threw error, error $it ${it.printStackTrace()}") | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment