mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 01:45:52 +03:00
Merge pull request #2176 from vector-im/feature/fix_dm_wordings
Wording differentiation for DM "chat" instead of "room"
This commit is contained in:
commit
c09d308df8
20 changed files with 230 additions and 89 deletions
|
@ -5,6 +5,7 @@ Features ✨:
|
||||||
-
|
-
|
||||||
|
|
||||||
Improvements 🙌:
|
Improvements 🙌:
|
||||||
|
- Wording differentiation for direct rooms (#2176)
|
||||||
- PIN code: request PIN code if phone has been locked
|
- PIN code: request PIN code if phone has been locked
|
||||||
- Small optimisation of scrolling experience in timeline (#2114)
|
- Small optimisation of scrolling experience in timeline (#2114)
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,19 @@
|
||||||
<string name="notice_room_invite_no_invitee_by_you">Your invitation</string>
|
<string name="notice_room_invite_no_invitee_by_you">Your invitation</string>
|
||||||
<string name="notice_room_created">%1$s created the room</string>
|
<string name="notice_room_created">%1$s created the room</string>
|
||||||
<string name="notice_room_created_by_you">You created the room</string>
|
<string name="notice_room_created_by_you">You created the room</string>
|
||||||
|
<string name="notice_direct_room_created">%1$s created the discussion</string>
|
||||||
|
<string name="notice_direct_room_created_by_you">You created the discussion</string>
|
||||||
<string name="notice_room_invite">%1$s invited %2$s</string>
|
<string name="notice_room_invite">%1$s invited %2$s</string>
|
||||||
<string name="notice_room_invite_by_you">You invited %1$s</string>
|
<string name="notice_room_invite_by_you">You invited %1$s</string>
|
||||||
<string name="notice_room_invite_you">%1$s invited you</string>
|
<string name="notice_room_invite_you">%1$s invited you</string>
|
||||||
<string name="notice_room_join">%1$s joined the room</string>
|
<string name="notice_room_join">%1$s joined the room</string>
|
||||||
<string name="notice_room_join_by_you">You joined the room</string>
|
<string name="notice_room_join_by_you">You joined the room</string>
|
||||||
|
<string name="notice_direct_room_join">%1$s joined</string>
|
||||||
|
<string name="notice_direct_room_join_by_you">You joined</string>
|
||||||
<string name="notice_room_leave">%1$s left the room</string>
|
<string name="notice_room_leave">%1$s left the room</string>
|
||||||
<string name="notice_room_leave_by_you">You left the room</string>
|
<string name="notice_room_leave_by_you">You left the room</string>
|
||||||
|
<string name="notice_direct_room_leave">%1$s left the room</string>
|
||||||
|
<string name="notice_direct_room_leave_by_you">You left the room</string>
|
||||||
<string name="notice_room_reject">%1$s rejected the invitation</string>
|
<string name="notice_room_reject">%1$s rejected the invitation</string>
|
||||||
<string name="notice_room_reject_by_you">You rejected the invitation</string>
|
<string name="notice_room_reject_by_you">You rejected the invitation</string>
|
||||||
<string name="notice_room_kick">%1$s kicked %2$s</string>
|
<string name="notice_room_kick">%1$s kicked %2$s</string>
|
||||||
|
@ -53,6 +59,8 @@
|
||||||
<string name="notice_ended_call_by_you">You ended the call.</string>
|
<string name="notice_ended_call_by_you">You ended the call.</string>
|
||||||
<string name="notice_made_future_room_visibility">%1$s made future room history visible to %2$s</string>
|
<string name="notice_made_future_room_visibility">%1$s made future room history visible to %2$s</string>
|
||||||
<string name="notice_made_future_room_visibility_by_you">You made future room history visible to %1$s</string>
|
<string name="notice_made_future_room_visibility_by_you">You made future room history visible to %1$s</string>
|
||||||
|
<string name="notice_made_future_direct_room_visibility">%1$s made future messages visible to %2$s</string>
|
||||||
|
<string name="notice_made_future_direct_room_visibility_by_you">You made future messages visible to %1$s</string>
|
||||||
<string name="notice_room_visibility_invited">all room members, from the point they are invited.</string>
|
<string name="notice_room_visibility_invited">all room members, from the point they are invited.</string>
|
||||||
<string name="notice_room_visibility_joined">all room members, from the point they joined.</string>
|
<string name="notice_room_visibility_joined">all room members, from the point they joined.</string>
|
||||||
<string name="notice_room_visibility_shared">all room members.</string>
|
<string name="notice_room_visibility_shared">all room members.</string>
|
||||||
|
@ -62,6 +70,8 @@
|
||||||
<string name="notice_end_to_end_by_you">You turned on end-to-end encryption (%1$s)</string>
|
<string name="notice_end_to_end_by_you">You turned on end-to-end encryption (%1$s)</string>
|
||||||
<string name="notice_room_update">%s upgraded this room.</string>
|
<string name="notice_room_update">%s upgraded this room.</string>
|
||||||
<string name="notice_room_update_by_you">You upgraded this room.</string>
|
<string name="notice_room_update_by_you">You upgraded this room.</string>
|
||||||
|
<string name="notice_direct_room_update">%s upgraded here.</string>
|
||||||
|
<string name="notice_direct_room_update_by_you">You upgraded here.</string>
|
||||||
|
|
||||||
<string name="notice_requested_voip_conference">%1$s requested a VoIP conference</string>
|
<string name="notice_requested_voip_conference">%1$s requested a VoIP conference</string>
|
||||||
<string name="notice_requested_voip_conference_by_you">You requested a VoIP conference</string>
|
<string name="notice_requested_voip_conference_by_you">You requested a VoIP conference</string>
|
||||||
|
@ -83,8 +93,12 @@
|
||||||
<string name="notice_profile_change_redacted_by_you">You updated your profile %1$s</string>
|
<string name="notice_profile_change_redacted_by_you">You updated your profile %1$s</string>
|
||||||
<string name="notice_room_third_party_invite">%1$s sent an invitation to %2$s to join the room</string>
|
<string name="notice_room_third_party_invite">%1$s sent an invitation to %2$s to join the room</string>
|
||||||
<string name="notice_room_third_party_invite_by_you">You sent an invitation to %1$s to join the room</string>
|
<string name="notice_room_third_party_invite_by_you">You sent an invitation to %1$s to join the room</string>
|
||||||
|
<string name="notice_direct_room_third_party_invite">%1$s invited %2$s</string>
|
||||||
|
<string name="notice_direct_room_third_party_invite_by_you">You invited %1$s</string>
|
||||||
<string name="notice_room_third_party_revoked_invite">%1$s revoked the invitation for %2$s to join the room</string>
|
<string name="notice_room_third_party_revoked_invite">%1$s revoked the invitation for %2$s to join the room</string>
|
||||||
<string name="notice_room_third_party_revoked_invite_by_you">You revoked the invitation for %1$s to join the room</string>
|
<string name="notice_room_third_party_revoked_invite_by_you">You revoked the invitation for %1$s to join the room</string>
|
||||||
|
<string name="notice_direct_room_third_party_revoked_invite">%1$s revoked the invitation for %2$s</string>
|
||||||
|
<string name="notice_direct_room_third_party_revoked_invite_by_you">You revoked the invitation for %1$s</string>
|
||||||
<string name="notice_room_third_party_registered_invite">%1$s accepted the invitation for %2$s</string>
|
<string name="notice_room_third_party_registered_invite">%1$s accepted the invitation for %2$s</string>
|
||||||
<string name="notice_room_third_party_registered_invite_by_you">You accepted the invitation for %1$s</string>
|
<string name="notice_room_third_party_registered_invite_by_you">You accepted the invitation for %1$s</string>
|
||||||
|
|
||||||
|
@ -171,8 +185,12 @@
|
||||||
<string name="notice_room_invite_you_with_reason">%1$s invited you. Reason: %2$s</string>
|
<string name="notice_room_invite_you_with_reason">%1$s invited you. Reason: %2$s</string>
|
||||||
<string name="notice_room_join_with_reason">%1$s joined the room. Reason: %2$s</string>
|
<string name="notice_room_join_with_reason">%1$s joined the room. Reason: %2$s</string>
|
||||||
<string name="notice_room_join_with_reason_by_you">You joined the room. Reason: %1$s</string>
|
<string name="notice_room_join_with_reason_by_you">You joined the room. Reason: %1$s</string>
|
||||||
|
<string name="notice_direct_room_join_with_reason">%1$s joined. Reason: %2$s</string>
|
||||||
|
<string name="notice_direct_room_join_with_reason_by_you">You joined. Reason: %1$s</string>
|
||||||
<string name="notice_room_leave_with_reason">%1$s left the room. Reason: %2$s</string>
|
<string name="notice_room_leave_with_reason">%1$s left the room. Reason: %2$s</string>
|
||||||
<string name="notice_room_leave_with_reason_by_you">You left the room. Reason: %1$s</string>
|
<string name="notice_room_leave_with_reason_by_you">You left the room. Reason: %1$s</string>
|
||||||
|
<string name="notice_direct_room_leave_with_reason">%1$s left. Reason: %2$s</string>
|
||||||
|
<string name="notice_direct_room_leave_with_reason_by_you">You left. Reason: %1$s</string>
|
||||||
<string name="notice_room_reject_with_reason">%1$s rejected the invitation. Reason: %2$s</string>
|
<string name="notice_room_reject_with_reason">%1$s rejected the invitation. Reason: %2$s</string>
|
||||||
<string name="notice_room_reject_with_reason_by_you">You rejected the invitation. Reason: %1$s</string>
|
<string name="notice_room_reject_with_reason_by_you">You rejected the invitation. Reason: %1$s</string>
|
||||||
<string name="notice_room_kick_with_reason">%1$s kicked %2$s. Reason: %3$s</string>
|
<string name="notice_room_kick_with_reason">%1$s kicked %2$s. Reason: %3$s</string>
|
||||||
|
@ -220,8 +238,12 @@
|
||||||
|
|
||||||
<string name="notice_room_guest_access_can_join">"%1$s has allowed guests to join the room."</string>
|
<string name="notice_room_guest_access_can_join">"%1$s has allowed guests to join the room."</string>
|
||||||
<string name="notice_room_guest_access_can_join_by_you">"You have allowed guests to join the room."</string>
|
<string name="notice_room_guest_access_can_join_by_you">"You have allowed guests to join the room."</string>
|
||||||
|
<string name="notice_direct_room_guest_access_can_join">"%1$s has allowed guests to join here."</string>
|
||||||
|
<string name="notice_direct_room_guest_access_can_join_by_you">"You have allowed guests to join here."</string>
|
||||||
<string name="notice_room_guest_access_forbidden">"%1$s has prevented guests from joining the room."</string>
|
<string name="notice_room_guest_access_forbidden">"%1$s has prevented guests from joining the room."</string>
|
||||||
<string name="notice_room_guest_access_forbidden_by_you">"You have prevented guests from joining the room."</string>
|
<string name="notice_room_guest_access_forbidden_by_you">"You have prevented guests from joining the room."</string>
|
||||||
|
<string name="notice_direct_room_guest_access_forbidden">"%1$s has prevented guests from joining the room."</string>
|
||||||
|
<string name="notice_direct_room_guest_access_forbidden_by_you">"You have prevented guests from joining the room."</string>
|
||||||
|
|
||||||
<string name="notice_end_to_end_ok">%1$s turned on end-to-end encryption.</string>
|
<string name="notice_end_to_end_ok">%1$s turned on end-to-end encryption.</string>
|
||||||
<string name="notice_end_to_end_ok_by_you">You turned on end-to-end encryption.</string>
|
<string name="notice_end_to_end_ok_by_you">You turned on end-to-end encryption.</string>
|
||||||
|
|
|
@ -704,7 +704,13 @@ class RoomDetailFragment @Inject constructor(
|
||||||
// safeStartCall(it, isVideoCall)
|
// safeStartCall(it, isVideoCall)
|
||||||
// }
|
// }
|
||||||
} else if (!state.isAllowedToStartWebRTCCall) {
|
} else if (!state.isAllowedToStartWebRTCCall) {
|
||||||
showDialogWithMessage(getString(R.string.no_permissions_to_start_webrtc_call))
|
showDialogWithMessage(getString(
|
||||||
|
if (state.isDm()) {
|
||||||
|
R.string.no_permissions_to_start_webrtc_call_in_direct_room
|
||||||
|
} else {
|
||||||
|
R.string.no_permissions_to_start_webrtc_call
|
||||||
|
})
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
safeStartCall(isVideoCall)
|
safeStartCall(isVideoCall)
|
||||||
}
|
}
|
||||||
|
@ -714,7 +720,13 @@ class RoomDetailFragment @Inject constructor(
|
||||||
// can you add widgets??
|
// can you add widgets??
|
||||||
if (!state.isAllowedToManageWidgets) {
|
if (!state.isAllowedToManageWidgets) {
|
||||||
// You do not have permission to start a conference call in this room
|
// You do not have permission to start a conference call in this room
|
||||||
showDialogWithMessage(getString(R.string.no_permissions_to_start_conf_call))
|
showDialogWithMessage(getString(
|
||||||
|
if (state.isDm()) {
|
||||||
|
R.string.no_permissions_to_start_conf_call_in_direct_room
|
||||||
|
} else {
|
||||||
|
R.string.no_permissions_to_start_conf_call
|
||||||
|
}
|
||||||
|
))
|
||||||
} else {
|
} else {
|
||||||
if (state.activeRoomWidgets()?.filter { it.type == WidgetType.Jitsi }?.any() == true) {
|
if (state.activeRoomWidgets()?.filter { it.type == WidgetType.Jitsi }?.any() == true) {
|
||||||
// A conference is already in progress!
|
// A conference is already in progress!
|
||||||
|
|
|
@ -77,4 +77,6 @@ data class RoomDetailViewState(
|
||||||
// Also highlight the target event, if any
|
// Also highlight the target event, if any
|
||||||
highlightedEventId = args.eventId
|
highlightedEventId = args.eventId
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fun isDm() = asyncRoomSummary()?.isDirect == true
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,7 +190,7 @@ class MessageActionsViewModel @AssistedInject constructor(@Assisted
|
||||||
EventType.CALL_CANDIDATES,
|
EventType.CALL_CANDIDATES,
|
||||||
EventType.CALL_HANGUP,
|
EventType.CALL_HANGUP,
|
||||||
EventType.CALL_ANSWER -> {
|
EventType.CALL_ANSWER -> {
|
||||||
noticeEventFormatter.format(timelineEvent)
|
noticeEventFormatter.format(timelineEvent, room?.roomSummary())
|
||||||
}
|
}
|
||||||
else -> null
|
else -> null
|
||||||
} ?: ""
|
} ?: ""
|
||||||
|
|
|
@ -25,6 +25,8 @@ import im.vector.app.features.home.room.detail.timeline.helper.MessageInformatio
|
||||||
import im.vector.app.features.home.room.detail.timeline.helper.MessageItemAttributesFactory
|
import im.vector.app.features.home.room.detail.timeline.helper.MessageItemAttributesFactory
|
||||||
import im.vector.app.features.home.room.detail.timeline.item.StatusTileTimelineItem
|
import im.vector.app.features.home.room.detail.timeline.item.StatusTileTimelineItem
|
||||||
import im.vector.app.features.home.room.detail.timeline.item.StatusTileTimelineItem_
|
import im.vector.app.features.home.room.detail.timeline.item.StatusTileTimelineItem_
|
||||||
|
import org.matrix.android.sdk.api.extensions.orFalse
|
||||||
|
import org.matrix.android.sdk.api.session.Session
|
||||||
import org.matrix.android.sdk.api.session.events.model.toModel
|
import org.matrix.android.sdk.api.session.events.model.toModel
|
||||||
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
|
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
|
||||||
import org.matrix.android.sdk.internal.crypto.MXCRYPTO_ALGORITHM_MEGOLM
|
import org.matrix.android.sdk.internal.crypto.MXCRYPTO_ALGORITHM_MEGOLM
|
||||||
|
@ -36,7 +38,8 @@ class EncryptionItemFactory @Inject constructor(
|
||||||
private val messageColorProvider: MessageColorProvider,
|
private val messageColorProvider: MessageColorProvider,
|
||||||
private val stringProvider: StringProvider,
|
private val stringProvider: StringProvider,
|
||||||
private val informationDataFactory: MessageInformationDataFactory,
|
private val informationDataFactory: MessageInformationDataFactory,
|
||||||
private val avatarSizeProvider: AvatarSizeProvider) {
|
private val avatarSizeProvider: AvatarSizeProvider,
|
||||||
|
private val session: Session) {
|
||||||
|
|
||||||
fun create(event: TimelineEvent,
|
fun create(event: TimelineEvent,
|
||||||
highlight: Boolean,
|
highlight: Boolean,
|
||||||
|
@ -51,7 +54,13 @@ class EncryptionItemFactory @Inject constructor(
|
||||||
val shield: StatusTileTimelineItem.ShieldUIState
|
val shield: StatusTileTimelineItem.ShieldUIState
|
||||||
if (isSafeAlgorithm) {
|
if (isSafeAlgorithm) {
|
||||||
title = stringProvider.getString(R.string.encryption_enabled)
|
title = stringProvider.getString(R.string.encryption_enabled)
|
||||||
description = stringProvider.getString(R.string.encryption_enabled_tile_description)
|
description = stringProvider.getString(
|
||||||
|
if (session.getRoomSummary(event.root.roomId ?: "")?.isDirect.orFalse()) {
|
||||||
|
R.string.direct_room_encryption_enabled_tile_description
|
||||||
|
} else {
|
||||||
|
R.string.encryption_enabled_tile_description
|
||||||
|
}
|
||||||
|
)
|
||||||
shield = StatusTileTimelineItem.ShieldUIState.BLACK
|
shield = StatusTileTimelineItem.ShieldUIState.BLACK
|
||||||
} else {
|
} else {
|
||||||
title = stringProvider.getString(R.string.encryption_not_enabled)
|
title = stringProvider.getString(R.string.encryption_not_enabled)
|
||||||
|
|
|
@ -22,6 +22,7 @@ import im.vector.app.features.home.AvatarRenderer
|
||||||
import im.vector.app.features.home.room.detail.timeline.TimelineEventController
|
import im.vector.app.features.home.room.detail.timeline.TimelineEventController
|
||||||
import im.vector.app.features.home.room.detail.timeline.helper.AvatarSizeProvider
|
import im.vector.app.features.home.room.detail.timeline.helper.AvatarSizeProvider
|
||||||
import im.vector.app.features.home.room.detail.timeline.helper.MergedTimelineEventVisibilityStateChangedListener
|
import im.vector.app.features.home.room.detail.timeline.helper.MergedTimelineEventVisibilityStateChangedListener
|
||||||
|
import im.vector.app.features.home.room.detail.timeline.helper.RoomSummaryHolder
|
||||||
import im.vector.app.features.home.room.detail.timeline.helper.canBeMerged
|
import im.vector.app.features.home.room.detail.timeline.helper.canBeMerged
|
||||||
import im.vector.app.features.home.room.detail.timeline.helper.isRoomConfiguration
|
import im.vector.app.features.home.room.detail.timeline.helper.isRoomConfiguration
|
||||||
import im.vector.app.features.home.room.detail.timeline.helper.prevSameTypeEvents
|
import im.vector.app.features.home.room.detail.timeline.helper.prevSameTypeEvents
|
||||||
|
@ -33,6 +34,7 @@ import im.vector.app.features.home.room.detail.timeline.item.MergedRoomCreationI
|
||||||
import im.vector.app.features.home.room.detail.timeline.item.MergedUTDItem
|
import im.vector.app.features.home.room.detail.timeline.item.MergedUTDItem
|
||||||
import im.vector.app.features.home.room.detail.timeline.item.MergedUTDItem_
|
import im.vector.app.features.home.room.detail.timeline.item.MergedUTDItem_
|
||||||
import im.vector.app.features.settings.VectorPreferences
|
import im.vector.app.features.settings.VectorPreferences
|
||||||
|
import org.matrix.android.sdk.api.extensions.orFalse
|
||||||
import org.matrix.android.sdk.api.session.events.model.EventType
|
import org.matrix.android.sdk.api.session.events.model.EventType
|
||||||
import org.matrix.android.sdk.api.session.events.model.toModel
|
import org.matrix.android.sdk.api.session.events.model.toModel
|
||||||
import org.matrix.android.sdk.api.session.room.model.create.RoomCreateContent
|
import org.matrix.android.sdk.api.session.room.model.create.RoomCreateContent
|
||||||
|
@ -45,6 +47,7 @@ import javax.inject.Inject
|
||||||
class MergedHeaderItemFactory @Inject constructor(private val activeSessionHolder: ActiveSessionHolder,
|
class MergedHeaderItemFactory @Inject constructor(private val activeSessionHolder: ActiveSessionHolder,
|
||||||
private val avatarRenderer: AvatarRenderer,
|
private val avatarRenderer: AvatarRenderer,
|
||||||
private val avatarSizeProvider: AvatarSizeProvider,
|
private val avatarSizeProvider: AvatarSizeProvider,
|
||||||
|
private val roomSummaryHolder: RoomSummaryHolder,
|
||||||
private val vectorPreferences: VectorPreferences) {
|
private val vectorPreferences: VectorPreferences) {
|
||||||
|
|
||||||
private val collapsedEventIds = linkedSetOf<Long>()
|
private val collapsedEventIds = linkedSetOf<Long>()
|
||||||
|
@ -78,6 +81,8 @@ class MergedHeaderItemFactory @Inject constructor(private val activeSessionHolde
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun isDirectRoom() = roomSummaryHolder.roomSummary?.isDirect.orFalse()
|
||||||
|
|
||||||
private fun buildMembershipEventsMergedSummary(currentPosition: Int,
|
private fun buildMembershipEventsMergedSummary(currentPosition: Int,
|
||||||
items: List<TimelineEvent>,
|
items: List<TimelineEvent>,
|
||||||
event: TimelineEvent,
|
event: TimelineEvent,
|
||||||
|
@ -100,7 +105,8 @@ class MergedHeaderItemFactory @Inject constructor(private val activeSessionHolde
|
||||||
avatarUrl = mergedEvent.senderInfo.avatarUrl,
|
avatarUrl = mergedEvent.senderInfo.avatarUrl,
|
||||||
memberName = mergedEvent.senderInfo.disambiguatedDisplayName,
|
memberName = mergedEvent.senderInfo.disambiguatedDisplayName,
|
||||||
localId = mergedEvent.localId,
|
localId = mergedEvent.localId,
|
||||||
eventId = mergedEvent.root.eventId ?: ""
|
eventId = mergedEvent.root.eventId ?: "",
|
||||||
|
isDirectRoom = isDirectRoom()
|
||||||
)
|
)
|
||||||
mergedData.add(data)
|
mergedData.add(data)
|
||||||
}
|
}
|
||||||
|
@ -157,7 +163,7 @@ class MergedHeaderItemFactory @Inject constructor(private val activeSessionHolde
|
||||||
items: List<TimelineEvent>,
|
items: List<TimelineEvent>,
|
||||||
event: TimelineEvent,
|
event: TimelineEvent,
|
||||||
eventIdToHighlight: String?,
|
eventIdToHighlight: String?,
|
||||||
// requestModelBuild: () -> Unit,
|
// requestModelBuild: () -> Unit,
|
||||||
callback: TimelineEventController.Callback?): MergedUTDItem_? {
|
callback: TimelineEventController.Callback?): MergedUTDItem_? {
|
||||||
Timber.v("## MERGE: buildUTDMergedSummary from position $currentPosition")
|
Timber.v("## MERGE: buildUTDMergedSummary from position $currentPosition")
|
||||||
var prevEvent = items.prevOrNull(currentPosition)
|
var prevEvent = items.prevOrNull(currentPosition)
|
||||||
|
@ -187,7 +193,8 @@ class MergedHeaderItemFactory @Inject constructor(private val activeSessionHolde
|
||||||
avatarUrl = senderAvatar,
|
avatarUrl = senderAvatar,
|
||||||
memberName = senderName,
|
memberName = senderName,
|
||||||
localId = mergedEvent.localId,
|
localId = mergedEvent.localId,
|
||||||
eventId = mergedEvent.root.eventId ?: ""
|
eventId = mergedEvent.root.eventId ?: "",
|
||||||
|
isDirectRoom = isDirectRoom()
|
||||||
)
|
)
|
||||||
mergedData.add(data)
|
mergedData.add(data)
|
||||||
}
|
}
|
||||||
|
@ -247,7 +254,8 @@ class MergedHeaderItemFactory @Inject constructor(private val activeSessionHolde
|
||||||
avatarUrl = mergedEvent.senderInfo.avatarUrl,
|
avatarUrl = mergedEvent.senderInfo.avatarUrl,
|
||||||
memberName = mergedEvent.senderInfo.disambiguatedDisplayName,
|
memberName = mergedEvent.senderInfo.disambiguatedDisplayName,
|
||||||
localId = mergedEvent.localId,
|
localId = mergedEvent.localId,
|
||||||
eventId = mergedEvent.root.eventId ?: ""
|
eventId = mergedEvent.root.eventId ?: "",
|
||||||
|
isDirectRoom = isDirectRoom()
|
||||||
)
|
)
|
||||||
mergedData.add(data)
|
mergedData.add(data)
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ import im.vector.app.features.home.room.detail.timeline.helper.ContentDownloadSt
|
||||||
import im.vector.app.features.home.room.detail.timeline.helper.ContentUploadStateTrackerBinder
|
import im.vector.app.features.home.room.detail.timeline.helper.ContentUploadStateTrackerBinder
|
||||||
import im.vector.app.features.home.room.detail.timeline.helper.MessageInformationDataFactory
|
import im.vector.app.features.home.room.detail.timeline.helper.MessageInformationDataFactory
|
||||||
import im.vector.app.features.home.room.detail.timeline.helper.MessageItemAttributesFactory
|
import im.vector.app.features.home.room.detail.timeline.helper.MessageItemAttributesFactory
|
||||||
|
import im.vector.app.features.home.room.detail.timeline.helper.RoomSummaryHolder
|
||||||
import im.vector.app.features.home.room.detail.timeline.helper.TimelineMediaSizeProvider
|
import im.vector.app.features.home.room.detail.timeline.helper.TimelineMediaSizeProvider
|
||||||
import im.vector.app.features.home.room.detail.timeline.item.AbsMessageItem
|
import im.vector.app.features.home.room.detail.timeline.item.AbsMessageItem
|
||||||
import im.vector.app.features.home.room.detail.timeline.item.MessageBlockCodeItem
|
import im.vector.app.features.home.room.detail.timeline.item.MessageBlockCodeItem
|
||||||
|
@ -101,6 +102,7 @@ class MessageItemFactory @Inject constructor(
|
||||||
private val messageItemAttributesFactory: MessageItemAttributesFactory,
|
private val messageItemAttributesFactory: MessageItemAttributesFactory,
|
||||||
private val contentUploadStateTrackerBinder: ContentUploadStateTrackerBinder,
|
private val contentUploadStateTrackerBinder: ContentUploadStateTrackerBinder,
|
||||||
private val contentDownloadStateTrackerBinder: ContentDownloadStateTrackerBinder,
|
private val contentDownloadStateTrackerBinder: ContentDownloadStateTrackerBinder,
|
||||||
|
private val roomSummaryHolder: RoomSummaryHolder,
|
||||||
private val defaultItemFactory: DefaultItemFactory,
|
private val defaultItemFactory: DefaultItemFactory,
|
||||||
private val noticeItemFactory: NoticeItemFactory,
|
private val noticeItemFactory: NoticeItemFactory,
|
||||||
private val avatarSizeProvider: AvatarSizeProvider,
|
private val avatarSizeProvider: AvatarSizeProvider,
|
||||||
|
@ -130,7 +132,7 @@ class MessageItemFactory @Inject constructor(
|
||||||
|| event.isEncrypted() && event.root.content.toModel<EncryptedEventContent>()?.relatesTo?.type == RelationType.REPLACE
|
|| event.isEncrypted() && event.root.content.toModel<EncryptedEventContent>()?.relatesTo?.type == RelationType.REPLACE
|
||||||
) {
|
) {
|
||||||
// This is an edit event, we should display it when debugging as a notice event
|
// This is an edit event, we should display it when debugging as a notice event
|
||||||
return noticeItemFactory.create(event, highlight, callback)
|
return noticeItemFactory.create(event, highlight, roomSummaryHolder.roomSummary, callback)
|
||||||
}
|
}
|
||||||
val attributes = messageItemAttributesFactory.create(messageContent, informationData, callback)
|
val attributes = messageItemAttributesFactory.create(messageContent, informationData, callback)
|
||||||
|
|
||||||
|
@ -146,7 +148,7 @@ class MessageItemFactory @Inject constructor(
|
||||||
is MessageAudioContent -> buildAudioMessageItem(messageContent, informationData, highlight, attributes)
|
is MessageAudioContent -> buildAudioMessageItem(messageContent, informationData, highlight, attributes)
|
||||||
is MessageVerificationRequestContent -> buildVerificationRequestMessageItem(messageContent, informationData, highlight, callback, attributes)
|
is MessageVerificationRequestContent -> buildVerificationRequestMessageItem(messageContent, informationData, highlight, callback, attributes)
|
||||||
is MessageOptionsContent -> buildOptionsMessageItem(messageContent, informationData, highlight, callback, attributes)
|
is MessageOptionsContent -> buildOptionsMessageItem(messageContent, informationData, highlight, callback, attributes)
|
||||||
is MessagePollResponseContent -> noticeItemFactory.create(event, highlight, callback)
|
is MessagePollResponseContent -> noticeItemFactory.create(event, highlight, roomSummaryHolder.roomSummary, callback)
|
||||||
else -> buildNotHandledMessageItem(messageContent, informationData, highlight, callback, attributes)
|
else -> buildNotHandledMessageItem(messageContent, informationData, highlight, callback, attributes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import im.vector.app.features.home.room.detail.timeline.helper.AvatarSizeProvide
|
||||||
import im.vector.app.features.home.room.detail.timeline.helper.MessageInformationDataFactory
|
import im.vector.app.features.home.room.detail.timeline.helper.MessageInformationDataFactory
|
||||||
import im.vector.app.features.home.room.detail.timeline.item.NoticeItem
|
import im.vector.app.features.home.room.detail.timeline.item.NoticeItem
|
||||||
import im.vector.app.features.home.room.detail.timeline.item.NoticeItem_
|
import im.vector.app.features.home.room.detail.timeline.item.NoticeItem_
|
||||||
|
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
||||||
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
|
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -34,8 +35,9 @@ class NoticeItemFactory @Inject constructor(private val eventFormatter: NoticeEv
|
||||||
|
|
||||||
fun create(event: TimelineEvent,
|
fun create(event: TimelineEvent,
|
||||||
highlight: Boolean,
|
highlight: Boolean,
|
||||||
|
roomSummary: RoomSummary?,
|
||||||
callback: TimelineEventController.Callback?): NoticeItem? {
|
callback: TimelineEventController.Callback?): NoticeItem? {
|
||||||
val formattedText = eventFormatter.format(event) ?: return null
|
val formattedText = eventFormatter.format(event, roomSummary) ?: return null
|
||||||
val informationData = informationDataFactory.create(event, null)
|
val informationData = informationDataFactory.create(event, null)
|
||||||
val attributes = NoticeItem.Attributes(
|
val attributes = NoticeItem.Attributes(
|
||||||
avatarRenderer = avatarRenderer,
|
avatarRenderer = avatarRenderer,
|
||||||
|
|
|
@ -21,6 +21,7 @@ import im.vector.app.core.epoxy.VectorEpoxyModel
|
||||||
import im.vector.app.core.resources.StringProvider
|
import im.vector.app.core.resources.StringProvider
|
||||||
import im.vector.app.core.resources.UserPreferencesProvider
|
import im.vector.app.core.resources.UserPreferencesProvider
|
||||||
import im.vector.app.features.home.room.detail.timeline.TimelineEventController
|
import im.vector.app.features.home.room.detail.timeline.TimelineEventController
|
||||||
|
import im.vector.app.features.home.room.detail.timeline.helper.RoomSummaryHolder
|
||||||
import im.vector.app.features.home.room.detail.timeline.item.RoomCreateItem_
|
import im.vector.app.features.home.room.detail.timeline.item.RoomCreateItem_
|
||||||
import me.gujun.android.span.span
|
import me.gujun.android.span.span
|
||||||
import org.matrix.android.sdk.api.session.Session
|
import org.matrix.android.sdk.api.session.Session
|
||||||
|
@ -32,6 +33,7 @@ import javax.inject.Inject
|
||||||
class RoomCreateItemFactory @Inject constructor(private val stringProvider: StringProvider,
|
class RoomCreateItemFactory @Inject constructor(private val stringProvider: StringProvider,
|
||||||
private val userPreferencesProvider: UserPreferencesProvider,
|
private val userPreferencesProvider: UserPreferencesProvider,
|
||||||
private val session: Session,
|
private val session: Session,
|
||||||
|
private val roomSummaryHolder: RoomSummaryHolder,
|
||||||
private val noticeItemFactory: NoticeItemFactory) {
|
private val noticeItemFactory: NoticeItemFactory) {
|
||||||
|
|
||||||
fun create(event: TimelineEvent, callback: TimelineEventController.Callback?): VectorEpoxyModel<*>? {
|
fun create(event: TimelineEvent, callback: TimelineEventController.Callback?): VectorEpoxyModel<*>? {
|
||||||
|
@ -52,7 +54,7 @@ class RoomCreateItemFactory @Inject constructor(private val stringProvider: Stri
|
||||||
|
|
||||||
private fun defaultRendering(event: TimelineEvent, callback: TimelineEventController.Callback?): VectorEpoxyModel<*>? {
|
private fun defaultRendering(event: TimelineEvent, callback: TimelineEventController.Callback?): VectorEpoxyModel<*>? {
|
||||||
return if (userPreferencesProvider.shouldShowHiddenEvents()) {
|
return if (userPreferencesProvider.shouldShowHiddenEvents()) {
|
||||||
noticeItemFactory.create(event, false, callback)
|
noticeItemFactory.create(event, false, roomSummaryHolder.roomSummary, callback)
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import im.vector.app.core.epoxy.EmptyItem_
|
||||||
import im.vector.app.core.epoxy.VectorEpoxyModel
|
import im.vector.app.core.epoxy.VectorEpoxyModel
|
||||||
import im.vector.app.core.resources.UserPreferencesProvider
|
import im.vector.app.core.resources.UserPreferencesProvider
|
||||||
import im.vector.app.features.home.room.detail.timeline.TimelineEventController
|
import im.vector.app.features.home.room.detail.timeline.TimelineEventController
|
||||||
|
import im.vector.app.features.home.room.detail.timeline.helper.RoomSummaryHolder
|
||||||
import org.matrix.android.sdk.api.session.events.model.EventType
|
import org.matrix.android.sdk.api.session.events.model.EventType
|
||||||
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
|
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
@ -31,6 +32,7 @@ class TimelineItemFactory @Inject constructor(private val messageItemFactory: Me
|
||||||
private val defaultItemFactory: DefaultItemFactory,
|
private val defaultItemFactory: DefaultItemFactory,
|
||||||
private val encryptionItemFactory: EncryptionItemFactory,
|
private val encryptionItemFactory: EncryptionItemFactory,
|
||||||
private val roomCreateItemFactory: RoomCreateItemFactory,
|
private val roomCreateItemFactory: RoomCreateItemFactory,
|
||||||
|
private val roomSummaryHolder: RoomSummaryHolder,
|
||||||
private val verificationConclusionItemFactory: VerificationItemFactory,
|
private val verificationConclusionItemFactory: VerificationItemFactory,
|
||||||
private val userPreferencesProvider: UserPreferencesProvider) {
|
private val userPreferencesProvider: UserPreferencesProvider) {
|
||||||
|
|
||||||
|
@ -63,10 +65,8 @@ class TimelineItemFactory @Inject constructor(private val messageItemFactory: Me
|
||||||
EventType.CALL_ANSWER,
|
EventType.CALL_ANSWER,
|
||||||
EventType.STATE_ROOM_POWER_LEVELS,
|
EventType.STATE_ROOM_POWER_LEVELS,
|
||||||
EventType.REACTION,
|
EventType.REACTION,
|
||||||
EventType.REDACTION -> noticeItemFactory.create(event, highlight, callback)
|
EventType.REDACTION -> noticeItemFactory.create(event, highlight, roomSummaryHolder.roomSummary, callback)
|
||||||
EventType.STATE_ROOM_ENCRYPTION -> {
|
EventType.STATE_ROOM_ENCRYPTION -> encryptionItemFactory.create(event, highlight, callback)
|
||||||
encryptionItemFactory.create(event, highlight, callback)
|
|
||||||
}
|
|
||||||
// State room create
|
// State room create
|
||||||
EventType.STATE_ROOM_CREATE -> roomCreateItemFactory.create(event, callback)
|
EventType.STATE_ROOM_CREATE -> roomCreateItemFactory.create(event, callback)
|
||||||
// Crypto
|
// Crypto
|
||||||
|
@ -87,7 +87,7 @@ class TimelineItemFactory @Inject constructor(private val messageItemFactory: Me
|
||||||
// TODO These are not filtered out by timeline when encrypted
|
// TODO These are not filtered out by timeline when encrypted
|
||||||
// For now manually ignore
|
// For now manually ignore
|
||||||
if (userPreferencesProvider.shouldShowHiddenEvents()) {
|
if (userPreferencesProvider.shouldShowHiddenEvents()) {
|
||||||
noticeItemFactory.create(event, highlight, callback)
|
noticeItemFactory.create(event, highlight, roomSummaryHolder.roomSummary, callback)
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import im.vector.app.features.home.room.detail.timeline.TimelineEventController
|
||||||
import im.vector.app.features.home.room.detail.timeline.helper.AvatarSizeProvider
|
import im.vector.app.features.home.room.detail.timeline.helper.AvatarSizeProvider
|
||||||
import im.vector.app.features.home.room.detail.timeline.helper.MessageInformationDataFactory
|
import im.vector.app.features.home.room.detail.timeline.helper.MessageInformationDataFactory
|
||||||
import im.vector.app.features.home.room.detail.timeline.helper.MessageItemAttributesFactory
|
import im.vector.app.features.home.room.detail.timeline.helper.MessageItemAttributesFactory
|
||||||
|
import im.vector.app.features.home.room.detail.timeline.helper.RoomSummaryHolder
|
||||||
import im.vector.app.features.home.room.detail.timeline.item.StatusTileTimelineItem
|
import im.vector.app.features.home.room.detail.timeline.item.StatusTileTimelineItem
|
||||||
import im.vector.app.features.home.room.detail.timeline.item.StatusTileTimelineItem_
|
import im.vector.app.features.home.room.detail.timeline.item.StatusTileTimelineItem_
|
||||||
import org.matrix.android.sdk.api.session.Session
|
import org.matrix.android.sdk.api.session.Session
|
||||||
|
@ -50,6 +51,7 @@ class VerificationItemFactory @Inject constructor(
|
||||||
private val avatarSizeProvider: AvatarSizeProvider,
|
private val avatarSizeProvider: AvatarSizeProvider,
|
||||||
private val noticeItemFactory: NoticeItemFactory,
|
private val noticeItemFactory: NoticeItemFactory,
|
||||||
private val userPreferencesProvider: UserPreferencesProvider,
|
private val userPreferencesProvider: UserPreferencesProvider,
|
||||||
|
private val roomSummaryHolder: RoomSummaryHolder,
|
||||||
private val stringProvider: StringProvider,
|
private val stringProvider: StringProvider,
|
||||||
private val session: Session
|
private val session: Session
|
||||||
) {
|
) {
|
||||||
|
@ -151,7 +153,7 @@ class VerificationItemFactory @Inject constructor(
|
||||||
highlight: Boolean,
|
highlight: Boolean,
|
||||||
callback: TimelineEventController.Callback?
|
callback: TimelineEventController.Callback?
|
||||||
): VectorEpoxyModel<*>? {
|
): VectorEpoxyModel<*>? {
|
||||||
if (userPreferencesProvider.shouldShowHiddenEvents()) return noticeItemFactory.create(event, highlight, callback)
|
if (userPreferencesProvider.shouldShowHiddenEvents()) return noticeItemFactory.create(event, highlight, roomSummaryHolder.roomSummary, callback)
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import im.vector.app.core.resources.StringProvider
|
||||||
import me.gujun.android.span.span
|
import me.gujun.android.span.span
|
||||||
import org.matrix.android.sdk.api.session.events.model.EventType
|
import org.matrix.android.sdk.api.session.events.model.EventType
|
||||||
import org.matrix.android.sdk.api.session.events.model.toModel
|
import org.matrix.android.sdk.api.session.events.model.toModel
|
||||||
|
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
||||||
import org.matrix.android.sdk.api.session.room.model.message.MessageOptionsContent
|
import org.matrix.android.sdk.api.session.room.model.message.MessageOptionsContent
|
||||||
import org.matrix.android.sdk.api.session.room.model.message.MessageType
|
import org.matrix.android.sdk.api.session.room.model.message.MessageType
|
||||||
import org.matrix.android.sdk.api.session.room.model.message.OPTION_TYPE_BUTTONS
|
import org.matrix.android.sdk.api.session.room.model.message.OPTION_TYPE_BUTTONS
|
||||||
|
@ -40,7 +41,7 @@ class DisplayableEventFormatter @Inject constructor(
|
||||||
private val noticeEventFormatter: NoticeEventFormatter
|
private val noticeEventFormatter: NoticeEventFormatter
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun format(timelineEvent: TimelineEvent, appendAuthor: Boolean): CharSequence {
|
fun format(timelineEvent: TimelineEvent, appendAuthor: Boolean, roomSummary: RoomSummary?): CharSequence {
|
||||||
if (timelineEvent.root.isRedacted()) {
|
if (timelineEvent.root.isRedacted()) {
|
||||||
return noticeEventFormatter.formatRedactedEvent(timelineEvent.root)
|
return noticeEventFormatter.formatRedactedEvent(timelineEvent.root)
|
||||||
}
|
}
|
||||||
|
@ -130,7 +131,7 @@ class DisplayableEventFormatter @Inject constructor(
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
return span {
|
return span {
|
||||||
text = noticeEventFormatter.format(timelineEvent) ?: ""
|
text = noticeEventFormatter.format(timelineEvent, roomSummary) ?: ""
|
||||||
textStyle = "italic"
|
textStyle = "italic"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ import org.matrix.android.sdk.api.session.room.model.RoomJoinRules
|
||||||
import org.matrix.android.sdk.api.session.room.model.RoomJoinRulesContent
|
import org.matrix.android.sdk.api.session.room.model.RoomJoinRulesContent
|
||||||
import org.matrix.android.sdk.api.session.room.model.RoomMemberContent
|
import org.matrix.android.sdk.api.session.room.model.RoomMemberContent
|
||||||
import org.matrix.android.sdk.api.session.room.model.RoomNameContent
|
import org.matrix.android.sdk.api.session.room.model.RoomNameContent
|
||||||
|
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
||||||
import org.matrix.android.sdk.api.session.room.model.RoomThirdPartyInviteContent
|
import org.matrix.android.sdk.api.session.room.model.RoomThirdPartyInviteContent
|
||||||
import org.matrix.android.sdk.api.session.room.model.RoomTopicContent
|
import org.matrix.android.sdk.api.session.room.model.RoomTopicContent
|
||||||
import org.matrix.android.sdk.api.session.room.model.call.CallInviteContent
|
import org.matrix.android.sdk.api.session.room.model.call.CallInviteContent
|
||||||
|
@ -56,23 +57,26 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
||||||
|
|
||||||
private fun Event.isSentByCurrentUser() = senderId != null && senderId == currentUserId
|
private fun Event.isSentByCurrentUser() = senderId != null && senderId == currentUserId
|
||||||
|
|
||||||
fun format(timelineEvent: TimelineEvent): CharSequence? {
|
private fun RoomSummary?.isDm() = this?.isDirect.orFalse()
|
||||||
|
|
||||||
|
fun format(timelineEvent: TimelineEvent, rs: RoomSummary?): CharSequence? {
|
||||||
return when (val type = timelineEvent.root.getClearType()) {
|
return when (val type = timelineEvent.root.getClearType()) {
|
||||||
EventType.STATE_ROOM_JOIN_RULES -> formatJoinRulesEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
|
EventType.STATE_ROOM_JOIN_RULES -> formatJoinRulesEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName, rs)
|
||||||
EventType.STATE_ROOM_CREATE -> formatRoomCreateEvent(timelineEvent.root)
|
EventType.STATE_ROOM_CREATE -> formatRoomCreateEvent(timelineEvent.root, rs)
|
||||||
EventType.STATE_ROOM_NAME -> formatRoomNameEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
|
EventType.STATE_ROOM_NAME -> formatRoomNameEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
|
||||||
EventType.STATE_ROOM_TOPIC -> formatRoomTopicEvent(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_AVATAR -> formatRoomAvatarEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
|
||||||
EventType.STATE_ROOM_MEMBER -> formatRoomMemberEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
|
EventType.STATE_ROOM_MEMBER -> formatRoomMemberEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName, rs)
|
||||||
EventType.STATE_ROOM_THIRD_PARTY_INVITE -> formatRoomThirdPartyInvite(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
|
EventType.STATE_ROOM_THIRD_PARTY_INVITE -> formatRoomThirdPartyInvite(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName, rs)
|
||||||
EventType.STATE_ROOM_ALIASES -> formatRoomAliasesEvent(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)
|
EventType.STATE_ROOM_CANONICAL_ALIAS -> formatRoomCanonicalAliasEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
|
||||||
EventType.STATE_ROOM_HISTORY_VISIBILITY -> formatRoomHistoryVisibilityEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
|
EventType.STATE_ROOM_HISTORY_VISIBILITY ->
|
||||||
EventType.STATE_ROOM_GUEST_ACCESS -> formatRoomGuestAccessEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
|
formatRoomHistoryVisibilityEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName, rs)
|
||||||
|
EventType.STATE_ROOM_GUEST_ACCESS -> formatRoomGuestAccessEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName, rs)
|
||||||
EventType.STATE_ROOM_ENCRYPTION -> formatRoomEncryptionEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
|
EventType.STATE_ROOM_ENCRYPTION -> formatRoomEncryptionEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
|
||||||
EventType.STATE_ROOM_WIDGET,
|
EventType.STATE_ROOM_WIDGET,
|
||||||
EventType.STATE_ROOM_WIDGET_LEGACY -> formatWidgetEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
|
EventType.STATE_ROOM_WIDGET_LEGACY -> formatWidgetEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
|
||||||
EventType.STATE_ROOM_TOMBSTONE -> formatRoomTombstoneEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
|
EventType.STATE_ROOM_TOMBSTONE -> formatRoomTombstoneEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName, rs)
|
||||||
EventType.STATE_ROOM_POWER_LEVELS -> formatRoomPowerLevels(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
|
EventType.STATE_ROOM_POWER_LEVELS -> formatRoomPowerLevels(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
|
||||||
EventType.CALL_INVITE,
|
EventType.CALL_INVITE,
|
||||||
EventType.CALL_CANDIDATES,
|
EventType.CALL_CANDIDATES,
|
||||||
|
@ -151,19 +155,19 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun format(event: Event, senderName: String?): CharSequence? {
|
fun format(event: Event, senderName: String?, rs: RoomSummary?): CharSequence? {
|
||||||
return when (val type = event.getClearType()) {
|
return when (val type = event.getClearType()) {
|
||||||
EventType.STATE_ROOM_JOIN_RULES -> formatJoinRulesEvent(event, senderName)
|
EventType.STATE_ROOM_JOIN_RULES -> formatJoinRulesEvent(event, senderName, rs)
|
||||||
EventType.STATE_ROOM_NAME -> formatRoomNameEvent(event, senderName)
|
EventType.STATE_ROOM_NAME -> formatRoomNameEvent(event, senderName)
|
||||||
EventType.STATE_ROOM_TOPIC -> formatRoomTopicEvent(event, senderName)
|
EventType.STATE_ROOM_TOPIC -> formatRoomTopicEvent(event, senderName)
|
||||||
EventType.STATE_ROOM_AVATAR -> formatRoomAvatarEvent(event, senderName)
|
EventType.STATE_ROOM_AVATAR -> formatRoomAvatarEvent(event, senderName)
|
||||||
EventType.STATE_ROOM_MEMBER -> formatRoomMemberEvent(event, senderName)
|
EventType.STATE_ROOM_MEMBER -> formatRoomMemberEvent(event, senderName, rs)
|
||||||
EventType.STATE_ROOM_THIRD_PARTY_INVITE -> formatRoomThirdPartyInvite(event, senderName)
|
EventType.STATE_ROOM_THIRD_PARTY_INVITE -> formatRoomThirdPartyInvite(event, senderName, rs)
|
||||||
EventType.STATE_ROOM_HISTORY_VISIBILITY -> formatRoomHistoryVisibilityEvent(event, senderName)
|
EventType.STATE_ROOM_HISTORY_VISIBILITY -> formatRoomHistoryVisibilityEvent(event, senderName, rs)
|
||||||
EventType.CALL_INVITE,
|
EventType.CALL_INVITE,
|
||||||
EventType.CALL_HANGUP,
|
EventType.CALL_HANGUP,
|
||||||
EventType.CALL_ANSWER -> formatCallEvent(type, event, senderName)
|
EventType.CALL_ANSWER -> formatCallEvent(type, event, senderName)
|
||||||
EventType.STATE_ROOM_TOMBSTONE -> formatRoomTombstoneEvent(event, senderName)
|
EventType.STATE_ROOM_TOMBSTONE -> formatRoomTombstoneEvent(event, senderName, rs)
|
||||||
else -> {
|
else -> {
|
||||||
Timber.v("Type $type not handled by this formatter")
|
Timber.v("Type $type not handled by this formatter")
|
||||||
null
|
null
|
||||||
|
@ -175,14 +179,14 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
||||||
return "{ \"type\": ${event.getClearType()} }"
|
return "{ \"type\": ${event.getClearType()} }"
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun formatRoomCreateEvent(event: Event): CharSequence? {
|
private fun formatRoomCreateEvent(event: Event, rs: RoomSummary?): CharSequence? {
|
||||||
return event.getClearContent().toModel<RoomCreateContent>()
|
return event.getClearContent().toModel<RoomCreateContent>()
|
||||||
?.takeIf { it.creator.isNullOrBlank().not() }
|
?.takeIf { it.creator.isNullOrBlank().not() }
|
||||||
?.let {
|
?.let {
|
||||||
if (event.isSentByCurrentUser()) {
|
if (event.isSentByCurrentUser()) {
|
||||||
sp.getString(R.string.notice_room_created_by_you)
|
sp.getString(if (rs.isDm()) R.string.notice_direct_room_created_by_you else R.string.notice_room_created_by_you)
|
||||||
} else {
|
} else {
|
||||||
sp.getString(R.string.notice_room_created, it.creator)
|
sp.getString(if (rs.isDm()) R.string.notice_direct_room_created else R.string.notice_room_created, it.creator)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,11 +208,11 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun formatRoomTombstoneEvent(event: Event, senderName: String?): CharSequence? {
|
private fun formatRoomTombstoneEvent(event: Event, senderName: String?, rs: RoomSummary?): CharSequence? {
|
||||||
return if (event.isSentByCurrentUser()) {
|
return if (event.isSentByCurrentUser()) {
|
||||||
sp.getString(R.string.notice_room_update_by_you)
|
sp.getString(if (rs.isDm()) R.string.notice_direct_room_update_by_you else R.string.notice_room_update_by_you)
|
||||||
} else {
|
} else {
|
||||||
sp.getString(R.string.notice_room_update, senderName)
|
sp.getString(if (rs.isDm()) R.string.notice_direct_room_update else R.string.notice_room_update, senderName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,18 +250,20 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun formatRoomHistoryVisibilityEvent(event: Event, senderName: String?): CharSequence? {
|
private fun formatRoomHistoryVisibilityEvent(event: Event, senderName: String?, rs: RoomSummary?): CharSequence? {
|
||||||
val historyVisibility = event.getClearContent().toModel<RoomHistoryVisibilityContent>()?.historyVisibility ?: return null
|
val historyVisibility = event.getClearContent().toModel<RoomHistoryVisibilityContent>()?.historyVisibility ?: return null
|
||||||
|
|
||||||
val formattedVisibility = roomHistoryVisibilityFormatter.format(historyVisibility)
|
val formattedVisibility = roomHistoryVisibilityFormatter.format(historyVisibility)
|
||||||
return if (event.isSentByCurrentUser()) {
|
return if (event.isSentByCurrentUser()) {
|
||||||
sp.getString(R.string.notice_made_future_room_visibility_by_you, formattedVisibility)
|
sp.getString(if (rs.isDm()) R.string.notice_made_future_direct_room_visibility_by_you else R.string.notice_made_future_room_visibility_by_you,
|
||||||
|
formattedVisibility)
|
||||||
} else {
|
} else {
|
||||||
sp.getString(R.string.notice_made_future_room_visibility, senderName, formattedVisibility)
|
sp.getString(if (rs.isDm()) R.string.notice_made_future_direct_room_visibility else R.string.notice_made_future_room_visibility,
|
||||||
|
senderName, formattedVisibility)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun formatRoomThirdPartyInvite(event: Event, senderName: String?): CharSequence? {
|
private fun formatRoomThirdPartyInvite(event: Event, senderName: String?, rs: RoomSummary?): CharSequence? {
|
||||||
val content = event.getClearContent().toModel<RoomThirdPartyInviteContent>()
|
val content = event.getClearContent().toModel<RoomThirdPartyInviteContent>()
|
||||||
val prevContent = event.resolvedPrevContent()?.toModel<RoomThirdPartyInviteContent>()
|
val prevContent = event.resolvedPrevContent()?.toModel<RoomThirdPartyInviteContent>()
|
||||||
|
|
||||||
|
@ -265,17 +271,26 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
||||||
prevContent != null -> {
|
prevContent != null -> {
|
||||||
// Revoke case
|
// Revoke case
|
||||||
if (event.isSentByCurrentUser()) {
|
if (event.isSentByCurrentUser()) {
|
||||||
sp.getString(R.string.notice_room_third_party_revoked_invite_by_you, prevContent.displayName)
|
sp.getString(
|
||||||
|
if (rs.isDm()) {
|
||||||
|
R.string.notice_direct_room_third_party_revoked_invite_by_you
|
||||||
|
} else {
|
||||||
|
R.string.notice_room_third_party_revoked_invite_by_you
|
||||||
|
},
|
||||||
|
prevContent.displayName)
|
||||||
} else {
|
} else {
|
||||||
sp.getString(R.string.notice_room_third_party_revoked_invite, senderName, prevContent.displayName)
|
sp.getString(if (rs.isDm()) R.string.notice_direct_room_third_party_revoked_invite else R.string.notice_room_third_party_revoked_invite,
|
||||||
|
senderName, prevContent.displayName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
content != null -> {
|
content != null -> {
|
||||||
// Invitation case
|
// Invitation case
|
||||||
if (event.isSentByCurrentUser()) {
|
if (event.isSentByCurrentUser()) {
|
||||||
sp.getString(R.string.notice_room_third_party_invite_by_you, content.displayName)
|
sp.getString(if (rs.isDm()) R.string.notice_direct_room_third_party_invite_by_you else R.string.notice_room_third_party_invite_by_you,
|
||||||
|
content.displayName)
|
||||||
} else {
|
} else {
|
||||||
sp.getString(R.string.notice_room_third_party_invite, senderName, content.displayName)
|
sp.getString(if (rs.isDm()) R.string.notice_direct_room_third_party_invite else R.string.notice_room_third_party_invite,
|
||||||
|
senderName, content.displayName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> null
|
else -> null
|
||||||
|
@ -323,13 +338,13 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun formatRoomMemberEvent(event: Event, senderName: String?): String? {
|
private fun formatRoomMemberEvent(event: Event, senderName: String?, rs: RoomSummary?): String? {
|
||||||
val eventContent: RoomMemberContent? = event.getClearContent().toModel()
|
val eventContent: RoomMemberContent? = event.getClearContent().toModel()
|
||||||
val prevEventContent: RoomMemberContent? = event.resolvedPrevContent().toModel()
|
val prevEventContent: RoomMemberContent? = event.resolvedPrevContent().toModel()
|
||||||
val isMembershipEvent = prevEventContent?.membership != eventContent?.membership
|
val isMembershipEvent = prevEventContent?.membership != eventContent?.membership
|
||||||
|| eventContent?.membership == Membership.LEAVE
|
|| eventContent?.membership == Membership.LEAVE
|
||||||
return if (isMembershipEvent) {
|
return if (isMembershipEvent) {
|
||||||
buildMembershipNotice(event, senderName, eventContent, prevEventContent)
|
buildMembershipNotice(event, senderName, eventContent, prevEventContent, rs)
|
||||||
} else {
|
} else {
|
||||||
buildProfileNotice(event, senderName, eventContent, prevEventContent)
|
buildProfileNotice(event, senderName, eventContent, prevEventContent)
|
||||||
}
|
}
|
||||||
|
@ -387,20 +402,26 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun formatRoomGuestAccessEvent(event: Event, senderName: String?): String? {
|
private fun formatRoomGuestAccessEvent(event: Event, senderName: String?, rs: RoomSummary?): String? {
|
||||||
val eventContent: RoomGuestAccessContent? = event.getClearContent().toModel()
|
val eventContent: RoomGuestAccessContent? = event.getClearContent().toModel()
|
||||||
return when (eventContent?.guestAccess) {
|
return when (eventContent?.guestAccess) {
|
||||||
GuestAccess.CanJoin ->
|
GuestAccess.CanJoin ->
|
||||||
if (event.isSentByCurrentUser()) {
|
if (event.isSentByCurrentUser()) {
|
||||||
sp.getString(R.string.notice_room_guest_access_can_join_by_you)
|
sp.getString(
|
||||||
|
if (rs.isDm()) R.string.notice_direct_room_guest_access_can_join_by_you else R.string.notice_room_guest_access_can_join_by_you
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
sp.getString(R.string.notice_room_guest_access_can_join, senderName)
|
sp.getString(if (rs.isDm()) R.string.notice_direct_room_guest_access_can_join else R.string.notice_room_guest_access_can_join,
|
||||||
|
senderName)
|
||||||
}
|
}
|
||||||
GuestAccess.Forbidden ->
|
GuestAccess.Forbidden ->
|
||||||
if (event.isSentByCurrentUser()) {
|
if (event.isSentByCurrentUser()) {
|
||||||
sp.getString(R.string.notice_room_guest_access_forbidden_by_you)
|
sp.getString(
|
||||||
|
if (rs.isDm()) R.string.notice_direct_room_guest_access_forbidden_by_you else R.string.notice_room_guest_access_forbidden_by_you
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
sp.getString(R.string.notice_room_guest_access_forbidden, senderName)
|
sp.getString(if (rs.isDm()) R.string.notice_direct_room_guest_access_forbidden else R.string.notice_room_guest_access_forbidden,
|
||||||
|
senderName)
|
||||||
}
|
}
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
@ -476,7 +497,11 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
||||||
return displayText.toString()
|
return displayText.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildMembershipNotice(event: Event, senderName: String?, eventContent: RoomMemberContent?, prevEventContent: RoomMemberContent?): String? {
|
private fun buildMembershipNotice(event: Event,
|
||||||
|
senderName: String?,
|
||||||
|
eventContent: RoomMemberContent?,
|
||||||
|
prevEventContent: RoomMemberContent?,
|
||||||
|
rs: RoomSummary?): String? {
|
||||||
val senderDisplayName = senderName ?: event.senderId ?: ""
|
val senderDisplayName = senderName ?: event.senderId ?: ""
|
||||||
val targetDisplayName = eventContent?.displayName ?: prevEventContent?.displayName ?: event.stateKey ?: ""
|
val targetDisplayName = eventContent?.displayName ?: prevEventContent?.displayName ?: event.stateKey ?: ""
|
||||||
return when (eventContent?.membership) {
|
return when (eventContent?.membership) {
|
||||||
|
@ -524,14 +549,21 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Membership.JOIN ->
|
Membership.JOIN ->
|
||||||
if (event.isSentByCurrentUser()) {
|
eventContent.safeReason?.let { reason ->
|
||||||
eventContent.safeReason?.let { reason ->
|
if (event.isSentByCurrentUser()) {
|
||||||
sp.getString(R.string.notice_room_join_with_reason_by_you, reason)
|
sp.getString(if (rs.isDm()) R.string.notice_direct_room_join_with_reason_by_you else R.string.notice_room_join_with_reason_by_you,
|
||||||
} ?: sp.getString(R.string.notice_room_join_by_you)
|
reason)
|
||||||
} else {
|
} else {
|
||||||
eventContent.safeReason?.let { reason ->
|
sp.getString(if (rs.isDm()) R.string.notice_direct_room_join_with_reason else R.string.notice_room_join_with_reason,
|
||||||
sp.getString(R.string.notice_room_join_with_reason, senderDisplayName, reason)
|
senderDisplayName, reason)
|
||||||
} ?: sp.getString(R.string.notice_room_join, senderDisplayName)
|
}
|
||||||
|
} ?: run {
|
||||||
|
if (event.isSentByCurrentUser()) {
|
||||||
|
sp.getString(if (rs.isDm()) R.string.notice_direct_room_join_by_you else R.string.notice_room_join_by_you)
|
||||||
|
} else {
|
||||||
|
sp.getString(if (rs.isDm()) R.string.notice_direct_room_join else R.string.notice_room_join,
|
||||||
|
senderDisplayName)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Membership.LEAVE ->
|
Membership.LEAVE ->
|
||||||
// 2 cases here: this member may have left voluntarily or they may have been "left" by someone else ie. kicked
|
// 2 cases here: this member may have left voluntarily or they may have been "left" by someone else ie. kicked
|
||||||
|
@ -548,14 +580,27 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
||||||
} ?: sp.getString(R.string.notice_room_reject, senderDisplayName)
|
} ?: sp.getString(R.string.notice_room_reject, senderDisplayName)
|
||||||
}
|
}
|
||||||
else ->
|
else ->
|
||||||
if (event.isSentByCurrentUser()) {
|
eventContent.safeReason?.let { reason ->
|
||||||
eventContent.safeReason?.let { reason ->
|
if (event.isSentByCurrentUser()) {
|
||||||
sp.getString(R.string.notice_room_leave_with_reason_by_you, reason)
|
sp.getString(
|
||||||
} ?: sp.getString(R.string.notice_room_leave_by_you)
|
if (rs.isDm()) {
|
||||||
} else {
|
R.string.notice_direct_room_leave_with_reason_by_you
|
||||||
eventContent.safeReason?.let { reason ->
|
} else {
|
||||||
sp.getString(R.string.notice_room_leave_with_reason, senderDisplayName, reason)
|
R.string.notice_room_leave_with_reason_by_you
|
||||||
} ?: sp.getString(R.string.notice_room_leave, senderDisplayName)
|
},
|
||||||
|
reason
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
sp.getString(if (rs.isDm()) R.string.notice_direct_room_leave_with_reason else R.string.notice_room_leave_with_reason,
|
||||||
|
senderDisplayName, reason)
|
||||||
|
}
|
||||||
|
} ?: run {
|
||||||
|
if (event.isSentByCurrentUser()) {
|
||||||
|
sp.getString(if (rs.isDm()) R.string.notice_direct_room_leave_by_you else R.string.notice_room_leave_by_you)
|
||||||
|
} else {
|
||||||
|
sp.getString(if (rs.isDm()) R.string.notice_direct_room_leave else R.string.notice_room_leave,
|
||||||
|
senderDisplayName)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -618,14 +663,15 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun formatJoinRulesEvent(event: Event, senderName: String?): CharSequence? {
|
private fun formatJoinRulesEvent(event: Event, senderName: String?, rs: RoomSummary?): CharSequence? {
|
||||||
val content = event.getClearContent().toModel<RoomJoinRulesContent>() ?: return null
|
val content = event.getClearContent().toModel<RoomJoinRulesContent>() ?: return null
|
||||||
return when (content.joinRules) {
|
return when (content.joinRules) {
|
||||||
RoomJoinRules.INVITE ->
|
RoomJoinRules.INVITE ->
|
||||||
if (event.isSentByCurrentUser()) {
|
if (event.isSentByCurrentUser()) {
|
||||||
sp.getString(R.string.room_join_rules_invite_by_you)
|
sp.getString(if (rs.isDm()) R.string.direct_room_join_rules_invite_by_you else R.string.room_join_rules_invite_by_you)
|
||||||
} else {
|
} else {
|
||||||
sp.getString(R.string.room_join_rules_invite, senderName)
|
sp.getString(if (rs.isDm()) R.string.direct_room_join_rules_invite else R.string.room_join_rules_invite,
|
||||||
|
senderName)
|
||||||
}
|
}
|
||||||
RoomJoinRules.PUBLIC ->
|
RoomJoinRules.PUBLIC ->
|
||||||
if (event.isSentByCurrentUser()) {
|
if (event.isSentByCurrentUser()) {
|
||||||
|
|
|
@ -62,7 +62,8 @@ abstract class BasedMergedItem<H : BasedMergedItem.Holder> : BaseEventItem<H>()
|
||||||
val eventId: String,
|
val eventId: String,
|
||||||
val userId: String,
|
val userId: String,
|
||||||
val memberName: String,
|
val memberName: String,
|
||||||
val avatarUrl: String?
|
val avatarUrl: String?,
|
||||||
|
val isDirectRoom: Boolean
|
||||||
)
|
)
|
||||||
|
|
||||||
fun Data.toMatrixItem() = MatrixItem.UserItem(userId, memberName, avatarUrl)
|
fun Data.toMatrixItem() = MatrixItem.UserItem(userId, memberName, avatarUrl)
|
||||||
|
|
|
@ -48,9 +48,17 @@ abstract class MergedRoomCreationItem : BasedMergedItem<MergedRoomCreationItem.H
|
||||||
|
|
||||||
val createdFromCurrentUser = data?.userId == attributes.currentUserId
|
val createdFromCurrentUser = data?.userId == attributes.currentUserId
|
||||||
val summary = if (createdFromCurrentUser) {
|
val summary = if (createdFromCurrentUser) {
|
||||||
holder.expandView.resources.getString(R.string.room_created_summary_item_by_you)
|
if (data?.isDirectRoom == true) {
|
||||||
|
holder.expandView.resources.getString(R.string.direct_room_created_summary_item_by_you)
|
||||||
|
} else {
|
||||||
|
holder.expandView.resources.getString(R.string.room_created_summary_item_by_you)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
holder.expandView.resources.getString(R.string.room_created_summary_item, data?.memberName ?: data?.userId ?: "")
|
if (data?.isDirectRoom == true) {
|
||||||
|
holder.expandView.resources.getString(R.string.direct_room_created_summary_item, data.memberName)
|
||||||
|
} else {
|
||||||
|
holder.expandView.resources.getString(R.string.room_created_summary_item, data?.memberName ?: data?.userId ?: "")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
holder.summaryView.text = summary
|
holder.summaryView.text = summary
|
||||||
holder.summaryView.visibility = View.VISIBLE
|
holder.summaryView.visibility = View.VISIBLE
|
||||||
|
@ -69,7 +77,11 @@ abstract class MergedRoomCreationItem : BasedMergedItem<MergedRoomCreationItem.H
|
||||||
}
|
}
|
||||||
if (attributes.isEncryptionAlgorithmSecure) {
|
if (attributes.isEncryptionAlgorithmSecure) {
|
||||||
holder.e2eTitleTextView.text = holder.expandView.resources.getString(R.string.encryption_enabled)
|
holder.e2eTitleTextView.text = holder.expandView.resources.getString(R.string.encryption_enabled)
|
||||||
holder.e2eTitleDescriptionView.text = holder.expandView.resources.getString(R.string.encryption_enabled_tile_description)
|
holder.e2eTitleDescriptionView.text = if (data?.isDirectRoom == true) {
|
||||||
|
holder.expandView.resources.getString(R.string.direct_room_encryption_enabled_tile_description)
|
||||||
|
} else {
|
||||||
|
holder.expandView.resources.getString(R.string.encryption_enabled_tile_description)
|
||||||
|
}
|
||||||
holder.e2eTitleDescriptionView.textAlignment = View.TEXT_ALIGNMENT_CENTER
|
holder.e2eTitleDescriptionView.textAlignment = View.TEXT_ALIGNMENT_CENTER
|
||||||
holder.e2eTitleTextView.setCompoundDrawablesWithIntrinsicBounds(
|
holder.e2eTitleTextView.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
ContextCompat.getDrawable(holder.view.context, R.drawable.ic_shield_black),
|
ContextCompat.getDrawable(holder.view.context, R.drawable.ic_shield_black),
|
||||||
|
|
|
@ -86,7 +86,7 @@ class RoomSummaryItemFactory @Inject constructor(private val displayableEventFor
|
||||||
var latestEventTime: CharSequence = ""
|
var latestEventTime: CharSequence = ""
|
||||||
val latestEvent = roomSummary.latestPreviewableEvent
|
val latestEvent = roomSummary.latestPreviewableEvent
|
||||||
if (latestEvent != null) {
|
if (latestEvent != null) {
|
||||||
latestFormattedEvent = displayableEventFormatter.format(latestEvent, roomSummary.isDirect.not())
|
latestFormattedEvent = displayableEventFormatter.format(latestEvent, roomSummary.isDirect.not(), roomSummary)
|
||||||
latestEventTime = dateFormatter.format(latestEvent.root.originServerTs, DateFormatKind.ROOM_LIST)
|
latestEventTime = dateFormatter.format(latestEvent.root.originServerTs, DateFormatKind.ROOM_LIST)
|
||||||
}
|
}
|
||||||
val typingMessage = typingHelper.getTypingMessage(roomSummary.typingUsers)
|
val typingMessage = typingHelper.getTypingMessage(roomSummary.typingUsers)
|
||||||
|
|
|
@ -91,7 +91,7 @@ class NotifiableEventResolver @Inject constructor(private val stringProvider: St
|
||||||
if (room == null) {
|
if (room == null) {
|
||||||
Timber.e("## Unable to resolve room for eventId [$event]")
|
Timber.e("## Unable to resolve room for eventId [$event]")
|
||||||
// Ok room is not known in store, but we can still display something
|
// Ok room is not known in store, but we can still display something
|
||||||
val body = displayableEventFormatter.format(event, false)
|
val body = displayableEventFormatter.format(event, false, null)
|
||||||
val roomName = stringProvider.getString(R.string.notification_unknown_room_name)
|
val roomName = stringProvider.getString(R.string.notification_unknown_room_name)
|
||||||
val senderDisplayName = event.senderInfo.disambiguatedDisplayName
|
val senderDisplayName = event.senderInfo.disambiguatedDisplayName
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ class NotifiableEventResolver @Inject constructor(private val stringProvider: St
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val body = displayableEventFormatter.format(event, false).toString()
|
val body = displayableEventFormatter.format(event, false, room.roomSummary()).toString()
|
||||||
val roomName = room.roomSummary()?.displayName ?: ""
|
val roomName = room.roomSummary()?.displayName ?: ""
|
||||||
val senderDisplayName = event.senderInfo.disambiguatedDisplayName
|
val senderDisplayName = event.senderInfo.disambiguatedDisplayName
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ class NotifiableEventResolver @Inject constructor(private val stringProvider: St
|
||||||
val roomId = event.roomId ?: return null
|
val roomId = event.roomId ?: return null
|
||||||
val dName = event.senderId?.let { session.getUser(it)?.displayName }
|
val dName = event.senderId?.let { session.getUser(it)?.displayName }
|
||||||
if (Membership.INVITE == content.membership) {
|
if (Membership.INVITE == content.membership) {
|
||||||
val body = noticeEventFormatter.format(event, dName)
|
val body = noticeEventFormatter.format(event, dName, session.getRoomSummary(roomId))
|
||||||
?: stringProvider.getString(R.string.notification_new_invitation)
|
?: stringProvider.getString(R.string.notification_new_invitation)
|
||||||
return InviteNotifiableEvent(
|
return InviteNotifiableEvent(
|
||||||
session.myUserId,
|
session.myUserId,
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
package im.vector.app.features.roomprofile
|
package im.vector.app.features.roomprofile
|
||||||
|
|
||||||
import com.airbnb.epoxy.TypedEpoxyController
|
import com.airbnb.epoxy.TypedEpoxyController
|
||||||
import org.matrix.android.sdk.api.crypto.RoomEncryptionTrustLevel
|
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.epoxy.profiles.buildProfileAction
|
import im.vector.app.core.epoxy.profiles.buildProfileAction
|
||||||
import im.vector.app.core.epoxy.profiles.buildProfileSection
|
import im.vector.app.core.epoxy.profiles.buildProfileSection
|
||||||
|
@ -26,6 +25,7 @@ import im.vector.app.core.resources.ColorProvider
|
||||||
import im.vector.app.core.resources.StringProvider
|
import im.vector.app.core.resources.StringProvider
|
||||||
import im.vector.app.core.ui.list.genericFooterItem
|
import im.vector.app.core.ui.list.genericFooterItem
|
||||||
import im.vector.app.features.settings.VectorPreferences
|
import im.vector.app.features.settings.VectorPreferences
|
||||||
|
import org.matrix.android.sdk.api.crypto.RoomEncryptionTrustLevel
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class RoomProfileController @Inject constructor(
|
class RoomProfileController @Inject constructor(
|
||||||
|
@ -57,9 +57,9 @@ class RoomProfileController @Inject constructor(
|
||||||
// Security
|
// Security
|
||||||
buildProfileSection(stringProvider.getString(R.string.room_profile_section_security))
|
buildProfileSection(stringProvider.getString(R.string.room_profile_section_security))
|
||||||
val learnMoreSubtitle = if (roomSummary.isEncrypted) {
|
val learnMoreSubtitle = if (roomSummary.isEncrypted) {
|
||||||
R.string.room_profile_encrypted_subtitle
|
if (roomSummary.isDirect) R.string.direct_room_profile_encrypted_subtitle else R.string.room_profile_encrypted_subtitle
|
||||||
} else {
|
} else {
|
||||||
R.string.room_profile_not_encrypted_subtitle
|
if (roomSummary.isDirect) R.string.direct_room_profile_not_encrypted_subtitle else R.string.room_profile_not_encrypted_subtitle
|
||||||
}
|
}
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("e2e info")
|
id("e2e info")
|
||||||
|
@ -71,7 +71,11 @@ class RoomProfileController @Inject constructor(
|
||||||
buildProfileSection(stringProvider.getString(R.string.room_profile_section_more))
|
buildProfileSection(stringProvider.getString(R.string.room_profile_section_more))
|
||||||
buildProfileAction(
|
buildProfileAction(
|
||||||
id = "settings",
|
id = "settings",
|
||||||
title = stringProvider.getString(R.string.room_profile_section_more_settings),
|
title = stringProvider.getString(if (roomSummary.isDirect) {
|
||||||
|
R.string.direct_room_profile_section_more_settings
|
||||||
|
} else {
|
||||||
|
R.string.room_profile_section_more_settings
|
||||||
|
}),
|
||||||
dividerColor = dividerColor,
|
dividerColor = dividerColor,
|
||||||
icon = R.drawable.ic_room_profile_settings,
|
icon = R.drawable.ic_room_profile_settings,
|
||||||
action = { callback?.onSettingsClicked() }
|
action = { callback?.onSettingsClicked() }
|
||||||
|
@ -112,7 +116,11 @@ class RoomProfileController @Inject constructor(
|
||||||
)
|
)
|
||||||
buildProfileAction(
|
buildProfileAction(
|
||||||
id = "leave",
|
id = "leave",
|
||||||
title = stringProvider.getString(R.string.room_profile_section_more_leave),
|
title = stringProvider.getString(if (roomSummary.isDirect) {
|
||||||
|
R.string.direct_room_profile_section_more_leave
|
||||||
|
} else {
|
||||||
|
R.string.room_profile_section_more_leave
|
||||||
|
}),
|
||||||
dividerColor = dividerColor,
|
dividerColor = dividerColor,
|
||||||
divider = false,
|
divider = false,
|
||||||
destructive = true,
|
destructive = true,
|
||||||
|
|
|
@ -89,7 +89,9 @@
|
||||||
<string name="missing_permissions_error">"Due to missing permissions, this action is not possible.</string>
|
<string name="missing_permissions_error">"Due to missing permissions, this action is not possible.</string>
|
||||||
<string name="missing_permissions_to_start_conf_call">You need permission to invite to start a conference in this room</string>
|
<string name="missing_permissions_to_start_conf_call">You need permission to invite to start a conference in this room</string>
|
||||||
<string name="no_permissions_to_start_conf_call">You do not have permission to start a conference call in this room</string>
|
<string name="no_permissions_to_start_conf_call">You do not have permission to start a conference call in this room</string>
|
||||||
|
<string name="no_permissions_to_start_conf_call_in_direct_room">You do not have permission to start a conference call</string>
|
||||||
<string name="no_permissions_to_start_webrtc_call">You do not have permission to start a call in this room</string>
|
<string name="no_permissions_to_start_webrtc_call">You do not have permission to start a call in this room</string>
|
||||||
|
<string name="no_permissions_to_start_webrtc_call_in_direct_room">You do not have permission to start a call</string>
|
||||||
<string name="conference_call_in_progress">A conference is already in progress!</string>
|
<string name="conference_call_in_progress">A conference is already in progress!</string>
|
||||||
<string name="video_meeting">Start video meeting</string>
|
<string name="video_meeting">Start video meeting</string>
|
||||||
<string name="audio_meeting">Start audio meeting</string>
|
<string name="audio_meeting">Start audio meeting</string>
|
||||||
|
@ -1881,6 +1883,8 @@
|
||||||
<string name="room_join_rules_public_by_you">You made the room public to whoever knows the link.</string>
|
<string name="room_join_rules_public_by_you">You made the room public to whoever knows the link.</string>
|
||||||
<string name="room_join_rules_invite">%1$s made the room invite only.</string>
|
<string name="room_join_rules_invite">%1$s made the room invite only.</string>
|
||||||
<string name="room_join_rules_invite_by_you">You made the room invite only.</string>
|
<string name="room_join_rules_invite_by_you">You made the room invite only.</string>
|
||||||
|
<string name="direct_room_join_rules_invite">%1$s made this invite only.</string>
|
||||||
|
<string name="direct_room_join_rules_invite_by_you">You made this invite only.</string>
|
||||||
<string name="timeline_unread_messages">Unread messages</string>
|
<string name="timeline_unread_messages">Unread messages</string>
|
||||||
|
|
||||||
<string name="login_splash_title">It\'s your conversation. Own it.</string>
|
<string name="login_splash_title">It\'s your conversation. Own it.</string>
|
||||||
|
@ -2113,12 +2117,15 @@
|
||||||
<string name="verification_request_waiting_for">Waiting for %s…</string>
|
<string name="verification_request_waiting_for">Waiting for %s…</string>
|
||||||
<string name="verification_request_alert_description">For extra security, verify %s by checking a one-time code on both your devices.\n\nFor maximum security, do this in person.</string>
|
<string name="verification_request_alert_description">For extra security, verify %s by checking a one-time code on both your devices.\n\nFor maximum security, do this in person.</string>
|
||||||
<string name="room_profile_not_encrypted_subtitle">Messages in this room are not end-to-end encrypted.</string>
|
<string name="room_profile_not_encrypted_subtitle">Messages in this room are not end-to-end encrypted.</string>
|
||||||
|
<string name="direct_room_profile_not_encrypted_subtitle">Messages here are not end-to-end encrypted.</string>
|
||||||
<string name="room_profile_encrypted_subtitle">Messages in this room are end-to-end encrypted.\n\nYour messages are secured with locks and only you and the recipient have the unique keys to unlock them.</string>
|
<string name="room_profile_encrypted_subtitle">Messages in this room are end-to-end encrypted.\n\nYour messages are secured with locks and only you and the recipient have the unique keys to unlock them.</string>
|
||||||
|
<string name="direct_room_profile_encrypted_subtitle">Messages here are end-to-end encrypted.\n\nYour messages are secured with locks and only you and the recipient have the unique keys to unlock them.</string>
|
||||||
<string name="room_profile_section_security">Security</string>
|
<string name="room_profile_section_security">Security</string>
|
||||||
<string name="room_profile_section_security_learn_more">Learn more</string>
|
<string name="room_profile_section_security_learn_more">Learn more</string>
|
||||||
<string name="room_profile_section_more">More</string>
|
<string name="room_profile_section_more">More</string>
|
||||||
<string name="room_profile_section_admin">Admin Actions</string>
|
<string name="room_profile_section_admin">Admin Actions</string>
|
||||||
<string name="room_profile_section_more_settings">Room settings</string>
|
<string name="room_profile_section_more_settings">Room settings</string>
|
||||||
|
<string name="direct_room_profile_section_more_settings">Settings</string>
|
||||||
<string name="room_profile_section_more_notifications">Notifications</string>
|
<string name="room_profile_section_more_notifications">Notifications</string>
|
||||||
<plurals name="room_profile_section_more_member_list">
|
<plurals name="room_profile_section_more_member_list">
|
||||||
<item quantity="one">"One person"</item>
|
<item quantity="one">"One person"</item>
|
||||||
|
@ -2126,6 +2133,7 @@
|
||||||
</plurals>
|
</plurals>
|
||||||
<string name="room_profile_section_more_uploads">Uploads</string>
|
<string name="room_profile_section_more_uploads">Uploads</string>
|
||||||
<string name="room_profile_section_more_leave">Leave Room</string>
|
<string name="room_profile_section_more_leave">Leave Room</string>
|
||||||
|
<string name="direct_room_profile_section_more_leave">Leave</string>
|
||||||
<string name="room_profile_leaving_room">"Leaving the room…"</string>
|
<string name="room_profile_leaving_room">"Leaving the room…"</string>
|
||||||
|
|
||||||
<string name="room_member_power_level_admins">Admins</string>
|
<string name="room_member_power_level_admins">Admins</string>
|
||||||
|
@ -2355,11 +2363,14 @@
|
||||||
|
|
||||||
<string name="encryption_enabled">Encryption enabled</string>
|
<string name="encryption_enabled">Encryption enabled</string>
|
||||||
<string name="encryption_enabled_tile_description">Messages in this room are end-to-end encrypted. Learn more & verify users in their profile.</string>
|
<string name="encryption_enabled_tile_description">Messages in this room are end-to-end encrypted. Learn more & verify users in their profile.</string>
|
||||||
|
<string name="direct_room_encryption_enabled_tile_description">Messages in this room are end-to-end encrypted.</string>
|
||||||
<string name="encryption_not_enabled">Encryption not enabled</string>
|
<string name="encryption_not_enabled">Encryption not enabled</string>
|
||||||
<string name="encryption_unknown_algorithm_tile_description">The encryption used by this room is not supported</string>
|
<string name="encryption_unknown_algorithm_tile_description">The encryption used by this room is not supported</string>
|
||||||
|
|
||||||
<string name="room_created_summary_item">%s created and configured the room.</string>
|
<string name="room_created_summary_item">%s created and configured the room.</string>
|
||||||
<string name="room_created_summary_item_by_you">You created and configured the room.</string>
|
<string name="room_created_summary_item_by_you">You created and configured the room.</string>
|
||||||
|
<string name="direct_room_created_summary_item">%s joined.</string>
|
||||||
|
<string name="direct_room_created_summary_item_by_you">You joined.</string>
|
||||||
|
|
||||||
<string name="qr_code_scanned_self_verif_notice">Almost there! Is the other device showing the same shield?</string>
|
<string name="qr_code_scanned_self_verif_notice">Almost there! Is the other device showing the same shield?</string>
|
||||||
<string name="qr_code_scanned_verif_waiting_notice">Almost there! Waiting for confirmation…</string>
|
<string name="qr_code_scanned_verif_waiting_notice">Almost there! Waiting for confirmation…</string>
|
||||||
|
|
Loading…
Reference in a new issue