From 9b98a4794143323b0cc784ee1cdc8fe50523ebb4 Mon Sep 17 00:00:00 2001 From: ganfra Date: Fri, 13 Mar 2026 18:41:13 +0100 Subject: [PATCH] Use localized string instead of hardcoded --- features/location/impl/build.gradle.kts | 2 +- .../features/location/impl/show/ShowLocationPresenter.kt | 8 +++++++- .../impl/show/DefaultShowLocationEntryPointTest.kt | 2 ++ .../location/impl/show/ShowLocationPresenterTest.kt | 2 ++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/features/location/impl/build.gradle.kts b/features/location/impl/build.gradle.kts index 14dd7a7836..0da54a1394 100644 --- a/features/location/impl/build.gradle.kts +++ b/features/location/impl/build.gradle.kts @@ -36,7 +36,6 @@ dependencies { implementation(projects.libraries.androidutils) implementation(projects.libraries.core) implementation(projects.libraries.matrixui) - implementation(projects.libraries.androidutils) implementation(projects.services.analytics.api) implementation(libs.accompanist.permission) implementation(projects.libraries.uiStrings) @@ -46,6 +45,7 @@ dependencies { testCommonDependencies(libs, true) testImplementation(projects.libraries.matrix.test) testImplementation(projects.libraries.dateformatter.test) + testImplementation(projects.services.toolbox.test) testImplementation(projects.libraries.testtags) testImplementation(projects.services.analytics.test) testImplementation(projects.features.messages.test) diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenter.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenter.kt index 9978c6e1f5..7ecab4924e 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenter.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenter.kt @@ -37,6 +37,8 @@ import io.element.android.libraries.designsystem.components.PinVariant import io.element.android.libraries.designsystem.components.avatar.AvatarData import io.element.android.libraries.designsystem.components.avatar.AvatarSize import io.element.android.libraries.matrix.api.room.location.AssetType +import io.element.android.libraries.ui.strings.CommonStrings +import io.element.android.services.toolbox.api.strings.StringProvider import kotlinx.collections.immutable.persistentListOf @AssistedInject @@ -46,6 +48,7 @@ class ShowLocationPresenter( private val locationActions: LocationActions, private val buildMeta: BuildMeta, private val dateFormatter: DateFormatter, + private val stringProvider: StringProvider, ) : Presenter { @AssistedFactory fun interface Factory { @@ -128,7 +131,10 @@ class ShowLocationPresenter( when (mode) { is ShowLocationMode.Static -> { val relativeTime = dateFormatter.format(timestamp = mode.timestamp, mode = DateFormatterMode.Full, useRelative = true) - val formattedTimestamp = "Shared $relativeTime" + val formattedTimestamp = stringProvider.getString( + CommonStrings.screen_static_location_sheet_timestamp_description, + relativeTime + ) persistentListOf( LocationShareItem( userId = mode.senderId, diff --git a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/DefaultShowLocationEntryPointTest.kt b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/DefaultShowLocationEntryPointTest.kt index b8a32e5912..451531fc7e 100644 --- a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/DefaultShowLocationEntryPointTest.kt +++ b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/DefaultShowLocationEntryPointTest.kt @@ -20,6 +20,7 @@ import io.element.android.libraries.dateformatter.test.FakeDateFormatter import io.element.android.libraries.matrix.api.core.UserId import io.element.android.libraries.matrix.test.core.aBuildMeta import io.element.android.services.analytics.test.FakeAnalyticsService +import io.element.android.services.toolbox.test.strings.FakeStringProvider import io.element.android.tests.testutils.node.TestParentNode import org.junit.Rule import org.junit.Test @@ -42,6 +43,7 @@ class DefaultShowLocationEntryPointTest { locationActions = FakeLocationActions(), buildMeta = aBuildMeta(), dateFormatter = FakeDateFormatter(), + stringProvider = FakeStringProvider() ) }, analyticsService = FakeAnalyticsService(), diff --git a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenterTest.kt b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenterTest.kt index 8a29f0463d..931dd55cea 100644 --- a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenterTest.kt +++ b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenterTest.kt @@ -23,6 +23,7 @@ import io.element.android.features.location.impl.common.ui.LocationConstraintsDi import io.element.android.libraries.dateformatter.test.FakeDateFormatter import io.element.android.libraries.matrix.api.core.UserId import io.element.android.libraries.matrix.test.core.aBuildMeta +import io.element.android.services.toolbox.test.strings.FakeStringProvider import io.element.android.tests.testutils.WarmUpRule import io.element.android.tests.testutils.test import kotlinx.coroutines.delay @@ -56,6 +57,7 @@ class ShowLocationPresenterTest { locationActions = locationActions, buildMeta = fakeBuildMeta, dateFormatter = fakeDateFormatter, + stringProvider = FakeStringProvider() ) @Test