Use the new setIsFavorite api

This commit is contained in:
ganfra 2024-02-06 16:04:44 +01:00
parent d9017a098c
commit f3c1eb6738
7 changed files with 28 additions and 27 deletions

View file

@ -435,14 +435,9 @@ class RustMatrixRoom(
}
}
override suspend fun updateNotableTags(notableTags: RoomNotableTags): Result<Unit> = withContext(roomDispatcher) {
override suspend fun setIsFavorite(isFavorite: Boolean): Result<Unit> = withContext(roomDispatcher) {
runCatching {
Timber.i("Update notable tags with : $notableTags")
innerRoom.updateNotableTags(notableTags.map())
}.onFailure {
Timber.w("Failed to update notable tags: $it")
}.onSuccess {
Timber.i("Successfully updated notable tags")
innerRoom.setIsFavorite(isFavorite, null)
}
}

View file

@ -20,9 +20,11 @@ import io.element.android.libraries.matrix.api.room.tags.RoomNotableTags
import uniffi.matrix_sdk_base.RoomNotableTags as RustRoomNotableTags
fun RustRoomNotableTags.map() = RoomNotableTags(
isFavorite = isFavorite
isFavorite = isFavorite,
isLowPriority = isLowPriority
)
fun RoomNotableTags.map() = RustRoomNotableTags(
isFavorite = isFavorite
isFavorite = isFavorite,
isLowPriority = isLowPriority
)