More renaming
This commit is contained in:
parent
05c5f3c914
commit
0303ac502a
6 changed files with 14 additions and 14 deletions
|
|
@ -23,5 +23,5 @@ interface MessagesNavigator {
|
||||||
fun navigateToPreviewAttachments(attachments: ImmutableList<Attachment>, inReplyToEventId: EventId?)
|
fun navigateToPreviewAttachments(attachments: ImmutableList<Attachment>, inReplyToEventId: EventId?)
|
||||||
fun navigateToRoom(roomId: RoomId, eventId: EventId?, serverNames: List<String>)
|
fun navigateToRoom(roomId: RoomId, eventId: EventId?, serverNames: List<String>)
|
||||||
fun navigateToThread(threadRootId: ThreadId, focusedEventId: EventId?)
|
fun navigateToThread(threadRootId: ThreadId, focusedEventId: EventId?)
|
||||||
fun onNavigateUp()
|
fun close()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ class MessagesNode(
|
||||||
context.toast(CommonStrings.screen_room_permalink_same_room_android)
|
context.toast(CommonStrings.screen_room_permalink_same_room_android)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNavigateUp() = navigateUp()
|
override fun close() = navigateUp()
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun View(modifier: Modifier) {
|
override fun View(modifier: Modifier) {
|
||||||
|
|
|
||||||
|
|
@ -251,7 +251,7 @@ class MessagesPresenter(
|
||||||
if (!markingAsReadAndExiting.getAndSet(true)) {
|
if (!markingAsReadAndExiting.getAndSet(true)) {
|
||||||
val latestEventId = room.liveTimeline.getLatestEventId().getOrElse {
|
val latestEventId = room.liveTimeline.getLatestEventId().getOrElse {
|
||||||
Timber.w(it, "Failed to get latest event id to mark as fully read")
|
Timber.w(it, "Failed to get latest event id to mark as fully read")
|
||||||
navigator.onNavigateUp()
|
navigator.close()
|
||||||
return@launch
|
return@launch
|
||||||
}
|
}
|
||||||
latestEventId?.let { eventId ->
|
latestEventId?.let { eventId ->
|
||||||
|
|
@ -259,7 +259,7 @@ class MessagesPresenter(
|
||||||
markAsFullyRead(room.roomId, eventId)
|
markAsFullyRead(room.roomId, eventId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
navigator.onNavigateUp()
|
navigator.close()
|
||||||
markingAsReadAndExiting.set(false)
|
markingAsReadAndExiting.set(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@ class ThreadedMessagesNode(
|
||||||
callback.navigateToThread(threadRootId, focusedEventId)
|
callback.navigateToThread(threadRootId, focusedEventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNavigateUp() = navigateUp()
|
override fun close() = navigateUp()
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun View(modifier: Modifier) {
|
override fun View(modifier: Modifier) {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class FakeMessagesNavigator(
|
||||||
private val onPreviewAttachmentLambda: (attachments: ImmutableList<Attachment>, inReplyToEventId: EventId?) -> Unit = { _, _ -> lambdaError() },
|
private val onPreviewAttachmentLambda: (attachments: ImmutableList<Attachment>, inReplyToEventId: EventId?) -> Unit = { _, _ -> lambdaError() },
|
||||||
private val onNavigateToRoomLambda: (roomId: RoomId, threadId: EventId?, serverNames: List<String>) -> Unit = { _, _, _ -> lambdaError() },
|
private val onNavigateToRoomLambda: (roomId: RoomId, threadId: EventId?, serverNames: List<String>) -> Unit = { _, _, _ -> lambdaError() },
|
||||||
private val onOpenThreadLambda: (threadRootId: ThreadId, focusedEventId: EventId?) -> Unit = { _, _ -> lambdaError() },
|
private val onOpenThreadLambda: (threadRootId: ThreadId, focusedEventId: EventId?) -> Unit = { _, _ -> lambdaError() },
|
||||||
private val onNavigateUpLambda: () -> Unit = { lambdaError() },
|
private val closeLambda: () -> Unit = { lambdaError() },
|
||||||
) : MessagesNavigator {
|
) : MessagesNavigator {
|
||||||
override fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
override fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
||||||
onShowEventDebugInfoClickLambda(eventId, debugInfo)
|
onShowEventDebugInfoClickLambda(eventId, debugInfo)
|
||||||
|
|
@ -54,7 +54,7 @@ class FakeMessagesNavigator(
|
||||||
onOpenThreadLambda(threadRootId, focusedEventId)
|
onOpenThreadLambda(threadRootId, focusedEventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNavigateUp() {
|
override fun close() {
|
||||||
onNavigateUpLambda()
|
closeLambda()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1256,8 +1256,8 @@ class MessagesPresenterTest {
|
||||||
fun `present - handle MarkAsFullyReadAndExit marks the room as fully read and navigates up`() = runTest {
|
fun `present - handle MarkAsFullyReadAndExit marks the room as fully read and navigates up`() = runTest {
|
||||||
val markAsFullyReadRecorder = lambdaRecorder<RoomId, EventId, Unit> { _, _ -> }
|
val markAsFullyReadRecorder = lambdaRecorder<RoomId, EventId, Unit> { _, _ -> }
|
||||||
val markAsFullyReadUseCase = FakeMarkAsFullyRead(markAsFullyReadRecorder)
|
val markAsFullyReadUseCase = FakeMarkAsFullyRead(markAsFullyReadRecorder)
|
||||||
val onNavigateUpRecorder = lambdaRecorder<Unit> {}
|
val closeLambda = lambdaRecorder<Unit> {}
|
||||||
val navigator = FakeMessagesNavigator(onNavigateUpLambda = onNavigateUpRecorder)
|
val navigator = FakeMessagesNavigator(closeLambda = closeLambda)
|
||||||
|
|
||||||
val presenter = createMessagesPresenter(
|
val presenter = createMessagesPresenter(
|
||||||
timeline = FakeTimeline(getLatestEventIdResult = { Result.success(AN_EVENT_ID) }),
|
timeline = FakeTimeline(getLatestEventIdResult = { Result.success(AN_EVENT_ID) }),
|
||||||
|
|
@ -1271,7 +1271,7 @@ class MessagesPresenterTest {
|
||||||
runCurrent()
|
runCurrent()
|
||||||
|
|
||||||
markAsFullyReadRecorder.assertions().isCalledOnce()
|
markAsFullyReadRecorder.assertions().isCalledOnce()
|
||||||
onNavigateUpRecorder.assertions().isCalledOnce()
|
closeLambda.assertions().isCalledOnce()
|
||||||
|
|
||||||
cancelAndIgnoreRemainingEvents()
|
cancelAndIgnoreRemainingEvents()
|
||||||
}
|
}
|
||||||
|
|
@ -1280,8 +1280,8 @@ class MessagesPresenterTest {
|
||||||
@Test
|
@Test
|
||||||
fun `present - handle MarkAsFullyReadAndExit still navigates up if marking as read fails`() = runTest {
|
fun `present - handle MarkAsFullyReadAndExit still navigates up if marking as read fails`() = runTest {
|
||||||
val markAsFullyReadUseCase = FakeMarkAsFullyRead { _, _ -> error("boom") }
|
val markAsFullyReadUseCase = FakeMarkAsFullyRead { _, _ -> error("boom") }
|
||||||
val onNavigateUpRecorder = lambdaRecorder<Unit> {}
|
val closeLambda = lambdaRecorder<Unit> {}
|
||||||
val navigator = FakeMessagesNavigator(onNavigateUpLambda = onNavigateUpRecorder)
|
val navigator = FakeMessagesNavigator(closeLambda = closeLambda)
|
||||||
|
|
||||||
val presenter = createMessagesPresenter(
|
val presenter = createMessagesPresenter(
|
||||||
timeline = FakeTimeline(getLatestEventIdResult = { Result.success(AN_EVENT_ID) }),
|
timeline = FakeTimeline(getLatestEventIdResult = { Result.success(AN_EVENT_ID) }),
|
||||||
|
|
@ -1294,7 +1294,7 @@ class MessagesPresenterTest {
|
||||||
|
|
||||||
runCurrent()
|
runCurrent()
|
||||||
|
|
||||||
onNavigateUpRecorder.assertions().isCalledOnce()
|
closeLambda.assertions().isCalledOnce()
|
||||||
|
|
||||||
cancelAndIgnoreRemainingEvents()
|
cancelAndIgnoreRemainingEvents()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue