Code review
This commit is contained in:
parent
6b05e7a6bb
commit
38fbfad8d5
|
@ -27,7 +27,10 @@ interface RoomCryptoService {
|
||||||
fun shouldEncryptForInvitedMembers(): Boolean
|
fun shouldEncryptForInvitedMembers(): Boolean
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable encryption of the room
|
* Enable encryption of the room.
|
||||||
|
* @param Use force to ensure that this algorithm will be used. Otherwise this call
|
||||||
|
* will throw if encryption is already setup or if the algorithm is not supported. Only to
|
||||||
|
* be used by admins to fix misconfigured encryption.
|
||||||
*/
|
*/
|
||||||
suspend fun enableEncryption(algorithm: String = MXCRYPTO_ALGORITHM_MEGOLM, force: Boolean = false)
|
suspend fun enableEncryption(algorithm: String = MXCRYPTO_ALGORITHM_MEGOLM, force: Boolean = false)
|
||||||
|
|
||||||
|
|
|
@ -43,10 +43,10 @@ sealed interface SendMode {
|
||||||
data class Voice(val text: String) : SendMode
|
data class Voice(val text: String) : SendMode
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class CanSendStatus {
|
sealed interface CanSendStatus {
|
||||||
object Allowed : CanSendStatus()
|
object Allowed : CanSendStatus
|
||||||
object NoPermission : CanSendStatus()
|
object NoPermission : CanSendStatus
|
||||||
data class UnSupportedE2eAlgorithm(val algorithm: String?) : CanSendStatus()
|
data class UnSupportedE2eAlgorithm(val algorithm: String?) : CanSendStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
fun CanSendStatus.boolean(): Boolean {
|
fun CanSendStatus.boolean(): Boolean {
|
||||||
|
|
|
@ -71,10 +71,10 @@ class RoomProfileViewModel @AssistedInject constructor(
|
||||||
observeRoomCreateContent(flowRoom)
|
observeRoomCreateContent(flowRoom)
|
||||||
observeBannedRoomMembers(flowRoom)
|
observeBannedRoomMembers(flowRoom)
|
||||||
observePermissions()
|
observePermissions()
|
||||||
obeservePowerLevels()
|
observePowerLevels()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun obeservePowerLevels() {
|
private fun observePowerLevels() {
|
||||||
val powerLevelsContentLive = PowerLevelsFlowFactory(room).createFlow()
|
val powerLevelsContentLive = PowerLevelsFlowFactory(room).createFlow()
|
||||||
powerLevelsContentLive
|
powerLevelsContentLive
|
||||||
.onEach {
|
.onEach {
|
||||||
|
@ -208,6 +208,7 @@ class RoomProfileViewModel @AssistedInject constructor(
|
||||||
room.enableEncryption(force = true)
|
room.enableEncryption(force = true)
|
||||||
} catch (failure: Throwable) {
|
} catch (failure: Throwable) {
|
||||||
Timber.e(failure, "Failed to restore encryption state in room ${room.roomId}")
|
Timber.e(failure, "Failed to restore encryption state in room ${room.roomId}")
|
||||||
|
_viewEvents.post(RoomProfileViewEvents.Failure(failure))
|
||||||
} finally {
|
} finally {
|
||||||
_viewEvents.post(RoomProfileViewEvents.DismissLoading)
|
_viewEvents.post(RoomProfileViewEvents.DismissLoading)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue