diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt
index 2d045ec959..17eb076b09 100644
--- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt
+++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt
@@ -75,6 +75,7 @@ import im.vector.app.features.html.VectorHtmlCompressor
import im.vector.app.features.location.LocationData
import im.vector.app.features.media.ImageContentRenderer
import im.vector.app.features.media.VideoContentRenderer
+import im.vector.app.features.settings.VectorPreferences
import me.gujun.android.span.span
import org.commonmark.node.Document
import org.matrix.android.sdk.api.MatrixUrls.isMxcUrl
@@ -124,7 +125,8 @@ class MessageItemFactory @Inject constructor(
private val spanUtils: SpanUtils,
private val session: Session,
private val voiceMessagePlaybackTracker: VoiceMessagePlaybackTracker,
- private val locationPinProvider: LocationPinProvider) {
+ private val locationPinProvider: LocationPinProvider,
+ private val vectorPreferences: VectorPreferences) {
// TODO inject this properly?
private var roomId: String = ""
@@ -177,7 +179,13 @@ class MessageItemFactory @Inject constructor(
}
is MessageVerificationRequestContent -> buildVerificationRequestMessageItem(messageContent, informationData, highlight, callback, attributes)
is MessagePollContent -> buildPollItem(messageContent, informationData, highlight, callback, attributes)
- is MessageLocationContent -> buildLocationItem(messageContent, informationData, highlight, callback, attributes)
+ is MessageLocationContent -> {
+ if (vectorPreferences.labsRenderLocationsInTimeline()) {
+ buildLocationItem(messageContent, informationData, highlight, callback, attributes)
+ } else {
+ buildMessageTextItem(messageContent.body, false, informationData, highlight, callback, attributes)
+ }
+ }
else -> buildNotHandledMessageItem(messageContent, informationData, highlight, callback, attributes)
}
}
diff --git a/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt b/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt
index 859c5ce678..d1f96fe76c 100755
--- a/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt
+++ b/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt
@@ -201,6 +201,8 @@ class VectorPreferences @Inject constructor(private val context: Context) {
private const val SETTINGS_LABS_ENABLE_POLLS = "SETTINGS_LABS_ENABLE_POLLS"
+ private const val SETTINGS_LABS_RENDER_LOCATIONS_IN_TIMELINE = "SETTINGS_LABS_RENDER_LOCATIONS_IN_TIMELINE"
+
// Possible values for TAKE_PHOTO_VIDEO_MODE
const val TAKE_PHOTO_VIDEO_MODE_ALWAYS_ASK = 0
const val TAKE_PHOTO_VIDEO_MODE_PHOTO = 1
@@ -1002,4 +1004,8 @@ class VectorPreferences @Inject constructor(private val context: Context) {
fun isLocationSharingEnabled(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_PREF_ENABLE_LOCATION_SHARING, false) && BuildConfig.enableLocationSharing
}
+
+ fun labsRenderLocationsInTimeline(): Boolean {
+ return defaultPrefs.getBoolean(SETTINGS_LABS_RENDER_LOCATIONS_IN_TIMELINE, true)
+ }
}
diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml
index 2720b3c20b..d9866bbdb3 100644
--- a/vector/src/main/res/values/strings.xml
+++ b/vector/src/main/res/values/strings.xml
@@ -3709,6 +3709,7 @@
${app_name} could not access your location. Please try again later.
Open with
Enable location sharing
+ Render user locations in the timeline
Open camera
Send images and videos
diff --git a/vector/src/main/res/xml/vector_settings_labs.xml b/vector/src/main/res/xml/vector_settings_labs.xml
index d2e9df4985..ac9ce3099c 100644
--- a/vector/src/main/res/xml/vector_settings_labs.xml
+++ b/vector/src/main/res/xml/vector_settings_labs.xml
@@ -57,10 +57,15 @@
android:title="@string/labs_enable_polls" />
-
+
+
+
\ No newline at end of file
diff --git a/vector/src/main/res/xml/vector_settings_preferences.xml b/vector/src/main/res/xml/vector_settings_preferences.xml
index fd5c6f6062..03bed63153 100644
--- a/vector/src/main/res/xml/vector_settings_preferences.xml
+++ b/vector/src/main/res/xml/vector_settings_preferences.xml
@@ -28,11 +28,6 @@
android:persistent="false"
android:title="@string/font_size" />
-
-
@@ -77,6 +72,11 @@
android:title="@string/option_take_photo_video"
tools:summary="@string/option_always_ask" />
+
+