Reduce API of JoinedRoom, caller must use the Timeline API from liveTimeline instead. (#4731)
This removes lots of boilerplate code.
This commit is contained in:
parent
3cf8237d29
commit
8d115213cc
20 changed files with 258 additions and 651 deletions
|
|
@ -101,7 +101,7 @@ class SendLocationPresenter @Inject constructor(
|
|||
when (mode) {
|
||||
SendLocationState.Mode.PinLocation -> {
|
||||
val geoUri = event.cameraPosition.toGeoUri()
|
||||
room.sendLocation(
|
||||
room.liveTimeline.sendLocation(
|
||||
body = generateBody(geoUri),
|
||||
geoUri = geoUri,
|
||||
description = null,
|
||||
|
|
@ -119,7 +119,7 @@ class SendLocationPresenter @Inject constructor(
|
|||
}
|
||||
SendLocationState.Mode.SenderLocation -> {
|
||||
val geoUri = event.toGeoUri()
|
||||
room.sendLocation(
|
||||
room.liveTimeline.sendLocation(
|
||||
body = generateBody(geoUri),
|
||||
geoUri = geoUri,
|
||||
description = null,
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import io.element.android.libraries.matrix.api.timeline.item.event.toEventOrTran
|
|||
import io.element.android.libraries.matrix.test.AN_EVENT_ID
|
||||
import io.element.android.libraries.matrix.test.core.aBuildMeta
|
||||
import io.element.android.libraries.matrix.test.room.FakeJoinedRoom
|
||||
import io.element.android.libraries.matrix.test.timeline.FakeTimeline
|
||||
import io.element.android.libraries.textcomposer.model.MessageComposerMode
|
||||
import io.element.android.services.analytics.test.FakeAnalyticsService
|
||||
import io.element.android.tests.testutils.WarmUpRule
|
||||
|
|
@ -266,7 +267,9 @@ class SendLocationPresenterTest {
|
|||
Result.success(Unit)
|
||||
}
|
||||
val joinedRoom = FakeJoinedRoom(
|
||||
sendLocationResult = sendLocationResult,
|
||||
liveTimeline = FakeTimeline().apply {
|
||||
sendLocationLambda = sendLocationResult
|
||||
},
|
||||
)
|
||||
val sendLocationPresenter = createSendLocationPresenter(joinedRoom)
|
||||
fakePermissionsPresenter.givenState(
|
||||
|
|
@ -327,7 +330,9 @@ class SendLocationPresenterTest {
|
|||
Result.success(Unit)
|
||||
}
|
||||
val joinedRoom = FakeJoinedRoom(
|
||||
sendLocationResult = sendLocationResult,
|
||||
liveTimeline = FakeTimeline().apply {
|
||||
sendLocationLambda = sendLocationResult
|
||||
},
|
||||
)
|
||||
val sendLocationPresenter = createSendLocationPresenter(joinedRoom)
|
||||
fakePermissionsPresenter.givenState(
|
||||
|
|
@ -388,7 +393,9 @@ class SendLocationPresenterTest {
|
|||
Result.success(Unit)
|
||||
}
|
||||
val joinedRoom = FakeJoinedRoom(
|
||||
sendLocationResult = sendLocationResult,
|
||||
liveTimeline = FakeTimeline().apply {
|
||||
sendLocationLambda = sendLocationResult
|
||||
},
|
||||
)
|
||||
val sendLocationPresenter = createSendLocationPresenter(joinedRoom)
|
||||
fakePermissionsPresenter.givenState(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue