From d6ea5648b66354b015df943e89bc6731a53aaef0 Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Tue, 1 Dec 2020 11:21:25 +0100 Subject: [PATCH] Re-arrange room profile - Show encryption status also in easy mode again - Move encryption action down - it's a one-time action and not important enough to show prevalent on top - Hide encryption action if permission missing - TODO: hide encryption action when it's a public room (it's already hidden on room creation in that case) Change-Id: I544704191fd7e3573ef35fa9de2f7023a01c4a04 --- .../roomprofile/RoomProfileController.kt | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileController.kt b/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileController.kt index 26109bfdfd..a6434d51fe 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileController.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileController.kt @@ -77,25 +77,22 @@ class RoomProfileController @Inject constructor( } // Security - if (enableNonSimplifiedMode) { - buildProfileSection(stringProvider.getString(R.string.room_profile_section_security)) - val learnMoreSubtitle = if (roomSummary.isEncrypted) { - if (roomSummary.isDirect) R.string.direct_room_profile_encrypted_subtitle else R.string.room_profile_encrypted_subtitle - } else { - if (roomSummary.isDirect) R.string.direct_room_profile_not_encrypted_subtitle else R.string.room_profile_not_encrypted_subtitle - } - genericFooterItem { - id("e2e info") - centered(false) - text(stringProvider.getString(learnMoreSubtitle)) - } - buildEncryptionAction(data.actionPermissions, roomSummary) + buildProfileSection(stringProvider.getString(R.string.room_profile_section_security)) + val learnMoreSubtitle = if (roomSummary.isEncrypted) { + if (roomSummary.isDirect) R.string.direct_room_profile_encrypted_subtitle else R.string.room_profile_encrypted_subtitle + } else { + if (roomSummary.isDirect) R.string.direct_room_profile_not_encrypted_subtitle else R.string.room_profile_not_encrypted_subtitle } + genericFooterItem { + id("e2e info") + centered(false) + text(stringProvider.getString(learnMoreSubtitle)) + } + // SC: Move down in the list, this one-time action is not important to enough to show this prevalent at the top + //buildEncryptionAction(data.actionPermissions, roomSummary) - // More | category header only if displaying other sections above - if (enableNonSimplifiedMode || roomSummary.topic.isNotEmpty()) { - buildProfileSection(stringProvider.getString(R.string.room_profile_section_more)) - } + // More + buildProfileSection(stringProvider.getString(R.string.room_profile_section_more)) buildProfileAction( id = "settings", title = stringProvider.getString(if (roomSummary.isDirect) { @@ -151,6 +148,9 @@ class RoomProfileController @Inject constructor( action = { callback?.createShortcut() } ) } + if (enableNonSimplifiedMode) { + buildEncryptionAction(data.actionPermissions, roomSummary) + } buildProfileAction( id = "leave", title = stringProvider.getString(if (roomSummary.isDirect) { @@ -193,6 +193,7 @@ class RoomProfileController @Inject constructor( editable = false, action = { callback?.onEnableEncryptionClicked() } ) + /* SC: disable useless button } else { buildProfileAction( id = "enableEncryption", @@ -202,6 +203,7 @@ class RoomProfileController @Inject constructor( divider = false, editable = false ) + */ } } }