mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 18:35:40 +03:00
Code review fixes.
This commit is contained in:
parent
d65899ef88
commit
43c8624b33
5 changed files with 32 additions and 12 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3709,6 +3709,7 @@
|
|||
<string name="template_location_not_available_dialog_content">${app_name} could not access your location. Please try again later.</string>
|
||||
<string name="location_share_external">Open with</string>
|
||||
<string name="settings_enable_location_sharing">Enable location sharing</string>
|
||||
<string name="labs_render_locations_in_timeline">Render user locations in the timeline</string>
|
||||
|
||||
<string name="tooltip_attachment_photo">Open camera</string>
|
||||
<string name="tooltip_attachment_gallery">Send images and videos</string>
|
||||
|
|
|
@ -57,10 +57,15 @@
|
|||
android:title="@string/labs_enable_polls" />
|
||||
|
||||
|
||||
<im.vector.app.core.preference.VectorSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="SETTINGS_LABS_AUTO_REPORT_UISI"
|
||||
android:title="@string/labs_auto_report_uisi"
|
||||
android:summary="@string/labs_auto_report_uisi_desc"/>
|
||||
<im.vector.app.core.preference.VectorSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="SETTINGS_LABS_AUTO_REPORT_UISI"
|
||||
android:summary="@string/labs_auto_report_uisi_desc"
|
||||
android:title="@string/labs_auto_report_uisi" />
|
||||
|
||||
<im.vector.app.core.preference.VectorSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="SETTINGS_LABS_RENDER_LOCATIONS_IN_TIMELINE"
|
||||
android:title="@string/labs_render_locations_in_timeline" />
|
||||
|
||||
</androidx.preference.PreferenceScreen>
|
|
@ -28,11 +28,6 @@
|
|||
android:persistent="false"
|
||||
android:title="@string/font_size" />
|
||||
|
||||
<im.vector.app.core.preference.VectorSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="SETTINGS_PREF_ENABLE_LOCATION_SHARING"
|
||||
android:title="@string/settings_enable_location_sharing" />
|
||||
|
||||
</im.vector.app.core.preference.VectorPreferenceCategory>
|
||||
|
||||
<im.vector.app.core.preference.VectorPreferenceCategory android:title="@string/spaces">
|
||||
|
@ -77,6 +72,11 @@
|
|||
android:title="@string/option_take_photo_video"
|
||||
tools:summary="@string/option_always_ask" />
|
||||
|
||||
<im.vector.app.core.preference.VectorSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="SETTINGS_PREF_ENABLE_LOCATION_SHARING"
|
||||
android:title="@string/settings_enable_location_sharing" />
|
||||
|
||||
</im.vector.app.core.preference.VectorPreferenceCategory>
|
||||
|
||||
<im.vector.app.core.preference.VectorPreferenceCategory android:title="@string/settings_category_timeline">
|
||||
|
|
Loading…
Reference in a new issue