Make "jump to bottom on send" a setting

Closes https://github.com/SchildiChat/SchildiChat-android/issues/94

Change-Id: I785dd13f4b40f495ae6ac1cea4d3f8af33ffe883
This commit is contained in:
SpiritCroc 2021-10-21 17:56:49 +02:00
parent 5526485814
commit be4ba1aabc
4 changed files with 17 additions and 1 deletions

View file

@ -1383,7 +1383,9 @@ class RoomDetailFragment @Inject constructor(
textComposerViewModel.handle(TextComposerAction.SendMessage(text, vectorPreferences.isMarkdownEnabled()))
emojiPopup.dismiss()
doJumpToBottom()
if (vectorPreferences.jumpToBottomOnSend()) {
doJumpToBottom()
}
}
}

View file

@ -211,6 +211,7 @@ class VectorPreferences @Inject constructor(private val context: Context) {
const val SETTINGS_VOICE_MESSAGE = "SETTINGS_VOICE_MESSAGE"
const val SETTINGS_UNIFIED_PUSH_FORCE_CUSTOM_GATEWAY = "SETTINGS_UNIFIED_PUSH_FORCE_CUSTOM_GATEWAY"
const val SETTINGS_FORCE_ALLOW_BACKGROUND_SYNC = "SETTINGS_FORCE_ALLOW_BACKGROUND_SYNC"
private const val SETTINGS_JUMP_TO_BOTTOM_ON_SEND = "SETTINGS_JUMP_TO_BOTTOM_ON_SEND"
private const val DID_ASK_TO_ENABLE_SESSION_PUSH = "DID_ASK_TO_ENABLE_SESSION_PUSH"
private const val DID_PROMOTE_NEW_RESTRICTED_JOIN_RULE = "DID_PROMOTE_NEW_RESTRICTED_JOIN_RULE"
@ -1036,6 +1037,10 @@ class VectorPreferences @Inject constructor(private val context: Context) {
return Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP && defaultPrefs.getBoolean(SETTINGS_VOICE_MESSAGE, true)
}
fun jumpToBottomOnSend(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_JUMP_TO_BOTTOM_ON_SEND, true)
}
fun forceUseCustomUpGateway(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_UNIFIED_PUSH_FORCE_CUSTOM_GATEWAY, false)
}

View file

@ -145,4 +145,7 @@
<string name="toast_unifiedpush_no_push_distributor">No push distributor found!</string>
<string name="toast_unifiedpush_one_push_distributor">Registered push distributor %1$s</string>
<string name="settings_jump_to_bottom_on_send">Jump to bottom on send</string>
<string name="settings_jump_to_bottom_on_send_summary">Automatically scroll down when sending a message</string>
</resources>

View file

@ -146,6 +146,12 @@
android:summary="@string/settings_send_message_with_enter_summary"
android:title="@string/settings_send_message_with_enter" />
<im.vector.app.core.preference.VectorSwitchPreference
android:defaultValue="true"
android:key="SETTINGS_JUMP_TO_BOTTOM_ON_SEND"
android:title="@string/settings_jump_to_bottom_on_send"
android:summary="@string/settings_jump_to_bottom_on_send_summary" />
<im.vector.app.core.preference.VectorSwitchPreference
android:defaultValue="true"
android:key="SETTINGS_SHOW_EMOJI_KEYBOARD"