mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-26 03:40:56 +01:00
Sort "new group story" entries by recency.
This commit is contained in:
committed by
Cody Henthorne
parent
28310a88f5
commit
e517232172
@@ -63,6 +63,7 @@ class ContactSearchConfiguration private constructor(
|
||||
val includeV1: Boolean = false,
|
||||
val includeInactive: Boolean = false,
|
||||
val returnAsGroupStories: Boolean = false,
|
||||
val sortOrder: ContactSearchSortOrder = ContactSearchSortOrder.NATURAL,
|
||||
override val includeHeader: Boolean,
|
||||
override val expandConfig: ExpandConfig? = null
|
||||
) : Section(SectionKey.GROUPS)
|
||||
|
||||
@@ -41,8 +41,19 @@ open class ContactSearchPagedDataSourceRepository(
|
||||
return contactRepository.queryNonGroupContacts(query ?: "", includeSelf)
|
||||
}
|
||||
|
||||
open fun getGroupContacts(section: ContactSearchConfiguration.Section.Groups, query: String?): Cursor? {
|
||||
return SignalDatabase.groups.queryGroupsByTitle(query ?: "", section.includeInactive, !section.includeV1, !section.includeMms).cursor
|
||||
open fun getGroupContacts(
|
||||
section: ContactSearchConfiguration.Section.Groups,
|
||||
query: String?
|
||||
): Cursor? {
|
||||
return SignalDatabase.groups.queryGroups(
|
||||
GroupDatabase.GroupQuery.Builder()
|
||||
.withSearchQuery(query)
|
||||
.withInactiveGroups(section.includeInactive)
|
||||
.withMmsGroups(section.includeMms)
|
||||
.withV1Groups(section.includeV1)
|
||||
.withSortOrder(section.sortOrder)
|
||||
.build()
|
||||
).cursor
|
||||
}
|
||||
|
||||
open fun getRecents(section: ContactSearchConfiguration.Section.Recents): Cursor? {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.thoughtcrime.securesms.contacts.paged
|
||||
|
||||
/**
|
||||
* Different options for sort order of contact search items.
|
||||
*/
|
||||
enum class ContactSearchSortOrder {
|
||||
/**
|
||||
* The "natural" expected order. This is considered the default ordering.
|
||||
* For example, Groups would normally be ordered by title from A-Z.
|
||||
*/
|
||||
NATURAL,
|
||||
|
||||
/**
|
||||
* The requested ordering is by recency. This can mean different things for
|
||||
* different contact types. For example, for Groups, this entry means that
|
||||
* the results are ordered by latest message date in descending order.
|
||||
*/
|
||||
RECENCY
|
||||
}
|
||||
Reference in New Issue
Block a user