mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 01:15:54 +03:00
Add setting to put DM in spaces based on user memberships
Change-Id: If202f640b2061423167cc8fc205781ab48ea4793
This commit is contained in:
parent
a6f809c613
commit
923c80125e
5 changed files with 16 additions and 1 deletions
|
@ -14,6 +14,7 @@ package de.spiritcroc.matrixsdk
|
|||
// RoomSummary preferences
|
||||
fun roomUnreadKind(isDirect: Boolean): Int
|
||||
fun aggregateUnreadRoomCounts(): Boolean
|
||||
fun includeSpaceMembersAsSpaceRooms(): Boolean
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package org.matrix.android.sdk.internal.session.room.summary
|
||||
|
||||
import de.spiritcroc.matrixsdk.StaticScSdkHelper
|
||||
import io.realm.Realm
|
||||
import io.realm.kotlin.createObject
|
||||
import org.matrix.android.sdk.api.extensions.tryOrNull
|
||||
|
@ -408,7 +409,7 @@ internal class RoomSummaryUpdater @Inject constructor(
|
|||
|
||||
// we need also to filter DMs...
|
||||
// it's more annoying as based on if the other members belong the space or not
|
||||
if (false /*TODO setting*/) {
|
||||
if (StaticScSdkHelper.scSdkPreferenceProvider?.includeSpaceMembersAsSpaceRooms() == true) {
|
||||
// Wrong indention for upstream merge-ability
|
||||
RoomSummaryEntity.where(realm)
|
||||
.equalTo(RoomSummaryEntityFields.IS_DIRECT, true)
|
||||
|
|
|
@ -213,6 +213,7 @@ class VectorPreferences @Inject constructor(private val context: Context): Stati
|
|||
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 SETTINGS_SPACE_MEMBERS_IN_SPACE_ROOMS = "SETTINGS_SPACE_MEMBERS_IN_SPACE_ROOMS"
|
||||
|
||||
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"
|
||||
|
@ -984,6 +985,10 @@ class VectorPreferences @Inject constructor(private val context: Context): Stati
|
|||
return defaultPrefs.getBoolean(SETTINGS_AGGREGATE_UNREAD_COUNTS, true)
|
||||
}
|
||||
|
||||
override fun includeSpaceMembersAsSpaceRooms(): Boolean {
|
||||
return defaultPrefs.getBoolean(SETTINGS_SPACE_MEMBERS_IN_SPACE_ROOMS, false)
|
||||
}
|
||||
|
||||
// SC addition
|
||||
fun simplifiedMode(): Boolean {
|
||||
return defaultPrefs.getBoolean(SETTINGS_SIMPLIFIED_MODE, false)
|
||||
|
|
|
@ -147,5 +147,7 @@
|
|||
|
||||
<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>
|
||||
<string name="settings_include_space_members_as_rooms">Show people in spaces</string>
|
||||
<string name="settings_include_space_members_as_rooms_summary">If disabled, you can still add Direct Messages to Personal Spaces. If enabled, you\'ll automatically see everyone who is a member of the Space.</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -124,6 +124,12 @@
|
|||
android:title="@string/preference_show_all_rooms_in_home"
|
||||
android:summary="@string/all_rooms_youre_in_will_be_shown_in_home" />
|
||||
|
||||
<im.vector.app.core.preference.VectorSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="SETTINGS_SPACE_MEMBERS_IN_SPACE_ROOMS"
|
||||
android:title="@string/settings_include_space_members_as_rooms"
|
||||
android:summary="@string/settings_include_space_members_as_rooms_summary" />
|
||||
|
||||
</im.vector.app.core.preference.VectorPreferenceCategory>
|
||||
|
||||
<im.vector.app.core.preference.VectorPreferenceCategory android:title="@string/settings_category_composer">
|
||||
|
|
Loading…
Reference in a new issue