mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +03:00
open room profile for admin when clicked on notification area for e2e pb
This commit is contained in:
parent
38fbfad8d5
commit
1fdb851845
6 changed files with 26 additions and 4 deletions
|
@ -25,6 +25,7 @@ import android.widget.LinearLayout
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.text.italic
|
import androidx.core.text.italic
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
|
import im.vector.app.core.epoxy.onClick
|
||||||
import im.vector.app.core.error.ResourceLimitErrorFormatter
|
import im.vector.app.core.error.ResourceLimitErrorFormatter
|
||||||
import im.vector.app.core.extensions.exhaustive
|
import im.vector.app.core.extensions.exhaustive
|
||||||
import im.vector.app.core.utils.DimensionConverter
|
import im.vector.app.core.utils.DimensionConverter
|
||||||
|
@ -115,6 +116,9 @@ class NotificationAreaView @JvmOverloads constructor(
|
||||||
+resources.getString(R.string.room_unsupported_e2e_algorithm)
|
+resources.getString(R.string.room_unsupported_e2e_algorithm)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
views.roomNotificationMessage.onClick {
|
||||||
|
delegate?.onMisconfiguredEncryptionClicked()
|
||||||
|
}
|
||||||
views.roomNotificationMessage.text = message
|
views.roomNotificationMessage.text = message
|
||||||
views.roomNotificationMessage.setTextColor(ThemeUtils.getColor(context, R.attr.vctr_content_secondary))
|
views.roomNotificationMessage.setTextColor(ThemeUtils.getColor(context, R.attr.vctr_content_secondary))
|
||||||
}
|
}
|
||||||
|
@ -193,5 +197,6 @@ class NotificationAreaView @JvmOverloads constructor(
|
||||||
*/
|
*/
|
||||||
interface Delegate {
|
interface Delegate {
|
||||||
fun onTombstoneEventClicked()
|
fun onTombstoneEventClicked()
|
||||||
|
fun onMisconfiguredEncryptionClicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ sealed class RoomDetailAction : VectorViewModelAction {
|
||||||
object MarkAllAsRead : RoomDetailAction()
|
object MarkAllAsRead : RoomDetailAction()
|
||||||
data class DownloadOrOpen(val eventId: String, val senderId: String?, val messageFileContent: MessageWithAttachmentContent) : RoomDetailAction()
|
data class DownloadOrOpen(val eventId: String, val senderId: String?, val messageFileContent: MessageWithAttachmentContent) : RoomDetailAction()
|
||||||
object JoinAndOpenReplacementRoom : RoomDetailAction()
|
object JoinAndOpenReplacementRoom : RoomDetailAction()
|
||||||
|
object OnClickMisconfiguredEncryption : RoomDetailAction()
|
||||||
object AcceptInvite : RoomDetailAction()
|
object AcceptInvite : RoomDetailAction()
|
||||||
object RejectInvite : RoomDetailAction()
|
object RejectInvite : RoomDetailAction()
|
||||||
|
|
||||||
|
|
|
@ -461,7 +461,8 @@ class RoomDetailFragment @Inject constructor(
|
||||||
is RoomDetailViewEvents.OpenRoom -> handleOpenRoom(it)
|
is RoomDetailViewEvents.OpenRoom -> handleOpenRoom(it)
|
||||||
RoomDetailViewEvents.OpenInvitePeople -> navigator.openInviteUsersToRoom(requireContext(), roomDetailArgs.roomId)
|
RoomDetailViewEvents.OpenInvitePeople -> navigator.openInviteUsersToRoom(requireContext(), roomDetailArgs.roomId)
|
||||||
RoomDetailViewEvents.OpenSetRoomAvatarDialog -> galleryOrCameraDialogHelper.show()
|
RoomDetailViewEvents.OpenSetRoomAvatarDialog -> galleryOrCameraDialogHelper.show()
|
||||||
RoomDetailViewEvents.OpenRoomSettings -> handleOpenRoomSettings()
|
RoomDetailViewEvents.OpenRoomSettings -> handleOpenRoomSettings(RoomProfileActivity.EXTRA_DIRECT_ACCESS_ROOM_SETTINGS)
|
||||||
|
RoomDetailViewEvents.OpenRoomProfile -> handleOpenRoomSettings()
|
||||||
is RoomDetailViewEvents.ShowRoomAvatarFullScreen -> it.matrixItem?.let { item ->
|
is RoomDetailViewEvents.ShowRoomAvatarFullScreen -> it.matrixItem?.let { item ->
|
||||||
navigator.openBigImageViewer(requireActivity(), it.view, item)
|
navigator.openBigImageViewer(requireActivity(), it.view, item)
|
||||||
}
|
}
|
||||||
|
@ -585,11 +586,11 @@ class RoomDetailFragment @Inject constructor(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleOpenRoomSettings() {
|
private fun handleOpenRoomSettings(directAccess: Int? = null) {
|
||||||
navigator.openRoomProfile(
|
navigator.openRoomProfile(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
roomDetailArgs.roomId,
|
roomDetailArgs.roomId,
|
||||||
RoomProfileActivity.EXTRA_DIRECT_ACCESS_ROOM_SETTINGS
|
directAccess
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -949,6 +950,10 @@ class RoomDetailFragment @Inject constructor(
|
||||||
override fun onTombstoneEventClicked() {
|
override fun onTombstoneEventClicked() {
|
||||||
roomDetailViewModel.handle(RoomDetailAction.JoinAndOpenReplacementRoom)
|
roomDetailViewModel.handle(RoomDetailAction.JoinAndOpenReplacementRoom)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onMisconfiguredEncryptionClicked() {
|
||||||
|
roomDetailViewModel.handle(RoomDetailAction.OnClickMisconfiguredEncryption)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ sealed class RoomDetailViewEvents : VectorViewEvents {
|
||||||
object OpenInvitePeople : RoomDetailViewEvents()
|
object OpenInvitePeople : RoomDetailViewEvents()
|
||||||
object OpenSetRoomAvatarDialog : RoomDetailViewEvents()
|
object OpenSetRoomAvatarDialog : RoomDetailViewEvents()
|
||||||
object OpenRoomSettings : RoomDetailViewEvents()
|
object OpenRoomSettings : RoomDetailViewEvents()
|
||||||
|
object OpenRoomProfile : RoomDetailViewEvents()
|
||||||
data class ShowRoomAvatarFullScreen(val matrixItem: MatrixItem?, val view: View?) : RoomDetailViewEvents()
|
data class ShowRoomAvatarFullScreen(val matrixItem: MatrixItem?, val view: View?) : RoomDetailViewEvents()
|
||||||
|
|
||||||
object ShowWaitingView : RoomDetailViewEvents()
|
object ShowWaitingView : RoomDetailViewEvents()
|
||||||
|
|
|
@ -211,11 +211,13 @@ class RoomDetailViewModel @AssistedInject constructor(
|
||||||
val canInvite = PowerLevelsHelper(it).isUserAbleToInvite(session.myUserId)
|
val canInvite = PowerLevelsHelper(it).isUserAbleToInvite(session.myUserId)
|
||||||
val isAllowedToManageWidgets = session.widgetService().hasPermissionsToHandleWidgets(room.roomId)
|
val isAllowedToManageWidgets = session.widgetService().hasPermissionsToHandleWidgets(room.roomId)
|
||||||
val isAllowedToStartWebRTCCall = PowerLevelsHelper(it).isUserAllowedToSend(session.myUserId, false, EventType.CALL_INVITE)
|
val isAllowedToStartWebRTCCall = PowerLevelsHelper(it).isUserAllowedToSend(session.myUserId, false, EventType.CALL_INVITE)
|
||||||
|
val isAllowedToSetupEncryption = PowerLevelsHelper(it).isUserAllowedToSend(session.myUserId, true, EventType.STATE_ROOM_ENCRYPTION)
|
||||||
setState {
|
setState {
|
||||||
copy(
|
copy(
|
||||||
canInvite = canInvite,
|
canInvite = canInvite,
|
||||||
isAllowedToManageWidgets = isAllowedToManageWidgets,
|
isAllowedToManageWidgets = isAllowedToManageWidgets,
|
||||||
isAllowedToStartWebRTCCall = isAllowedToStartWebRTCCall
|
isAllowedToStartWebRTCCall = isAllowedToStartWebRTCCall,
|
||||||
|
isAllowedToSetupEncryption = isAllowedToSetupEncryption
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}.launchIn(viewModelScope)
|
}.launchIn(viewModelScope)
|
||||||
|
@ -309,6 +311,7 @@ class RoomDetailViewModel @AssistedInject constructor(
|
||||||
is RoomDetailAction.DownloadOrOpen -> handleOpenOrDownloadFile(action)
|
is RoomDetailAction.DownloadOrOpen -> handleOpenOrDownloadFile(action)
|
||||||
is RoomDetailAction.NavigateToEvent -> handleNavigateToEvent(action)
|
is RoomDetailAction.NavigateToEvent -> handleNavigateToEvent(action)
|
||||||
is RoomDetailAction.JoinAndOpenReplacementRoom -> handleJoinAndOpenReplacementRoom()
|
is RoomDetailAction.JoinAndOpenReplacementRoom -> handleJoinAndOpenReplacementRoom()
|
||||||
|
is RoomDetailAction.OnClickMisconfiguredEncryption -> handleClickMisconfiguredE2E()
|
||||||
is RoomDetailAction.ResendMessage -> handleResendEvent(action)
|
is RoomDetailAction.ResendMessage -> handleResendEvent(action)
|
||||||
is RoomDetailAction.RemoveFailedEcho -> handleRemove(action)
|
is RoomDetailAction.RemoveFailedEcho -> handleRemove(action)
|
||||||
is RoomDetailAction.MarkAllAsRead -> handleMarkAllAsRead()
|
is RoomDetailAction.MarkAllAsRead -> handleMarkAllAsRead()
|
||||||
|
@ -614,6 +617,12 @@ class RoomDetailViewModel @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun handleClickMisconfiguredE2E() = withState { state ->
|
||||||
|
if (state.isAllowedToSetupEncryption) {
|
||||||
|
_viewEvents.post(RoomDetailViewEvents.OpenRoomProfile)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun isIntegrationEnabled() = session.integrationManagerService().isIntegrationEnabled()
|
private fun isIntegrationEnabled() = session.integrationManagerService().isIntegrationEnabled()
|
||||||
|
|
||||||
fun isMenuItemVisible(@IdRes itemId: Int): Boolean = com.airbnb.mvrx.withState(this) { state ->
|
fun isMenuItemVisible(@IdRes itemId: Int): Boolean = com.airbnb.mvrx.withState(this) { state ->
|
||||||
|
|
|
@ -64,6 +64,7 @@ data class RoomDetailViewState(
|
||||||
val canInvite: Boolean = true,
|
val canInvite: Boolean = true,
|
||||||
val isAllowedToManageWidgets: Boolean = false,
|
val isAllowedToManageWidgets: Boolean = false,
|
||||||
val isAllowedToStartWebRTCCall: Boolean = true,
|
val isAllowedToStartWebRTCCall: Boolean = true,
|
||||||
|
val isAllowedToSetupEncryption: Boolean = true,
|
||||||
val hasFailedSending: Boolean = false,
|
val hasFailedSending: Boolean = false,
|
||||||
val jitsiState: JitsiState = JitsiState()
|
val jitsiState: JitsiState = JitsiState()
|
||||||
) : MavericksState {
|
) : MavericksState {
|
||||||
|
|
Loading…
Reference in a new issue