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:
parent
28eac0e5f2
commit
fc9cbdc8ac
5 changed files with 25 additions and 3 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue