diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/RoomSummary.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/RoomSummary.kt index 0df86e09d7..cb7453fd62 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/RoomSummary.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/RoomSummary.kt @@ -40,10 +40,14 @@ data class RoomSummary constructor( val joinedMembersCount: Int? = 0, val invitedMembersCount: Int? = 0, val latestPreviewableEvent: TimelineEvent? = null, + val latestPreviewableContentEvent: TimelineEvent? = null, + val latestPreviewableOriginalContentEvent: TimelineEvent? = null, val otherMemberIds: List = emptyList(), val notificationCount: Int = 0, val highlightCount: Int = 0, val hasUnreadMessages: Boolean = false, + val hasUnreadContentMessages: Boolean = false, + val hasUnreadOriginalContentMessages: Boolean = false, val tags: List = emptyList(), val membership: Membership = Membership.NONE, val versioningState: VersioningState = VersioningState.NONE, @@ -70,7 +74,42 @@ data class RoomSummary constructor( val canStartCall: Boolean get() = joinedMembersCount == 2 + fun scHasUnreadMessages(preferenceProvider: RoomSummaryPreferenceProvider?): Boolean { + if (preferenceProvider == null) { + // Fallback to default + return hasUnreadMessages + } + return when(preferenceProvider.getUnreadKind()) { + UNREAD_KIND_ORIGINAL_CONTENT -> hasUnreadOriginalContentMessages + UNREAD_KIND_CONTENT -> hasUnreadContentMessages + // UNREAD_KIND_DEFAULT + else -> hasUnreadMessages + } + } + + fun scLatestPreviewableEvent(preferenceProvider: RoomSummaryPreferenceProvider?): TimelineEvent? { + if (preferenceProvider == null) { + // Fallback to default + return latestPreviewableEvent + } + return when(preferenceProvider.getUnreadKind()) { + UNREAD_KIND_ORIGINAL_CONTENT -> latestPreviewableOriginalContentEvent + UNREAD_KIND_CONTENT -> latestPreviewableContentEvent + // UNREAD_KIND_DEFAULT + else -> latestPreviewableEvent + } + } + companion object { const val NOT_IN_BREADCRUMBS = -1 + // SC addition + const val UNREAD_KIND_DEFAULT = 0 + const val UNREAD_KIND_CONTENT = 1 + const val UNREAD_KIND_ORIGINAL_CONTENT = 2 + } + + // SC addition + interface RoomSummaryPreferenceProvider { + fun getUnreadKind(): Int } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/mapper/RoomSummaryMapper.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/mapper/RoomSummaryMapper.kt index bd2aba3e54..057f69bbd6 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/mapper/RoomSummaryMapper.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/mapper/RoomSummaryMapper.kt @@ -34,6 +34,12 @@ internal class RoomSummaryMapper @Inject constructor(private val timelineEventMa val latestEvent = roomSummaryEntity.latestPreviewableEvent?.let { timelineEventMapper.map(it, buildReadReceipts = false) } + val latestContentEvent = roomSummaryEntity.latestPreviewableContentEvent?.let { + timelineEventMapper.map(it, buildReadReceipts = false) + } + val latestOriginalContentEvent = roomSummaryEntity.latestPreviewableOriginalContentEvent?.let { + timelineEventMapper.map(it, buildReadReceipts = false) + } // typings are updated through the sync where room summary entity gets updated no matter what, so it's ok get there val typingUsers = typingUsersTracker.getTypingUsers(roomSummaryEntity.roomId) @@ -45,12 +51,16 @@ internal class RoomSummaryMapper @Inject constructor(private val timelineEventMa avatarUrl = roomSummaryEntity.avatarUrl ?: "", isDirect = roomSummaryEntity.isDirect, latestPreviewableEvent = latestEvent, + latestPreviewableContentEvent = latestContentEvent, + latestPreviewableOriginalContentEvent = latestOriginalContentEvent, joinedMembersCount = roomSummaryEntity.joinedMembersCount, invitedMembersCount = roomSummaryEntity.invitedMembersCount, otherMemberIds = roomSummaryEntity.otherMemberIds.toList(), highlightCount = roomSummaryEntity.highlightCount, notificationCount = roomSummaryEntity.notificationCount, hasUnreadMessages = roomSummaryEntity.hasUnreadMessages, + hasUnreadContentMessages = roomSummaryEntity.hasUnreadContentMessages, + hasUnreadOriginalContentMessages = roomSummaryEntity.hasUnreadOriginalContentMessages, tags = tags, typingUsers = typingUsers, membership = roomSummaryEntity.membership, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/RoomSummaryEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/RoomSummaryEntity.kt index d6859f1d3f..c0e43a4038 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/RoomSummaryEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/RoomSummaryEntity.kt @@ -32,6 +32,8 @@ internal open class RoomSummaryEntity( var name: String? = "", var topic: String? = "", var latestPreviewableEvent: TimelineEventEntity? = null, + var latestPreviewableContentEvent: TimelineEventEntity? = null, + var latestPreviewableOriginalContentEvent: TimelineEventEntity? = null, var heroes: RealmList = RealmList(), var joinedMembersCount: Int? = 0, var invitedMembersCount: Int? = 0, @@ -42,6 +44,8 @@ internal open class RoomSummaryEntity( var highlightCount: Int = 0, var readMarkerId: String? = null, var hasUnreadMessages: Boolean = false, + var hasUnreadContentMessages: Boolean = false, + var hasUnreadOriginalContentMessages: Boolean = false, var tags: RealmList = RealmList(), var userDrafts: UserDraftsEntity? = null, var breadcrumbsIndex: Int = RoomSummary.NOT_IN_BREADCRUMBS, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/read/SetReadMarkersTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/read/SetReadMarkersTask.kt index f750735bbb..6ead29e2cb 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/read/SetReadMarkersTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/read/SetReadMarkersTask.kt @@ -126,6 +126,8 @@ internal class DefaultSetReadMarkersTask @Inject constructor( roomSummary.notificationCount = 0 roomSummary.highlightCount = 0 roomSummary.hasUnreadMessages = false + roomSummary.hasUnreadContentMessages = false + roomSummary.hasUnreadOriginalContentMessages = false } } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt index a8b863f81b..d8c53120a4 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt @@ -64,6 +64,25 @@ internal class RoomSummaryUpdater @Inject constructor( companion object { // TODO: maybe allow user of SDK to give that list val PREVIEWABLE_TYPES = listOf( + // TODO filter message type (KEY_VERIFICATION_READY, etc.) + EventType.MESSAGE, + EventType.STATE_ROOM_NAME, + EventType.STATE_ROOM_TOPIC, + EventType.STATE_ROOM_AVATAR, + EventType.STATE_ROOM_MEMBER, + EventType.STATE_ROOM_HISTORY_VISIBILITY, + EventType.CALL_INVITE, + EventType.CALL_HANGUP, + EventType.CALL_ANSWER, + EventType.ENCRYPTED, + EventType.STATE_ROOM_ENCRYPTION, + EventType.STATE_ROOM_THIRD_PARTY_INVITE, + EventType.STICKER, + EventType.REACTION, + EventType.STATE_ROOM_CREATE + ) + // Same as PREVIEWABLE_CONTENT_TYPES without member state changes // SC feature + val PREVIEWABLE_CONTENT_TYPES = listOf( // TODO filter message type (KEY_VERIFICATION_READY, etc.) EventType.MESSAGE, /* @@ -85,6 +104,31 @@ internal class RoomSummaryUpdater @Inject constructor( EventType.REACTION, EventType.STATE_ROOM_CREATE ) + // Same as PREVIEWABLE_ORIGINAL_CONTENT_TYPES without reactions // SC feature + val PREVIEWABLE_ORIGINAL_CONTENT_TYPES = listOf( + // TODO filter message type (KEY_VERIFICATION_READY, etc.) + EventType.MESSAGE, + /* + EventType.STATE_ROOM_NAME, + EventType.STATE_ROOM_TOPIC, + EventType.STATE_ROOM_AVATAR, + EventType.STATE_ROOM_MEMBER, + EventType.STATE_ROOM_HISTORY_VISIBILITY, + */ + EventType.CALL_INVITE, + EventType.CALL_HANGUP, + EventType.CALL_ANSWER, + EventType.ENCRYPTED, + /* + EventType.STATE_ROOM_ENCRYPTION, + EventType.STATE_ROOM_THIRD_PARTY_INVITE, + */ + EventType.STICKER, + /* + EventType.REACTION, + */ + EventType.STATE_ROOM_CREATE + ) } fun update(realm: Realm, @@ -116,6 +160,10 @@ internal class RoomSummaryUpdater @Inject constructor( val latestPreviewableEvent = TimelineEventEntity.latestEvent(realm, roomId, includesSending = true, filterTypes = PREVIEWABLE_TYPES, filterContentRelation = true) + val latestPreviewableContentEvent = TimelineEventEntity.latestEvent(realm, roomId, includesSending = true, + filterTypes = PREVIEWABLE_CONTENT_TYPES, filterContentRelation = true) + val latestPreviewableOriginalContentEvent = TimelineEventEntity.latestEvent(realm, roomId, includesSending = true, + filterTypes = PREVIEWABLE_ORIGINAL_CONTENT_TYPES, filterContentRelation = true) val lastNameEvent = CurrentStateEventEntity.getOrNull(realm, roomId, type = EventType.STATE_ROOM_NAME, stateKey = "")?.root val lastTopicEvent = CurrentStateEventEntity.getOrNull(realm, roomId, type = EventType.STATE_ROOM_TOPIC, stateKey = "")?.root @@ -130,12 +178,22 @@ internal class RoomSummaryUpdater @Inject constructor( roomSummaryEntity.hasUnreadMessages = roomSummaryEntity.notificationCount > 0 // avoid this call if we are sure there are unread events || !isEventRead(realm.configuration, userId, roomId, latestPreviewableEvent?.eventId) + roomSummaryEntity.hasUnreadContentMessages = roomSummaryEntity.notificationCount > 0 + // avoid this call if we are sure there are unread events + || (latestPreviewableContentEvent != null + && !isEventRead(realm.configuration, userId, roomId, latestPreviewableContentEvent.eventId)) + roomSummaryEntity.hasUnreadOriginalContentMessages = roomSummaryEntity.notificationCount > 0 + // avoid this call if we are sure there are unread events + || (latestPreviewableOriginalContentEvent != null + && !isEventRead(realm.configuration, userId, roomId, latestPreviewableOriginalContentEvent.eventId)) roomSummaryEntity.displayName = roomDisplayNameResolver.resolve(realm, roomId).toString() roomSummaryEntity.avatarUrl = roomAvatarResolver.resolve(realm, roomId) roomSummaryEntity.name = ContentMapper.map(lastNameEvent?.content).toModel()?.name roomSummaryEntity.topic = ContentMapper.map(lastTopicEvent?.content).toModel()?.topic roomSummaryEntity.latestPreviewableEvent = latestPreviewableEvent + roomSummaryEntity.latestPreviewableContentEvent = latestPreviewableContentEvent + roomSummaryEntity.latestPreviewableOriginalContentEvent = latestPreviewableOriginalContentEvent roomSummaryEntity.canonicalAlias = ContentMapper.map(lastCanonicalAliasEvent?.content).toModel() ?.canonicalAlias diff --git a/vector/src/main/java/im/vector/app/features/home/room/ScSdkPreferences.kt b/vector/src/main/java/im/vector/app/features/home/room/ScSdkPreferences.kt new file mode 100644 index 0000000000..63998fc7f7 --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/home/room/ScSdkPreferences.kt @@ -0,0 +1,15 @@ +package im.vector.app.features.home.room + +import android.content.Context +import im.vector.app.features.settings.VectorPreferences +import org.matrix.android.sdk.api.session.room.model.RoomSummary +import javax.inject.Inject + +class ScSdkPreferences @Inject constructor(private val vectorPreferences: VectorPreferences?): RoomSummary.RoomSummaryPreferenceProvider { + + constructor(context: Context?) : this(vectorPreferences = context?.let { VectorPreferences(it) }) + + override fun getUnreadKind(): Int { + return vectorPreferences?.roomUnreadKind() ?: RoomSummary.UNREAD_KIND_DEFAULT + } +} diff --git a/vector/src/main/java/im/vector/app/features/home/room/breadcrumbs/BreadcrumbsController.kt b/vector/src/main/java/im/vector/app/features/home/room/breadcrumbs/BreadcrumbsController.kt index 4e6bb124ad..cf56f6d531 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/breadcrumbs/BreadcrumbsController.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/breadcrumbs/BreadcrumbsController.kt @@ -21,11 +21,13 @@ import com.airbnb.epoxy.EpoxyController import im.vector.app.core.epoxy.zeroItem import im.vector.app.core.utils.DebouncedClickListener import im.vector.app.features.home.AvatarRenderer +import im.vector.app.features.home.room.ScSdkPreferences import org.matrix.android.sdk.api.util.toMatrixItem import javax.inject.Inject class BreadcrumbsController @Inject constructor( - private val avatarRenderer: AvatarRenderer + private val avatarRenderer: AvatarRenderer, + private val scSdkPreferences: ScSdkPreferences ) : EpoxyController() { var listener: Listener? = null @@ -62,7 +64,7 @@ class BreadcrumbsController @Inject constructor( matrixItem(it.toMatrixItem()) unreadNotificationCount(it.notificationCount) showHighlighted(it.highlightCount > 0) - hasUnreadMessage(it.hasUnreadMessages) + hasUnreadMessage(it.scHasUnreadMessages(scSdkPreferences)) hasDraft(it.userDrafts.isNotEmpty()) itemClickListener( DebouncedClickListener(View.OnClickListener { _ -> diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt index 5a89d6cce6..65a06894e3 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt @@ -120,6 +120,7 @@ import im.vector.app.features.crypto.keysbackup.restore.KeysBackupRestoreActivit import im.vector.app.features.crypto.util.toImageRes import im.vector.app.features.crypto.verification.VerificationBottomSheet import im.vector.app.features.home.AvatarRenderer +import im.vector.app.features.home.room.ScSdkPreferences import im.vector.app.features.home.room.detail.composer.TextComposerView import im.vector.app.features.home.room.detail.readreceipts.DisplayReadReceiptsBottomSheet import im.vector.app.features.home.room.detail.timeline.TimelineEventController @@ -1022,7 +1023,7 @@ class RoomDetailFragment @Inject constructor( val inviter = state.asyncInviter() if (summary?.membership == Membership.JOIN) { jumpToBottomView.count = summary.notificationCount - jumpToBottomView.drawBadge = summary.hasUnreadMessages + jumpToBottomView.drawBadge = summary.scHasUnreadMessages(ScSdkPreferences(context)) scrollOnHighlightedEventCallback.timeline = roomDetailViewModel.timeline timelineEventController.update(state) inviteView.visibility = View.GONE diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/RoomListViewState.kt b/vector/src/main/java/im/vector/app/features/home/room/list/RoomListViewState.kt index 2f126dc272..768efaf342 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/RoomListViewState.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/RoomListViewState.kt @@ -25,6 +25,7 @@ import com.airbnb.mvrx.MvRxState import com.airbnb.mvrx.Uninitialized import im.vector.app.R import im.vector.app.features.home.RoomListDisplayMode +import im.vector.app.features.home.room.ScSdkPreferences import org.matrix.android.sdk.api.session.room.members.ChangeMembershipState import org.matrix.android.sdk.api.session.room.model.Membership import org.matrix.android.sdk.api.session.room.model.RoomSummary @@ -41,7 +42,8 @@ data class RoomListViewState( val isGroupRoomsExpanded: Boolean = true, val isCombinedRoomsExpanded: Boolean = true, val isLowPriorityRoomsExpanded: Boolean = true, - val isServerNoticeRoomsExpanded: Boolean = true + val isServerNoticeRoomsExpanded: Boolean = true, + val scSdkPreferences: ScSdkPreferences? = null ) : MvRxState { companion object { @@ -57,12 +59,15 @@ data class RoomListViewState( return ROOM_LIST_ROOM_EXPANDED_LOW_PRIORITY_PREFIX + displayMode.toString() } + // SC addition fun initWithContext(context: Context, displayMode: RoomListDisplayMode): RoomListViewState { val sp = getSharedPreferences(context) val pref = getRoomListExpandedLowPriorityPref(displayMode) - return copy(isLowPriorityRoomsExpanded = sp.getBoolean(pref, isLowPriorityRoomsExpanded)) + val scSdkPreferences = ScSdkPreferences(context) + return copy(isLowPriorityRoomsExpanded = sp.getBoolean(pref, isLowPriorityRoomsExpanded), scSdkPreferences = scSdkPreferences) } + // SC addition fun persistWithContext(context: Context, displayMode: RoomListDisplayMode) { val sp = getSharedPreferences(context) val pref = getRoomListExpandedLowPriorityPref(displayMode) @@ -97,7 +102,7 @@ data class RoomListViewState( get() = asyncFilteredRooms.invoke() ?.flatMap { it.value } ?.filter { it.membership == Membership.JOIN } - ?.any { it.hasUnreadMessages } + ?.any { it.scHasUnreadMessages(scSdkPreferences) } ?: false } diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt index da58748dea..1fa221974c 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt @@ -25,6 +25,7 @@ import im.vector.app.core.resources.DateProvider import im.vector.app.core.resources.StringProvider import im.vector.app.core.utils.DebouncedClickListener import im.vector.app.features.home.AvatarRenderer +import im.vector.app.features.home.room.ScSdkPreferences import im.vector.app.features.home.room.detail.timeline.format.DisplayableEventFormatter import im.vector.app.features.home.room.typing.TypingHelper import org.matrix.android.sdk.api.session.room.members.ChangeMembershipState @@ -37,7 +38,8 @@ class RoomSummaryItemFactory @Inject constructor(private val displayableEventFor private val dateFormatter: VectorDateFormatter, private val stringProvider: StringProvider, private val typingHelper: TypingHelper, - private val avatarRenderer: AvatarRenderer) { + private val avatarRenderer: AvatarRenderer, + private val scSdkPreferences: ScSdkPreferences) { fun create(roomSummary: RoomSummary, roomChangeMembershipStates: Map, @@ -85,7 +87,7 @@ class RoomSummaryItemFactory @Inject constructor(private val displayableEventFor val showSelected = selectedRoomIds.contains(roomSummary.roomId) var latestFormattedEvent: CharSequence = "" var latestEventTime: CharSequence = "" - val latestEvent = roomSummary.latestPreviewableEvent + val latestEvent = roomSummary.scLatestPreviewableEvent(scSdkPreferences) if (latestEvent != null) { val date = latestEvent.root.localDateTime() val currentDate = DateProvider.currentLocalDateTime() @@ -111,7 +113,7 @@ class RoomSummaryItemFactory @Inject constructor(private val displayableEventFor .showSelected(showSelected) .hasFailedSending(roomSummary.hasFailedSending) .unreadNotificationCount(unreadCount) - .hasUnreadMessage(roomSummary.hasUnreadMessages) + .hasUnreadMessage(roomSummary.scHasUnreadMessages(scSdkPreferences)) .hasDraft(roomSummary.userDrafts.isNotEmpty()) .itemLongClickListener { _ -> onLongClick?.invoke(roomSummary) ?: false diff --git a/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt b/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt index b94c0e3b3d..8092235d26 100755 --- a/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt +++ b/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt @@ -29,6 +29,7 @@ import im.vector.app.R import im.vector.app.features.homeserver.ServerUrlsRepository import im.vector.app.features.themes.ThemeUtils import org.matrix.android.sdk.api.extensions.tryThis +import org.matrix.android.sdk.api.session.room.model.RoomSummary import timber.log.Timber import javax.inject.Inject @@ -96,7 +97,6 @@ class VectorPreferences @Inject constructor(private val context: Context) { private const val SETTINGS_SHOW_AVATAR_DISPLAY_NAME_CHANGES_MESSAGES_KEY = "SETTINGS_SHOW_AVATAR_DISPLAY_NAME_CHANGES_MESSAGES_KEY" private const val SETTINGS_VIBRATE_ON_MENTION_KEY = "SETTINGS_VIBRATE_ON_MENTION_KEY" private const val SETTINGS_SEND_MESSAGE_WITH_ENTER = "SETTINGS_SEND_MESSAGE_WITH_ENTER" - const val SETTINGS_SINGLE_OVERVIEW = "SETTINGS_SINGLE_OVERVIEW" // Help private const val SETTINGS_SHOULD_SHOW_HELP_ON_ROOM_LIST_KEY = "SETTINGS_SHOULD_SHOW_HELP_ON_ROOM_LIST_KEY" @@ -174,6 +174,10 @@ class VectorPreferences @Inject constructor(private val context: Context) { private const val DID_ASK_TO_USE_ANALYTICS_TRACKING_KEY = "DID_ASK_TO_USE_ANALYTICS_TRACKING_KEY" private const val SETTINGS_DISPLAY_ALL_EVENTS_KEY = "SETTINGS_DISPLAY_ALL_EVENTS_KEY" + // SC additions + private const val SETTINGS_SINGLE_OVERVIEW = "SETTINGS_SINGLE_OVERVIEW" + private const val SETTINGS_ROOM_UNREAD_KIND = "SETTINGS_ROOM_UNREAD_KIND" + private const val DID_ASK_TO_ENABLE_SESSION_PUSH = "DID_ASK_TO_ENABLE_SESSION_PUSH" private const val MEDIA_SAVING_3_DAYS = 0 @@ -825,10 +829,21 @@ class VectorPreferences @Inject constructor(private val context: Context) { return defaultPrefs.getBoolean(SETTINGS_SECURITY_USE_FLAG_SECURE, false) } + // SC addition fun singleOverview(): Boolean { return defaultPrefs.getBoolean(SETTINGS_SINGLE_OVERVIEW, true) } + // SC addition + fun roomUnreadKind(): Int { + val kind = defaultPrefs.getString(SETTINGS_ROOM_UNREAD_KIND, RoomSummary.UNREAD_KIND_CONTENT.toString()) + return try { + Integer.parseInt(kind!!) + } catch (e: Exception) { + RoomSummary.UNREAD_KIND_CONTENT + } + } + /** * The user enable protecting app access with pin code */ diff --git a/vector/src/main/res/values-de/strings_sc.xml b/vector/src/main/res/values-de/strings_sc.xml index 59e2758371..981c9b05b5 100644 --- a/vector/src/main/res/values-de/strings_sc.xml +++ b/vector/src/main/res/values-de/strings_sc.xml @@ -4,6 +4,11 @@ Vereinte Chat-Übersicht Zeige sowohl Direktnachrichten als auch Gruppenchats in einer gemeinsamen Übersicht + Chat-Vorschau + All Ereignisse + Verstecke Teilnehmerveränderungen + Verstecke Teilnehmerveränderungen und Reaktionen + Nacht-Design SC Hell SC Schwarz diff --git a/vector/src/main/res/values/arrays_sc.xml b/vector/src/main/res/values/arrays_sc.xml index 2c5305c28e..597d84fd73 100644 --- a/vector/src/main/res/values/arrays_sc.xml +++ b/vector/src/main/res/values/arrays_sc.xml @@ -12,4 +12,15 @@ both + + @string/settings_room_unread_kind_default + @string/settings_room_unread_kind_content + @string/settings_room_unread_kind_original_content + + + 0 + 1 + 2 + + diff --git a/vector/src/main/res/values/strings_sc.xml b/vector/src/main/res/values/strings_sc.xml index dd7e2b8e52..f48241d50a 100644 --- a/vector/src/main/res/values/strings_sc.xml +++ b/vector/src/main/res/values/strings_sc.xml @@ -4,6 +4,11 @@ Combined chat overview View both direct messages and rooms on one page + Chat preview content + Show all events + Hide member changes + Hide member changes and reactions + Night Theme SC Light SC Black diff --git a/vector/src/main/res/xml/vector_settings_preferences.xml b/vector/src/main/res/xml/vector_settings_preferences.xml index 98de714521..d1fdb750e1 100644 --- a/vector/src/main/res/xml/vector_settings_preferences.xml +++ b/vector/src/main/res/xml/vector_settings_preferences.xml @@ -45,6 +45,14 @@ android:summary="@string/settings_single_overview_summary" android:title="@string/settings_single_overview" /> + +