mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Use enum directly instead of its value.
This commit is contained in:
parent
430a0d2492
commit
e21f306635
@ -55,7 +55,7 @@ internal class DefaultSearchTask @Inject constructor(
|
||||
searchCategories = SearchRequestCategories(
|
||||
roomEvents = SearchRequestRoomEvents(
|
||||
searchTerm = params.searchTerm,
|
||||
orderBy = if (params.orderByRecent) SearchRequestOrder.RECENT.value else SearchRequestOrder.RANK.value,
|
||||
orderBy = if (params.orderByRecent) SearchRequestOrder.RECENT else SearchRequestOrder.RANK,
|
||||
filter = SearchRequestFilter(
|
||||
limit = params.limit,
|
||||
rooms = listOf(params.roomId)
|
||||
|
@ -17,13 +17,14 @@
|
||||
|
||||
package org.matrix.android.sdk.internal.session.search.request
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
/**
|
||||
* Represents the order in which to search for results.
|
||||
*/
|
||||
@JsonClass(generateAdapter = false)
|
||||
internal enum class SearchRequestOrder(val value: String) {
|
||||
RANK("rank"),
|
||||
RECENT("recent")
|
||||
internal enum class SearchRequestOrder {
|
||||
@Json(name = "rank") RANK,
|
||||
@Json(name = "recent") RECENT
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ internal data class SearchRequestRoomEvents(
|
||||
val filter: SearchRequestFilter? = null,
|
||||
// By default, this is "rank". One of: ["recent", "rank"]
|
||||
@Json(name = "order_by")
|
||||
val orderBy: String? = null,
|
||||
val orderBy: SearchRequestOrder? = null,
|
||||
// Configures whether any context for the events returned are included in the response.
|
||||
@Json(name = "event_context")
|
||||
val eventContext: SearchRequestEventContext? = null
|
||||
|
Loading…
Reference in New Issue
Block a user