- fix ktlint format

- Update Threads toolbar UI
This commit is contained in:
ariskotsomitopoulos 2022-01-11 15:31:21 +02:00
parent 3bd21d04d8
commit 753e3e7519
8 changed files with 16 additions and 20 deletions

View file

@ -216,7 +216,7 @@ class CommonTestHelper(context: Context) {
timeout: Long = TestConstants.timeOutMillis): List<TimelineEvent> {
val timeline = room.createTimeline(null, TimelineSettings(10))
timeline.start()
val sentEvents = sendTextMessagesBatched(timeline, room, message, numberOfMessages, timeout,rootThreadEventId)
val sentEvents = sendTextMessagesBatched(timeline, room, message, numberOfMessages, timeout, rootThreadEventId)
timeline.dispose()
// Check that all events has been created
assertEquals("Message number do not match $sentEvents", numberOfMessages.toLong(), sentEvents.size.toLong())

View file

@ -261,7 +261,6 @@ class ThreadMessagingTest : InstrumentedTest {
val firstMessage = sentMessages[0]
val secondMessage = sentMessages[1]
// Alice will reply in thread to the second message 35 times
val aliceThreadRepliesInSecondMessage = commonTestHelper.replyInThreadMessage(
room = aliceRoom,
@ -288,7 +287,6 @@ class ThreadMessagingTest : InstrumentedTest {
numberOfMessages = 20,
rootThreadEventId = secondMessage.root.eventId.orEmpty())
aliceThreadRepliesInSecondMessage.forEach {
it.root.isThread().shouldBeTrue()
it.root.isTextMessage().shouldBeTrue()
@ -337,5 +335,4 @@ class ThreadMessagingTest : InstrumentedTest {
}
aliceSession.stopSync()
}
}

View file

@ -127,11 +127,10 @@ internal class DefaultTimeline(private val roomId: String,
}
timelineScope.launch {
sequencer.post {
if (isStarted.compareAndSet(false, true)) {
isFromThreadTimeline = rootThreadEventId != null
this@DefaultTimeline.rootThreadEventId = rootThreadEventId
///
// /
val realm = Realm.getInstance(realmConfiguration)
ensureReadReceiptAreLoaded(realm)
backgroundRealm.set(realm)
@ -157,7 +156,7 @@ internal class DefaultTimeline(private val roomId: String,
override fun restartWithEventId(eventId: String?) {
timelineScope.launch {
openAround(eventId,rootThreadEventId)
openAround(eventId, rootThreadEventId)
postSnapshot()
}
}

View file

@ -171,7 +171,7 @@ internal class LoadTimelineStrategy(
}
suspend fun loadMore(count: Int, direction: Timeline.Direction, fetchOnServerIfNeeded: Boolean = true): LoadMoreResult {
///
// /
if (mode is Mode.Permalink && timelineChunk == null) {
val params = GetContextOfEventTask.Params(roomId, mode.originEventId)
try {
@ -208,7 +208,6 @@ internal class LoadTimelineStrategy(
}
private fun getChunkEntity(realm: Realm): RealmResults<ChunkEntity> {
return when (mode) {
is Mode.Live -> {
ChunkEntity.where(realm, roomId)

View file

@ -138,8 +138,8 @@ internal class TimelineChunk(private val chunkEntity: ChunkEntity,
} else if (direction == Timeline.Direction.BACKWARDS && prevChunk != null) {
return prevChunk?.loadMore(count, direction, fetchOnServerIfNeeded) ?: LoadMoreResult.FAILURE
}
val loadFromStorage = loadFromStorage(count, direction).also{
logLoadedFromStorage(it,direction)
val loadFromStorage = loadFromStorage(count, direction).also {
logLoadedFromStorage(it, direction)
}
val offsetCount = count - loadFromStorage.numberOfEvents

View file

@ -50,7 +50,7 @@ import javax.inject.Inject
internal class TokenChunkEventPersistor @Inject constructor(
@SessionDatabase private val monarchy: Monarchy,
@UserId private val userId: String,
private val liveEventManager: Lazy<StreamEventsManager> ) {
private val liveEventManager: Lazy<StreamEventsManager>) {
enum class Result {
SHOULD_FETCH_MORE,

View file

@ -196,7 +196,6 @@ import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import kotlinx.parcelize.Parcelize
import nl.dionsegijn.konfetti.models.Shape
import nl.dionsegijn.konfetti.models.Size
import org.billcarsonfr.jsonviewer.JSonViewerDialog

View file

@ -6,6 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
tools:layout_height="?actionBarSize"
tools:visibility="visible">
<TextView
@ -13,24 +14,25 @@
style="@style/Widget.Vector.TextView.HeadlineMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?vctr_content_primary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toTopOf="@id/roomToolbarThreadImageView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="@string/thread_timeline_title" />
<ImageView
android:id="@+id/roomToolbarThreadImageView"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginStart="8dp"
android:importantForAccessibility="no"
android:src="@drawable/ic_presence_offline"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/roomToolbarThreadTitleTextView"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/roomToolbarThreadTitleTextView"
tools:src="@sample/room_round_avatars" />
<TextView
@ -41,10 +43,10 @@
android:layout_marginStart="4dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?vctr_content_primary"
app:layout_constraintBottom_toBottomOf="parent"
android:textColor="?vctr_content_secondary"
app:layout_constraintBottom_toBottomOf="@id/roomToolbarThreadImageView"
app:layout_constraintStart_toEndOf="@id/roomToolbarThreadImageView"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintTop_toTopOf="@id/roomToolbarThreadImageView"
tools:text="RoomName"
tools:visibility="visible" />