ktlint format

This commit is contained in:
ariskotsomitopoulos 2022-01-27 18:39:43 +02:00
parent bac6d271ca
commit 78dfac52a7
9 changed files with 7 additions and 16 deletions

View File

@ -92,7 +92,6 @@ interface TimelineService {
*/ */
fun mapEventsWithEdition(threads: List<TimelineEvent>): List<TimelineEvent> fun mapEventsWithEdition(threads: List<TimelineEvent>): List<TimelineEvent>
/** /**
* Marks the current thread as read. This is a local implementation * Marks the current thread as read. This is a local implementation
* @param rootThreadEventId the eventId of the current thread * @param rootThreadEventId the eventId of the current thread

View File

@ -45,7 +45,6 @@ internal fun Map<String, EventEntity>.updateThreadSummaryIfNeeded(
realm: Realm, currentUserId: String, realm: Realm, currentUserId: String,
chunkEntity: ChunkEntity? = null, chunkEntity: ChunkEntity? = null,
shouldUpdateNotifications: Boolean = true) { shouldUpdateNotifications: Boolean = true) {
for ((rootThreadEventId, eventEntity) in this) { for ((rootThreadEventId, eventEntity) in this) {
eventEntity.threadSummaryInThread(eventEntity.realm, rootThreadEventId, chunkEntity)?.let { threadSummary -> eventEntity.threadSummaryInThread(eventEntity.realm, rootThreadEventId, chunkEntity)?.let { threadSummary ->
@ -59,7 +58,6 @@ internal fun Map<String, EventEntity>.updateThreadSummaryIfNeeded(
threadsCounted = numberOfMessages, threadsCounted = numberOfMessages,
latestMessageTimelineEventEntity = latestEventInThread latestMessageTimelineEventEntity = latestEventInThread
) )
} }
} }
@ -96,7 +94,6 @@ internal fun EventEntity.markEventAsRoot(
* @return A ThreadSummary containing the counted threads and the latest event message * @return A ThreadSummary containing the counted threads and the latest event message
*/ */
internal fun EventEntity.threadSummaryInThread(realm: Realm, rootThreadEventId: String, chunkEntity: ChunkEntity?): ThreadSummary { internal fun EventEntity.threadSummaryInThread(realm: Realm, rootThreadEventId: String, chunkEntity: ChunkEntity?): ThreadSummary {
// Number of messages // Number of messages
val messages = TimelineEventEntity val messages = TimelineEventEntity
.whereRoomId(realm, roomId = roomId) .whereRoomId(realm, roomId = roomId)

View File

@ -334,7 +334,7 @@ internal class EventRelationsAggregationProcessor @Inject constructor(
} }
} }
if(!isLocalEcho) { if (!isLocalEcho) {
val replaceEvent = TimelineEventEntity.where(realm, roomId, eventId).findFirst() val replaceEvent = TimelineEventEntity.where(realm, roomId, eventId).findFirst()
handleThreadSummaryEdition(editedEvent, replaceEvent, existingSummary?.editions) handleThreadSummaryEdition(editedEvent, replaceEvent, existingSummary?.editions)
} }

View File

@ -21,7 +21,6 @@ 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.EventType
import org.matrix.android.sdk.api.session.events.model.LocalEcho import org.matrix.android.sdk.api.session.events.model.LocalEcho
import org.matrix.android.sdk.api.session.events.model.UnsignedData import org.matrix.android.sdk.api.session.events.model.UnsignedData
import org.matrix.android.sdk.api.session.room.model.relation.RelationContent
import org.matrix.android.sdk.internal.database.mapper.ContentMapper import org.matrix.android.sdk.internal.database.mapper.ContentMapper
import org.matrix.android.sdk.internal.database.mapper.EventMapper import org.matrix.android.sdk.internal.database.mapper.EventMapper
import org.matrix.android.sdk.internal.database.model.EventEntity import org.matrix.android.sdk.internal.database.model.EventEntity

View File

@ -560,7 +560,7 @@ internal class LocalEchoEventFactory @Inject constructor(
relatesTo = generateReplyRelationContent( relatesTo = generateReplyRelationContent(
eventId = eventId, eventId = eventId,
rootThreadEventId = rootThreadEventId, rootThreadEventId = rootThreadEventId,
showAsReply = showInThread )) showAsReply = showInThread))
return createMessageEvent(roomId, content) return createMessageEvent(roomId, content)
} }

View File

@ -26,7 +26,6 @@ import im.vector.app.core.di.hiltMavericksViewModelFactory
import im.vector.app.core.extensions.exhaustive import im.vector.app.core.extensions.exhaustive
import im.vector.app.core.platform.VectorViewModel import im.vector.app.core.platform.VectorViewModel
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.features.analytics.AnalyticsTracker import im.vector.app.features.analytics.AnalyticsTracker
import im.vector.app.features.analytics.extensions.toAnalyticsJoinedRoom import im.vector.app.features.analytics.extensions.toAnalyticsJoinedRoom
import im.vector.app.features.attachments.toContentAttachmentData import im.vector.app.features.attachments.toContentAttachmentData
@ -503,7 +502,7 @@ class MessageComposerViewModel @AssistedInject constructor(
is SendMode.Reply -> { is SendMode.Reply -> {
val timelineEvent = state.sendMode.timelineEvent val timelineEvent = state.sendMode.timelineEvent
val showInThread = state.sendMode.timelineEvent.root.isThread() && state.rootThreadEventId == null val showInThread = state.sendMode.timelineEvent.root.isThread() && state.rootThreadEventId == null
val rootThreadEventId = if(showInThread) timelineEvent.root.getRootThreadEventId() else null val rootThreadEventId = if (showInThread) timelineEvent.root.getRootThreadEventId() else null
state.rootThreadEventId?.let { state.rootThreadEventId?.let {
room.replyInThread( room.replyInThread(
rootThreadEventId = it, rootThreadEventId = it,

View File

@ -30,8 +30,8 @@ import im.vector.app.core.epoxy.onClick
import im.vector.app.core.extensions.setTextOrHide import im.vector.app.core.extensions.setTextOrHide
import im.vector.app.features.displayname.getBestName import im.vector.app.features.displayname.getBestName
import im.vector.app.features.home.AvatarRenderer import im.vector.app.features.home.AvatarRenderer
import org.matrix.android.sdk.api.session.threads.ThreadDetails
import im.vector.lib.core.utils.epoxy.charsequence.EpoxyCharSequence import im.vector.lib.core.utils.epoxy.charsequence.EpoxyCharSequence
import org.matrix.android.sdk.api.session.threads.ThreadDetails
import org.matrix.android.sdk.api.util.MatrixItem import org.matrix.android.sdk.api.util.MatrixItem
@EpoxyModelClass(layout = R.layout.item_search_result) @EpoxyModelClass(layout = R.layout.item_search_result)

View File

@ -27,7 +27,6 @@ import org.matrix.android.sdk.api.session.events.model.toModel
import org.matrix.android.sdk.api.session.room.model.Membership import org.matrix.android.sdk.api.session.room.model.Membership
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.timeline.TimelineEvent import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
class TimelineEventVisibilityHelper @Inject constructor(private val userPreferencesProvider: UserPreferencesProvider) { class TimelineEventVisibilityHelper @Inject constructor(private val userPreferencesProvider: UserPreferencesProvider) {
@ -138,8 +137,7 @@ class TimelineEventVisibilityHelper @Inject constructor(private val userPreferen
} }
private fun TimelineEvent.shouldBeHidden(rootThreadEventId: String?, isFromThreadTimeline: Boolean): Boolean { private fun TimelineEvent.shouldBeHidden(rootThreadEventId: String?, isFromThreadTimeline: Boolean): Boolean {
if (root.isRedacted() && !userPreferencesProvider.shouldShowRedactedMessages() && root.threadDetails?.isRootThread == false) {
if (root.isRedacted() && !userPreferencesProvider.shouldShowRedactedMessages() && root.threadDetails?.isRootThread == false ) {
return true return true
} }
@ -147,14 +145,14 @@ class TimelineEventVisibilityHelper @Inject constructor(private val userPreferen
if (root.isRedacted() && if (root.isRedacted() &&
userPreferencesProvider.areThreadMessagesEnabled() && userPreferencesProvider.areThreadMessagesEnabled() &&
!isFromThreadTimeline && !isFromThreadTimeline &&
(root.isThread() || root.threadDetails?.isThread == true)){ (root.isThread() || root.threadDetails?.isThread == true)) {
return true return true
} }
if (root.isRedacted() && if (root.isRedacted() &&
!userPreferencesProvider.shouldShowRedactedMessages() && !userPreferencesProvider.shouldShowRedactedMessages() &&
userPreferencesProvider.areThreadMessagesEnabled() && userPreferencesProvider.areThreadMessagesEnabled() &&
isFromThreadTimeline && isFromThreadTimeline &&
root.isThread()){ root.isThread()) {
return true return true
} }

View File

@ -20,7 +20,6 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import androidx.fragment.app.FragmentTransaction import androidx.fragment.app.FragmentTransaction
import com.google.android.material.appbar.MaterialToolbar
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.extensions.addFragmentToBackstack import im.vector.app.core.extensions.addFragmentToBackstack