misc(power level) : use new api
This commit is contained in:
parent
44535243ef
commit
d654280e30
29 changed files with 312 additions and 334 deletions
|
|
@ -34,6 +34,8 @@ import io.element.android.libraries.core.bool.orFalse
|
|||
import io.element.android.libraries.matrix.api.MatrixClient
|
||||
import io.element.android.libraries.matrix.api.core.RoomId
|
||||
import io.element.android.libraries.matrix.api.core.UserId
|
||||
import io.element.android.libraries.matrix.api.room.powerlevels.canCall
|
||||
import io.element.android.libraries.matrix.api.room.powerlevels.use
|
||||
import io.element.android.libraries.matrix.api.user.MatrixUser
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
|
|
@ -56,7 +58,7 @@ class UserProfilePresenter(
|
|||
|
||||
@Composable
|
||||
private fun getDmRoomId(): State<RoomId?> {
|
||||
return produceState<RoomId?>(initialValue = null) {
|
||||
return produceState(initialValue = null) {
|
||||
value = client.findDM(userId).getOrNull()
|
||||
}
|
||||
}
|
||||
|
|
@ -66,7 +68,6 @@ class UserProfilePresenter(
|
|||
val isElementCallAvailable by produceState(initialValue = false, roomId) {
|
||||
value = sessionEnterpriseService.isElementCallAvailable()
|
||||
}
|
||||
|
||||
return produceState(initialValue = false, isElementCallAvailable, roomId) {
|
||||
value = when {
|
||||
isElementCallAvailable.not() -> false
|
||||
|
|
@ -75,7 +76,7 @@ class UserProfilePresenter(
|
|||
roomId
|
||||
?.let { client.getRoom(it) }
|
||||
?.use { room ->
|
||||
room.canUserJoinCall(client.sessionId).getOrNull()
|
||||
room.roomPermissions().use(false){ perms -> perms.canCall()}
|
||||
}
|
||||
.orFalse()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue