1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-10 18:10:44 +09:00

Fix/upload image for document loading state (#765)

This commit is contained in:
Evgenii Kozlov 2020-09-01 19:02:59 +03:00 committed by GitHub
parent 28eac0e5f2
commit fc9cbdc8ac
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 3 deletions

View file

@ -31,6 +31,7 @@ class DocumentIconActionMenuViewModel(
when {
state.error != null -> ViewState.Error(state.error)
state.isCompleted -> ViewState.Exit
state.isUploading -> ViewState.Uploading
else -> ViewState.Idle
}
}
@ -91,6 +92,7 @@ class DocumentIconActionMenuViewModel(
sealed class ViewState {
object Loading : ViewState()
object Uploading : ViewState()
object Exit : ViewState()
object Idle : ViewState()
data class Error(val message: String) : ViewState()
@ -124,6 +126,7 @@ class DocumentIconActionMenuViewModel(
data class State(
val isLoading: Boolean,
val isUploading: Boolean = false,
val isCompleted: Boolean = false,
val error: String? = null
) : Contract() {
@ -200,7 +203,8 @@ class DocumentIconActionMenuViewModel(
}
is Event.OnImagePickedFromGallery -> {
state.copy(
isLoading = true
isUploading = true,
isLoading = false,
).also {
actions.send(
Action.SetImageIcon(