diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/crypto/RoomCryptoService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/crypto/RoomCryptoService.kt index 6d7dffb441..445d16b72b 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/crypto/RoomCryptoService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/crypto/RoomCryptoService.kt @@ -27,7 +27,10 @@ interface RoomCryptoService { 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) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerViewState.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerViewState.kt index edaa82165e..915e1b3338 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerViewState.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerViewState.kt @@ -43,10 +43,10 @@ sealed interface SendMode { data class Voice(val text: String) : SendMode } -sealed class CanSendStatus { - object Allowed : CanSendStatus() - object NoPermission : CanSendStatus() - data class UnSupportedE2eAlgorithm(val algorithm: String?) : CanSendStatus() +sealed interface CanSendStatus { + object Allowed : CanSendStatus + object NoPermission : CanSendStatus + data class UnSupportedE2eAlgorithm(val algorithm: String?) : CanSendStatus } fun CanSendStatus.boolean(): Boolean { diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileViewModel.kt b/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileViewModel.kt index 52f9187fff..363cb1ea31 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileViewModel.kt @@ -71,10 +71,10 @@ class RoomProfileViewModel @AssistedInject constructor( observeRoomCreateContent(flowRoom) observeBannedRoomMembers(flowRoom) observePermissions() - obeservePowerLevels() + observePowerLevels() } - private fun obeservePowerLevels() { + private fun observePowerLevels() { val powerLevelsContentLive = PowerLevelsFlowFactory(room).createFlow() powerLevelsContentLive .onEach { @@ -208,6 +208,7 @@ class RoomProfileViewModel @AssistedInject constructor( room.enableEncryption(force = true) } catch (failure: Throwable) { Timber.e(failure, "Failed to restore encryption state in room ${room.roomId}") + _viewEvents.post(RoomProfileViewEvents.Failure(failure)) } finally { _viewEvents.post(RoomProfileViewEvents.DismissLoading) }