Add setting to disable member click to mention

Change-Id: I2d6660baaa31f74fd0217262bf887da16a61c9b3
This commit is contained in:
SpiritCroc 2022-12-04 13:22:32 +01:00
parent 8e97b7c79d
commit 1d62cd09d2
4 changed files with 22 additions and 1 deletions

View File

@ -207,4 +207,7 @@
<string name="in_reply_to_loading">Loading replied-to message…</string>
<string name="in_reply_to_error">Failed to load replied-to message</string>
<string name="settings_enable_member_name_click">Clickable names</string>
<string name="settings_enable_member_name_click_summary">Click on a username to mention them</string>
</resources>

View File

@ -1881,8 +1881,10 @@ class TimelineFragment :
}
override fun onMemberNameClicked(informationData: MessageInformationData) {
if (vectorPreferences.enableMemberNameClick()) {
messageComposerViewModel.handle(MessageComposerAction.InsertUserDisplayName(informationData.senderId))
}
}
override fun onClickOnReactionPill(informationData: MessageInformationData, reaction: String, on: Boolean) {
if (on) {

View File

@ -259,6 +259,7 @@ class VectorPreferences @Inject constructor(
const val SETTINGS_FORCE_ALLOW_BACKGROUND_SYNC = "SETTINGS_FORCE_ALLOW_BACKGROUND_SYNC"
const val SETTINGS_ROOM_SORT_ORDER_NULL = "SETTINGS_ROOM_SORT_ORDER_NULL"
const val SETTINGS_ROOM_SORT_ORDER_NON_NULL = "SETTINGS_ROOM_SORT_ORDER_NON_NULL"
private const val SETTINGS_ENABLE_MEMBER_NAME_CLICK = "SETTINGS_ENABLE_MEMBER_NAME_CLICK"
private const val DID_ASK_TO_ENABLE_SESSION_PUSH = "DID_ASK_TO_ENABLE_SESSION_PUSH"
@ -1216,14 +1217,22 @@ class VectorPreferences @Inject constructor(
return defaultPrefs.getBoolean(SETTINGS_SHOW_OPEN_ANONYMOUS, false)
}
// SC addition
fun floatingDate(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_FLOATING_DATE, true)
}
// SC addition
fun spaceBackNavigation(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_SPACE_BACK_NAVIGATION, false)
}
// SC addition
fun enableMemberNameClick(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_ENABLE_MEMBER_NAME_CLICK, true)
}
/**
* I likely do more fresh installs of the app than anyone else, so a shortcut to change some of the default settings to
* my preferred values can safe me some time
@ -1250,6 +1259,7 @@ class VectorPreferences @Inject constructor(
.putBoolean(SETTINGS_SHOW_OPEN_ANONYMOUS, true)
.putBoolean(SETTINGS_FLOATING_DATE, true)
.putBoolean(SETTINGS_FOLLOW_SYSTEM_LOCALE, true)
.putBoolean(SETTINGS_ENABLE_MEMBER_NAME_CLICK, false)
.apply()
}

View File

@ -272,6 +272,12 @@
android:title="@string/settings_vibrate_on_mention"
app:isPreferenceVisible="@bool/false_not_implemented" />
<im.vector.app.core.preference.VectorSwitchPreference
android:key="SETTINGS_ENABLE_MEMBER_NAME_CLICK"
android:title="@string/settings_enable_member_name_click"
android:summary="@string/settings_enable_member_name_click_summary"
android:defaultValue="true" />
<im.vector.app.core.preference.VectorSwitchPreference
android:key="SETTINGS_FLOATING_DATE"
android:title="@string/settings_floating_date"