mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 01:15:54 +03:00
Add setting to allow disabling direct share
Direct share continues to be enabled by default. As requested in #2725 Signed-off-by: Joaquín Aguirrezabalaga <kinote@kinote.org>
This commit is contained in:
parent
e1393c2d63
commit
3a430efb02
5 changed files with 22 additions and 4 deletions
1
changelog.d/2725.feature
Normal file
1
changelog.d/2725.feature
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Add setting to allow disabling direct share
|
|
@ -1032,6 +1032,8 @@
|
||||||
<string name="settings_chat_effects_description">Use /confetti command or send a message containing ❄️ or 🎉</string>
|
<string name="settings_chat_effects_description">Use /confetti command or send a message containing ❄️ or 🎉</string>
|
||||||
<string name="settings_autoplay_animated_images_title">Autoplay animated images</string>
|
<string name="settings_autoplay_animated_images_title">Autoplay animated images</string>
|
||||||
<string name="settings_autoplay_animated_images_summary">Play animated images in the timeline as soon as they are visible</string>
|
<string name="settings_autoplay_animated_images_summary">Play animated images in the timeline as soon as they are visible</string>
|
||||||
|
<string name="settings_enable_direct_share_title">Enable direct share</string>
|
||||||
|
<string name="settings_enable_direct_share_summary">Show recent chats in the system share menu</string>
|
||||||
<string name="settings_show_join_leave_messages">Show join and leave events</string>
|
<string name="settings_show_join_leave_messages">Show join and leave events</string>
|
||||||
<string name="settings_show_join_leave_messages_summary">Invites, removes, and bans are unaffected.</string>
|
<string name="settings_show_join_leave_messages_summary">Invites, removes, and bans are unaffected.</string>
|
||||||
<string name="settings_show_avatar_display_name_changes_messages">Show account events</string>
|
<string name="settings_show_avatar_display_name_changes_messages">Show account events</string>
|
||||||
|
|
|
@ -29,6 +29,7 @@ import im.vector.app.core.glide.GlideApp
|
||||||
import im.vector.app.core.resources.BuildMeta
|
import im.vector.app.core.resources.BuildMeta
|
||||||
import im.vector.app.core.utils.DimensionConverter
|
import im.vector.app.core.utils.DimensionConverter
|
||||||
import im.vector.app.features.MainActivity
|
import im.vector.app.features.MainActivity
|
||||||
|
import im.vector.app.features.settings.VectorPreferences
|
||||||
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
||||||
import org.matrix.android.sdk.api.util.toMatrixItem
|
import org.matrix.android.sdk.api.util.toMatrixItem
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -55,6 +56,7 @@ class ShortcutCreator @Inject constructor(
|
||||||
dimensionConverter.dpToPx(72)
|
dimensionConverter.dpToPx(72)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Inject lateinit var vectorPreferences: VectorPreferences
|
||||||
|
|
||||||
fun canCreateShortcut(): Boolean {
|
fun canCreateShortcut(): Boolean {
|
||||||
return ShortcutManagerCompat.isRequestPinShortcutSupported(context)
|
return ShortcutManagerCompat.isRequestPinShortcutSupported(context)
|
||||||
|
@ -73,10 +75,12 @@ class ShortcutCreator @Inject constructor(
|
||||||
} catch (failure: Throwable) {
|
} catch (failure: Throwable) {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
val categories = if (Build.VERSION.SDK_INT >= 25) {
|
val categories = mutableSetOf<String>()
|
||||||
setOf(directShareCategory, ShortcutInfo.SHORTCUT_CATEGORY_CONVERSATION)
|
if (vectorPreferences.directShareEnabled()) {
|
||||||
} else {
|
categories.add(directShareCategory)
|
||||||
setOf(directShareCategory)
|
}
|
||||||
|
if (Build.VERSION.SDK_INT >= 25) {
|
||||||
|
categories.add(ShortcutInfo.SHORTCUT_CATEGORY_CONVERSATION)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ShortcutInfoCompat.Builder(context, roomSummary.roomId)
|
return ShortcutInfoCompat.Builder(context, roomSummary.roomId)
|
||||||
|
|
|
@ -123,6 +123,7 @@ class VectorPreferences @Inject constructor(
|
||||||
private const val SETTINGS_LABS_ENABLE_LATEX_MATHS = "SETTINGS_LABS_ENABLE_LATEX_MATHS"
|
private const val SETTINGS_LABS_ENABLE_LATEX_MATHS = "SETTINGS_LABS_ENABLE_LATEX_MATHS"
|
||||||
const val SETTINGS_PRESENCE_USER_ALWAYS_APPEARS_OFFLINE = "SETTINGS_PRESENCE_USER_ALWAYS_APPEARS_OFFLINE"
|
const val SETTINGS_PRESENCE_USER_ALWAYS_APPEARS_OFFLINE = "SETTINGS_PRESENCE_USER_ALWAYS_APPEARS_OFFLINE"
|
||||||
const val SETTINGS_AUTOPLAY_ANIMATED_IMAGES = "SETTINGS_AUTOPLAY_ANIMATED_IMAGES"
|
const val SETTINGS_AUTOPLAY_ANIMATED_IMAGES = "SETTINGS_AUTOPLAY_ANIMATED_IMAGES"
|
||||||
|
private const val SETTINGS_ENABLE_DIRECT_SHARE = "SETTINGS_ENABLE_DIRECT_SHARE"
|
||||||
|
|
||||||
// Room directory
|
// Room directory
|
||||||
private const val SETTINGS_ROOM_DIRECTORY_SHOW_ALL_PUBLIC_ROOMS = "SETTINGS_ROOM_DIRECTORY_SHOW_ALL_PUBLIC_ROOMS"
|
private const val SETTINGS_ROOM_DIRECTORY_SHOW_ALL_PUBLIC_ROOMS = "SETTINGS_ROOM_DIRECTORY_SHOW_ALL_PUBLIC_ROOMS"
|
||||||
|
@ -1004,6 +1005,10 @@ class VectorPreferences @Inject constructor(
|
||||||
return defaultPrefs.getBoolean(SETTINGS_ENABLE_CHAT_EFFECTS, true)
|
return defaultPrefs.getBoolean(SETTINGS_ENABLE_CHAT_EFFECTS, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun directShareEnabled(): Boolean {
|
||||||
|
return defaultPrefs.getBoolean(SETTINGS_ENABLE_DIRECT_SHARE, true)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if Pin code is disabled, or if user set the settings to see full notification content.
|
* Return true if Pin code is disabled, or if user set the settings to see full notification content.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -147,6 +147,12 @@
|
||||||
android:title="@string/settings_vibrate_on_mention"
|
android:title="@string/settings_vibrate_on_mention"
|
||||||
app:isPreferenceVisible="@bool/false_not_implemented" />
|
app:isPreferenceVisible="@bool/false_not_implemented" />
|
||||||
|
|
||||||
|
<im.vector.app.core.preference.VectorSwitchPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="SETTINGS_ENABLE_DIRECT_SHARE"
|
||||||
|
android:summary="@string/settings_enable_direct_share_summary"
|
||||||
|
android:title="@string/settings_enable_direct_share_title" />
|
||||||
|
|
||||||
</im.vector.app.core.preference.VectorPreferenceCategory>
|
</im.vector.app.core.preference.VectorPreferenceCategory>
|
||||||
|
|
||||||
<im.vector.app.core.preference.VectorPreferenceCategory
|
<im.vector.app.core.preference.VectorPreferenceCategory
|
||||||
|
|
Loading…
Reference in a new issue