PowerLevel: use new api exposed from rust which doesn't need to load members.
This commit is contained in:
parent
1a9f0732e1
commit
e00462900e
10 changed files with 74 additions and 37 deletions
|
|
@ -21,11 +21,12 @@ import androidx.compose.runtime.State
|
|||
import androidx.compose.runtime.produceState
|
||||
import io.element.android.libraries.matrix.api.room.MatrixRoom
|
||||
import io.element.android.libraries.matrix.api.room.MessageEventType
|
||||
import io.element.android.libraries.matrix.api.room.powerlevels.canSendMessage
|
||||
|
||||
@Composable
|
||||
fun MatrixRoom.canSendEventAsState(type: MessageEventType, updateKey: Long): State<Boolean> {
|
||||
fun MatrixRoom.canSendMessageAsState(type: MessageEventType, updateKey: Long): State<Boolean> {
|
||||
return produceState(initialValue = true, key1 = updateKey) {
|
||||
value = canSendEvent(type).getOrElse { true }
|
||||
value = canSendMessage(type).getOrElse { true }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue