mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 03:48:12 +03:00
Removing description parameter in startLiveLocation method of SDK to avoid translated strings in beacon events
This commit is contained in:
parent
235b629130
commit
57e90aee83
6 changed files with 8 additions and 22 deletions
|
@ -47,10 +47,9 @@ interface LocationSharingService {
|
|||
/**
|
||||
* Starts sharing live location in the room.
|
||||
* @param timeoutMillis timeout of the live in milliseconds
|
||||
* @param description description of the live for text fallback
|
||||
* @return the result of the update of the live
|
||||
*/
|
||||
suspend fun startLiveLocationShare(timeoutMillis: Long, description: String): UpdateLiveLocationShareResult
|
||||
suspend fun startLiveLocationShare(timeoutMillis: Long): UpdateLiveLocationShareResult
|
||||
|
||||
/**
|
||||
* Stops sharing live location in the room.
|
||||
|
|
|
@ -73,7 +73,7 @@ internal class DefaultLocationSharingService @AssistedInject constructor(
|
|||
return sendLiveLocationTask.execute(params)
|
||||
}
|
||||
|
||||
override suspend fun startLiveLocationShare(timeoutMillis: Long, description: String): UpdateLiveLocationShareResult {
|
||||
override suspend fun startLiveLocationShare(timeoutMillis: Long): UpdateLiveLocationShareResult {
|
||||
// Ensure to stop any active live before starting a new one
|
||||
if (checkIfExistingActiveLive()) {
|
||||
val result = stopLiveLocationShare()
|
||||
|
@ -84,7 +84,6 @@ internal class DefaultLocationSharingService @AssistedInject constructor(
|
|||
val params = StartLiveLocationShareTask.Params(
|
||||
roomId = roomId,
|
||||
timeoutMillis = timeoutMillis,
|
||||
description = description
|
||||
)
|
||||
return startLiveLocationShareTask.execute(params)
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ internal interface StartLiveLocationShareTask : Task<StartLiveLocationShareTask.
|
|||
data class Params(
|
||||
val roomId: String,
|
||||
val timeoutMillis: Long,
|
||||
val description: String,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -42,7 +41,7 @@ internal class DefaultStartLiveLocationShareTask @Inject constructor(
|
|||
|
||||
override suspend fun execute(params: StartLiveLocationShareTask.Params): UpdateLiveLocationShareResult {
|
||||
val beaconContent = MessageBeaconInfoContent(
|
||||
body = params.description,
|
||||
body = "Live location",
|
||||
timeout = params.timeoutMillis,
|
||||
isLive = true,
|
||||
unstableTimestampMillis = clock.epochMillis()
|
||||
|
|
|
@ -53,7 +53,6 @@ private const val A_LATITUDE = 1.4
|
|||
private const val A_LONGITUDE = 40.0
|
||||
private const val AN_UNCERTAINTY = 5.0
|
||||
private const val A_TIMEOUT = 15_000L
|
||||
private const val A_DESCRIPTION = "description"
|
||||
private const val A_REASON = "reason"
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
|
@ -143,7 +142,7 @@ internal class DefaultLocationSharingServiceTest {
|
|||
coEvery { stopLiveLocationShareTask.execute(any()) } returns UpdateLiveLocationShareResult.Success("stopped-event-id")
|
||||
coEvery { startLiveLocationShareTask.execute(any()) } returns UpdateLiveLocationShareResult.Success(AN_EVENT_ID)
|
||||
|
||||
val result = defaultLocationSharingService.startLiveLocationShare(A_TIMEOUT, A_DESCRIPTION)
|
||||
val result = defaultLocationSharingService.startLiveLocationShare(A_TIMEOUT)
|
||||
|
||||
result shouldBeEqualTo UpdateLiveLocationShareResult.Success(AN_EVENT_ID)
|
||||
val expectedCheckExistingParams = CheckIfExistingActiveLiveTask.Params(
|
||||
|
@ -157,7 +156,6 @@ internal class DefaultLocationSharingServiceTest {
|
|||
val expectedStartParams = StartLiveLocationShareTask.Params(
|
||||
roomId = A_ROOM_ID,
|
||||
timeoutMillis = A_TIMEOUT,
|
||||
description = A_DESCRIPTION
|
||||
)
|
||||
coVerify { startLiveLocationShareTask.execute(expectedStartParams) }
|
||||
}
|
||||
|
@ -168,7 +166,7 @@ internal class DefaultLocationSharingServiceTest {
|
|||
val error = Throwable()
|
||||
coEvery { stopLiveLocationShareTask.execute(any()) } returns UpdateLiveLocationShareResult.Failure(error)
|
||||
|
||||
val result = defaultLocationSharingService.startLiveLocationShare(A_TIMEOUT, A_DESCRIPTION)
|
||||
val result = defaultLocationSharingService.startLiveLocationShare(A_TIMEOUT)
|
||||
|
||||
result shouldBeEqualTo UpdateLiveLocationShareResult.Failure(error)
|
||||
val expectedCheckExistingParams = CheckIfExistingActiveLiveTask.Params(
|
||||
|
@ -186,7 +184,7 @@ internal class DefaultLocationSharingServiceTest {
|
|||
coEvery { checkIfExistingActiveLiveTask.execute(any()) } returns false
|
||||
coEvery { startLiveLocationShareTask.execute(any()) } returns UpdateLiveLocationShareResult.Success(AN_EVENT_ID)
|
||||
|
||||
val result = defaultLocationSharingService.startLiveLocationShare(A_TIMEOUT, A_DESCRIPTION)
|
||||
val result = defaultLocationSharingService.startLiveLocationShare(A_TIMEOUT)
|
||||
|
||||
result shouldBeEqualTo UpdateLiveLocationShareResult.Success(AN_EVENT_ID)
|
||||
val expectedCheckExistingParams = CheckIfExistingActiveLiveTask.Params(
|
||||
|
@ -196,7 +194,6 @@ internal class DefaultLocationSharingServiceTest {
|
|||
val expectedStartParams = StartLiveLocationShareTask.Params(
|
||||
roomId = A_ROOM_ID,
|
||||
timeoutMillis = A_TIMEOUT,
|
||||
description = A_DESCRIPTION
|
||||
)
|
||||
coVerify { startLiveLocationShareTask.execute(expectedStartParams) }
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.matrix.android.sdk.test.fakes.FakeSendStateTask
|
|||
private const val A_USER_ID = "user-id"
|
||||
private const val A_ROOM_ID = "room-id"
|
||||
private const val AN_EVENT_ID = "event-id"
|
||||
private const val A_DESCRIPTION = "description"
|
||||
private const val A_TIMEOUT = 15_000L
|
||||
private const val AN_EPOCH = 1655210176L
|
||||
|
||||
|
@ -60,7 +59,6 @@ internal class DefaultStartLiveLocationShareTaskTest {
|
|||
val params = StartLiveLocationShareTask.Params(
|
||||
roomId = A_ROOM_ID,
|
||||
timeoutMillis = A_TIMEOUT,
|
||||
description = A_DESCRIPTION
|
||||
)
|
||||
fakeClock.givenEpoch(AN_EPOCH)
|
||||
fakeSendStateTask.givenExecuteRetryReturns(AN_EVENT_ID)
|
||||
|
@ -69,7 +67,7 @@ internal class DefaultStartLiveLocationShareTaskTest {
|
|||
|
||||
result shouldBeEqualTo UpdateLiveLocationShareResult.Success(AN_EVENT_ID)
|
||||
val expectedBeaconContent = MessageBeaconInfoContent(
|
||||
body = A_DESCRIPTION,
|
||||
body = "Live location",
|
||||
timeout = params.timeoutMillis,
|
||||
isLive = true,
|
||||
unstableTimestampMillis = AN_EPOCH
|
||||
|
@ -91,7 +89,6 @@ internal class DefaultStartLiveLocationShareTaskTest {
|
|||
val params = StartLiveLocationShareTask.Params(
|
||||
roomId = A_ROOM_ID,
|
||||
timeoutMillis = A_TIMEOUT,
|
||||
description = A_DESCRIPTION
|
||||
)
|
||||
fakeClock.givenEpoch(AN_EPOCH)
|
||||
fakeSendStateTask.givenExecuteRetryReturns("")
|
||||
|
@ -106,7 +103,6 @@ internal class DefaultStartLiveLocationShareTaskTest {
|
|||
val params = StartLiveLocationShareTask.Params(
|
||||
roomId = A_ROOM_ID,
|
||||
timeoutMillis = A_TIMEOUT,
|
||||
description = A_DESCRIPTION
|
||||
)
|
||||
fakeClock.givenEpoch(AN_EPOCH)
|
||||
val error = Throwable()
|
||||
|
|
|
@ -21,7 +21,6 @@ import android.os.IBinder
|
|||
import android.os.Parcelable
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.di.ActiveSessionHolder
|
||||
import im.vector.app.core.services.VectorAndroidService
|
||||
import im.vector.app.features.location.LocationData
|
||||
|
@ -125,10 +124,7 @@ class LocationSharingAndroidService : VectorAndroidService(), LocationTracker.Ca
|
|||
val updateLiveResult = session
|
||||
.getRoom(roomArgs.roomId)
|
||||
?.locationSharingService()
|
||||
?.startLiveLocationShare(
|
||||
timeoutMillis = roomArgs.durationMillis,
|
||||
description = getString(R.string.live_location_description)
|
||||
)
|
||||
?.startLiveLocationShare(roomArgs.durationMillis)
|
||||
|
||||
updateLiveResult
|
||||
?.let { result ->
|
||||
|
|
Loading…
Reference in a new issue