Fix update from develop/prod to threads

This commit is contained in:
ariskotsomitopoulos 2021-12-16 17:10:29 +02:00
parent bc6e89b503
commit 638d56c707
2 changed files with 9 additions and 4 deletions

View file

@ -25,6 +25,7 @@ import org.matrix.android.sdk.api.session.room.model.RoomJoinRulesContent
import org.matrix.android.sdk.api.session.room.model.VersioningState import org.matrix.android.sdk.api.session.room.model.VersioningState
import org.matrix.android.sdk.api.session.room.model.create.RoomCreateContent import org.matrix.android.sdk.api.session.room.model.create.RoomCreateContent
import org.matrix.android.sdk.api.session.room.model.tag.RoomTag import org.matrix.android.sdk.api.session.room.model.tag.RoomTag
import org.matrix.android.sdk.api.session.threads.ThreadNotificationState
import org.matrix.android.sdk.internal.database.model.ChunkEntityFields import org.matrix.android.sdk.internal.database.model.ChunkEntityFields
import org.matrix.android.sdk.internal.database.model.CurrentStateEventEntityFields import org.matrix.android.sdk.internal.database.model.CurrentStateEventEntityFields
import org.matrix.android.sdk.internal.database.model.EditAggregatedSummaryEntityFields import org.matrix.android.sdk.internal.database.model.EditAggregatedSummaryEntityFields
@ -403,6 +404,9 @@ internal class RealmSessionStoreMigration @Inject constructor(
?.addField(EventEntityFields.ROOT_THREAD_EVENT_ID, String::class.java, FieldAttribute.INDEXED) ?.addField(EventEntityFields.ROOT_THREAD_EVENT_ID, String::class.java, FieldAttribute.INDEXED)
?.addField(EventEntityFields.NUMBER_OF_THREADS, Int::class.java) ?.addField(EventEntityFields.NUMBER_OF_THREADS, Int::class.java)
?.addField(EventEntityFields.THREAD_NOTIFICATION_STATE_STR, String::class.java) ?.addField(EventEntityFields.THREAD_NOTIFICATION_STATE_STR, String::class.java)
?.transform {
it.setString(EventEntityFields.THREAD_NOTIFICATION_STATE_STR, ThreadNotificationState.NO_NEW_MESSAGE.name)
}
?.addRealmObjectField(EventEntityFields.THREAD_SUMMARY_LATEST_MESSAGE.`$`, eventEntity) ?.addRealmObjectField(EventEntityFields.THREAD_SUMMARY_LATEST_MESSAGE.`$`, eventEntity)
} }
} }

View file

@ -602,8 +602,11 @@ internal class DefaultTimeline(
nextDisplayIndex = offsetIndex + 1 nextDisplayIndex = offsetIndex + 1
} }
if(!BuildConfig.THREADING_ENABLED) {
// Prerequisite to in order for the ThreadsAwarenessHandler to work properly // Prerequisite to in order for the ThreadsAwarenessHandler to work properly
fetchRootThreadEventsIfNeeded(offsetResults) fetchRootThreadEventsIfNeeded(offsetResults)
}
offsetResults.forEach { eventEntity -> offsetResults.forEach { eventEntity ->
@ -640,10 +643,8 @@ internal class DefaultTimeline(
}.map { }.map {
EventMapper.map(it) EventMapper.map(it)
} }
if(!BuildConfig.THREADING_ENABLED) {
threadsAwarenessHandler.fetchRootThreadEventsIfNeeded(eventEntityList) threadsAwarenessHandler.fetchRootThreadEventsIfNeeded(eventEntityList)
} }
}
private fun buildTimelineEvent(eventEntity: TimelineEventEntity): TimelineEvent { private fun buildTimelineEvent(eventEntity: TimelineEventEntity): TimelineEvent {
return timelineEventMapper.map( return timelineEventMapper.map(