1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

DROID-2795 Date as an object | Move to bin by right-to-left swipe (#1883)

This commit is contained in:
Konstantin Ivanov 2024-12-07 15:57:35 +01:00 committed by GitHub
parent cc970f3a3f
commit c0439ba497
Signed by: github
GPG key ID: B5690EEEBB952194
11 changed files with 262 additions and 14 deletions

View file

@ -656,9 +656,22 @@ class CollectionViewModel(
}
private fun changeObjectListBinStatus(ids: List<Id>, isArchived: Boolean) {
launch {
setObjectListIsArchived.stream(SetObjectListIsArchived.Params(ids, isArchived))
.collect { it.progressiveFold() }
viewModelScope.launch {
val params = SetObjectListIsArchived.Params(ids, isArchived)
setObjectListIsArchived.async(params)
.fold(
onSuccess = {
if (isArchived) {
toasts.emit("Objects moved to bin")
} else {
toasts.emit("Objects restored")
}
},
onFailure = {
toasts.emit("Error while moving files to bin")
Timber.e(it, "Error while moving files to bin")
}
)
}
}