From 9eab1acf1e6ed3441c89ea476f4f6134e36135fe Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 1 Jul 2020 13:55:34 +0200 Subject: [PATCH 1/3] Allow clear text communication (to use local synapse) --- .../im/vector/matrix/android/internal/network/ssl/CertUtil.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/network/ssl/CertUtil.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/network/ssl/CertUtil.kt index 4945afa93c..e375c3d364 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/network/ssl/CertUtil.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/network/ssl/CertUtil.kt @@ -252,7 +252,8 @@ internal object CertUtil { builder.supportsTlsExtensions(hsConfig.shouldAcceptTlsExtensions) val list = ArrayList() list.add(builder.build()) - if (hsConfig.allowHttpExtension) { + // TODO: we should display a warning if user enter an http url + if (hsConfig.allowHttpExtension || hsConfig.homeServerUri.toString().startsWith("http://")) { list.add(ConnectionSpec.CLEARTEXT) } return list From 53053d8f4a83af1663ef6d0742e4abfc9fec0bc1 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 1 Jul 2020 14:03:30 +0200 Subject: [PATCH 2/3] Fix layout overlap issue (#1407) --- CHANGES.md | 1 + vector/src/main/res/layout/item_form_switch.xml | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 207d04d6d0..0d59ad563b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -21,6 +21,7 @@ Bugfix 🐛: - Use vendor prefix for non merged MSC (#1537) - Compress images before sending (#1333) - Searching by displayname is case sensitive (#1468) + - Fix layout overlap issue (#1407) Translations 🗣: - diff --git a/vector/src/main/res/layout/item_form_switch.xml b/vector/src/main/res/layout/item_form_switch.xml index 63004365dc..d4fdaae35c 100644 --- a/vector/src/main/res/layout/item_form_switch.xml +++ b/vector/src/main/res/layout/item_form_switch.xml @@ -30,13 +30,13 @@ @@ -46,7 +46,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="19dp" - android:layout_marginRight="19dp" app:layout_constraintBottom_toTopOf="@+id/formSwitchDivider" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> From f8e35da53300b0d57529439b0721cd68cf6b162a Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 1 Jul 2020 14:52:37 +0200 Subject: [PATCH 3/3] Render room avatar change (#1319) --- CHANGES.md | 1 + .../room/summary/RoomSummaryUpdater.kt | 1 + .../src/main/res/values/strings.xml | 4 ++++ .../action/MessageActionsViewModel.kt | 1 + .../timeline/factory/TimelineItemFactory.kt | 1 + .../timeline/format/NoticeEventFormatter.kt | 20 +++++++++++++++++++ .../helper/TimelineDisplayableEvents.kt | 1 + 7 files changed, 29 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 0d59ad563b..1bf0344f9d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,6 +13,7 @@ Improvements 🙌: - Update user avatar (#1054) - Allow self-signed certificate (#1564) - Improve file download and open in timeline + - Render room avatar change (#1319) Bugfix 🐛: - Fix dark theme issue on login screen (#1097) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/summary/RoomSummaryUpdater.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/summary/RoomSummaryUpdater.kt index fad9938387..ea2948c11f 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/summary/RoomSummaryUpdater.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/summary/RoomSummaryUpdater.kt @@ -65,6 +65,7 @@ internal class RoomSummaryUpdater @Inject constructor( EventType.MESSAGE, EventType.STATE_ROOM_NAME, EventType.STATE_ROOM_TOPIC, + EventType.STATE_ROOM_AVATAR, EventType.STATE_ROOM_MEMBER, EventType.STATE_ROOM_HISTORY_VISIBILITY, EventType.CALL_INVITE, diff --git a/matrix-sdk-android/src/main/res/values/strings.xml b/matrix-sdk-android/src/main/res/values/strings.xml index 4e8e5abc96..9b7fa01eaf 100644 --- a/matrix-sdk-android/src/main/res/values/strings.xml +++ b/matrix-sdk-android/src/main/res/values/strings.xml @@ -37,6 +37,8 @@ You removed your display name (it was %1$s) %1$s changed the topic to: %2$s You changed the topic to: %1$s + %1$s changed the room avatar + You changed the room avatar %1$s changed the room name to: %2$s You changed the room name to: %1$s %s placed a video call. @@ -71,6 +73,8 @@ You removed the room name %1$s removed the room topic You removed the room topic + %1$s removed the room avatar + You removed the room avatar Message removed Message removed by %1$s Message removed [reason: %1$s] diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/action/MessageActionsViewModel.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/action/MessageActionsViewModel.kt index 6c192105d7..a50d748f93 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/action/MessageActionsViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/action/MessageActionsViewModel.kt @@ -179,6 +179,7 @@ class MessageActionsViewModel @AssistedInject constructor(@Assisted } EventType.STATE_ROOM_NAME, EventType.STATE_ROOM_TOPIC, + EventType.STATE_ROOM_AVATAR, EventType.STATE_ROOM_MEMBER, EventType.STATE_ROOM_ALIASES, EventType.STATE_ROOM_CANONICAL_ALIAS, diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/TimelineItemFactory.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/TimelineItemFactory.kt index 462caf8e97..22fd4eb5ec 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/TimelineItemFactory.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/TimelineItemFactory.kt @@ -48,6 +48,7 @@ class TimelineItemFactory @Inject constructor(private val messageItemFactory: Me EventType.STATE_ROOM_TOMBSTONE, EventType.STATE_ROOM_NAME, EventType.STATE_ROOM_TOPIC, + EventType.STATE_ROOM_AVATAR, EventType.STATE_ROOM_MEMBER, EventType.STATE_ROOM_ALIASES, EventType.STATE_ROOM_CANONICAL_ALIAS, diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/format/NoticeEventFormatter.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/format/NoticeEventFormatter.kt index 89e170e25e..c1f4187e0b 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/format/NoticeEventFormatter.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/format/NoticeEventFormatter.kt @@ -24,6 +24,7 @@ import im.vector.matrix.android.api.session.room.model.GuestAccess import im.vector.matrix.android.api.session.room.model.Membership import im.vector.matrix.android.api.session.room.model.PowerLevelsContent import im.vector.matrix.android.api.session.room.model.RoomAliasesContent +import im.vector.matrix.android.api.session.room.model.RoomAvatarContent import im.vector.matrix.android.api.session.room.model.RoomCanonicalAliasContent import im.vector.matrix.android.api.session.room.model.RoomGuestAccessContent import im.vector.matrix.android.api.session.room.model.RoomHistoryVisibilityContent @@ -57,6 +58,7 @@ class NoticeEventFormatter @Inject constructor(private val sessionHolder: Active EventType.STATE_ROOM_CREATE -> formatRoomCreateEvent(timelineEvent.root) EventType.STATE_ROOM_NAME -> formatRoomNameEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName) EventType.STATE_ROOM_TOPIC -> formatRoomTopicEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName) + EventType.STATE_ROOM_AVATAR -> formatRoomAvatarEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName) EventType.STATE_ROOM_MEMBER -> formatRoomMemberEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName) EventType.STATE_ROOM_ALIASES -> formatRoomAliasesEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName) EventType.STATE_ROOM_CANONICAL_ALIAS -> formatRoomCanonicalAliasEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName) @@ -149,6 +151,7 @@ class NoticeEventFormatter @Inject constructor(private val sessionHolder: Active EventType.STATE_ROOM_JOIN_RULES -> formatJoinRulesEvent(event, senderName) EventType.STATE_ROOM_NAME -> formatRoomNameEvent(event, senderName) EventType.STATE_ROOM_TOPIC -> formatRoomTopicEvent(event, senderName) + EventType.STATE_ROOM_AVATAR -> formatRoomAvatarEvent(event, senderName) EventType.STATE_ROOM_MEMBER -> formatRoomMemberEvent(event, senderName) EventType.STATE_ROOM_HISTORY_VISIBILITY -> formatRoomHistoryVisibilityEvent(event, senderName) EventType.CALL_INVITE, @@ -220,6 +223,23 @@ class NoticeEventFormatter @Inject constructor(private val sessionHolder: Active } } + private fun formatRoomAvatarEvent(event: Event, senderName: String?): CharSequence? { + val content = event.getClearContent().toModel() ?: return null + return if (content.avatarUrl.isNullOrEmpty()) { + if (event.isSentByCurrentUser()) { + sp.getString(R.string.notice_room_avatar_removed_by_you) + } else { + sp.getString(R.string.notice_room_avatar_removed, senderName) + } + } else { + if (event.isSentByCurrentUser()) { + sp.getString(R.string.notice_room_avatar_changed_by_you) + } else { + sp.getString(R.string.notice_room_avatar_changed, senderName) + } + } + } + private fun formatRoomHistoryVisibilityEvent(event: Event, senderName: String?): CharSequence? { val historyVisibility = event.getClearContent().toModel()?.historyVisibility ?: return null diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/helper/TimelineDisplayableEvents.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/helper/TimelineDisplayableEvents.kt index 882d8e8869..62a835ee8e 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/helper/TimelineDisplayableEvents.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/helper/TimelineDisplayableEvents.kt @@ -28,6 +28,7 @@ object TimelineDisplayableEvents { EventType.STATE_ROOM_WIDGET, EventType.STATE_ROOM_NAME, EventType.STATE_ROOM_TOPIC, + EventType.STATE_ROOM_AVATAR, EventType.STATE_ROOM_MEMBER, EventType.STATE_ROOM_ALIASES, EventType.STATE_ROOM_CANONICAL_ALIAS,