Skip to content

Commit

Permalink
Merge branch 'develop' into feature/bma/fix_3245
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarty committed May 2, 2021
2 parents 80d2ff5 + c9abdb5 commit ae668b0
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Improvements 🙌:
- Add ability to install APK from directly from Element (#2381)
- Compress video before sending (#442)
- Improve file too big error detection (#3245)
- Delete and react to stickers (#3250)

Bugfix 🐛:
- Message states cosmetic changes (#3007)
Expand All @@ -17,6 +18,8 @@ Bugfix 🐛:
- Fix issues on Android 11 (#3067)
- Fix issue when opening encrypted files (#3186)
- Fix wording issue (#3242)
- Fix missing sender information after edits (#3184)
- Fix read marker not updating automatically (#3267)

Translations 🗣:
-
Expand All @@ -40,6 +43,7 @@ git branch -u origin/main main
# And optionally
git remote prune origin
```
- Allow cleartext (non-SSL) connections to Matrix servers on LAN hosts (#3166)

Changes in Element 1.1.6 (2021-04-16)
===================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import org.matrix.android.sdk.api.session.events.model.Event
import org.matrix.android.sdk.api.session.events.model.EventType
import org.matrix.android.sdk.api.session.events.model.RelationType
import org.matrix.android.sdk.api.session.events.model.getRelationContent
import org.matrix.android.sdk.api.session.events.model.isEdition
import org.matrix.android.sdk.api.session.events.model.isReply
import org.matrix.android.sdk.api.session.events.model.toModel
import org.matrix.android.sdk.api.session.room.model.EventAnnotationsSummary
Expand Down Expand Up @@ -151,6 +152,10 @@ fun TimelineEvent.isReply(): Boolean {
return root.isReply()
}

fun TimelineEvent.isEdition(): Boolean {
return root.isEdition()
}

fun TimelineEvent.getTextEditableContent(): String? {
val lastContent = getLastMessageContent()
return if (isReply()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import org.matrix.android.sdk.api.session.room.send.SendState
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent

fun TimelineEvent.canReact(): Boolean {
// Only event of type Event.EVENT_TYPE_MESSAGE are supported for the moment
return root.getClearType() == EventType.MESSAGE && root.sendState == SendState.SYNCED && !root.isRedacted()
// Only event of type EventType.MESSAGE or EventType.STICKER are supported for the moment
return root.getClearType() in listOf(EventType.MESSAGE, EventType.STICKER)
&& root.sendState == SendState.SYNCED
&& !root.isRedacted()
}
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ class RoomDetailViewModel @AssistedInject constructor(
private fun stopTrackingUnreadMessages() {
if (trackUnreadMessages.getAndSet(false)) {
mostRecentDisplayedEvent?.root?.eventId?.also {
viewModelScope.launch {
session.coroutineScope.launch {
tryOrNull { room.setReadMarker(it) }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ class MessageActionsViewModel @AssistedInject constructor(@Assisted
}

private fun canReply(event: TimelineEvent, messageContent: MessageContent?, actionPermissions: ActionPermissions): Boolean {
// Only event of type Event.EVENT_TYPE_MESSAGE are supported for the moment
// Only event of type EventType.MESSAGE are supported for the moment
if (event.root.getClearType() != EventType.MESSAGE) return false
if (!actionPermissions.canSendMessage) return false
return when (messageContent?.msgType) {
Expand All @@ -410,7 +410,7 @@ class MessageActionsViewModel @AssistedInject constructor(@Assisted
}

private fun canQuote(event: TimelineEvent, messageContent: MessageContent?, actionPermissions: ActionPermissions): Boolean {
// Only event of type Event.EVENT_TYPE_MESSAGE are supported for the moment
// Only event of type EventType.MESSAGE are supported for the moment
if (event.root.getClearType() != EventType.MESSAGE) return false
if (!actionPermissions.canSendMessage) return false
return when (messageContent?.msgType) {
Expand All @@ -425,8 +425,8 @@ class MessageActionsViewModel @AssistedInject constructor(@Assisted
}

private fun canRedact(event: TimelineEvent, actionPermissions: ActionPermissions): Boolean {
// Only event of type Event.EVENT_TYPE_MESSAGE are supported for the moment
if (event.root.getClearType() != EventType.MESSAGE) return false
// Only event of type EventType.MESSAGE or EventType.STICKER are supported for the moment
if (event.root.getClearType() !in listOf(EventType.MESSAGE, EventType.STICKER)) return false
// Message sent by the current user can always be redacted
if (event.root.senderId == session.myUserId) return true
// Check permission for messages sent by other users
Expand All @@ -440,14 +440,13 @@ class MessageActionsViewModel @AssistedInject constructor(@Assisted
}

private fun canViewReactions(event: TimelineEvent): Boolean {
// Only event of type Event.EVENT_TYPE_MESSAGE are supported for the moment
if (event.root.getClearType() != EventType.MESSAGE) return false
// TODO if user is admin or moderator
// Only event of type EventType.MESSAGE and EventType.STICKER are supported for the moment
if (event.root.getClearType() !in listOf(EventType.MESSAGE, EventType.STICKER)) return false
return event.annotations?.reactionsSummary?.isNotEmpty() ?: false
}

private fun canEdit(event: TimelineEvent, myUserId: String, actionPermissions: ActionPermissions): Boolean {
// Only event of type Event.EVENT_TYPE_MESSAGE are supported for the moment
// Only event of type EventType.MESSAGE are supported for the moment
if (event.root.getClearType() != EventType.MESSAGE) return false
if (!actionPermissions.canSendMessage) return false
// TODO if user is admin or moderator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import org.matrix.android.sdk.api.session.room.send.SendState
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
import org.matrix.android.sdk.api.session.room.timeline.getLastMessageContent
import org.matrix.android.sdk.api.session.room.timeline.hasBeenEdited
import org.matrix.android.sdk.api.session.room.timeline.isEdition
import org.matrix.android.sdk.internal.crypto.model.event.EncryptedEventContent
import javax.inject.Inject

Expand Down Expand Up @@ -66,9 +67,10 @@ class MessageInformationDataFactory @Inject constructor(private val session: Ses
addDaySeparator
|| event.senderInfo.avatarUrl != nextEvent?.senderInfo?.avatarUrl
|| event.senderInfo.disambiguatedDisplayName != nextEvent?.senderInfo?.disambiguatedDisplayName
|| (nextEvent.root.getClearType() != EventType.MESSAGE && nextEvent.root.getClearType() != EventType.ENCRYPTED)
|| nextEvent.root.getClearType() !in listOf(EventType.MESSAGE, EventType.STICKER, EventType.ENCRYPTED)
|| isNextMessageReceivedMoreThanOneHourAgo
|| isTileTypeMessage(nextEvent)
|| nextEvent.isEdition()

val time = dateFormatter.format(event.root.originServerTs, DateFormatKind.MESSAGE_SIMPLE)
val e2eDecoration = getE2EDecoration(event)
Expand Down
10 changes: 10 additions & 0 deletions vector/src/main/res/xml/network_security_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@
<domain includeSubdomains="true">10.0.2.2</domain>
<!-- Onion services -->
<domain includeSubdomains="true">onion</domain>

<!-- Domains that are used for LANs -->
<!-- These are IANA recognized special use domain names, see https://www.iana.org/assignments/special-use-domain-names/special-use-domain-names.xhtml -->
<domain includeSubdomains="true">home.arpa</domain>
<domain includeSubdomains="true">local</domain> <!-- Note this has been reserved for use with mDNS -->
<domain includeSubdomains="true">test</domain>
<!-- These are observed in the wild either by convention or RFCs that have not been accepted, and are not currently TLDs -->
<domain includeSubdomains="true">home</domain>
<domain includeSubdomains="true">lan</domain>
<domain includeSubdomains="true">localdomain</domain>
</domain-config>

<debug-overrides>
Expand Down

0 comments on commit ae668b0

Please sign in to comment.