removing noisy log which duplicates a type clause and fixing when casing formatting to have a case per line

This commit is contained in:
Adam Brown 2021-10-27 14:34:40 +01:00
parent e7a0a4d4ae
commit 7b356484ae

View file

@ -22,7 +22,6 @@ import io.realm.RealmQuery
import org.matrix.android.sdk.api.query.QueryStringValue
import org.matrix.android.sdk.api.query.QueryStringValue.ContentQueryStringValue
import org.matrix.android.sdk.internal.util.Normalizer
import timber.log.Timber
import javax.inject.Inject
class QueryStringValueProcessor @Inject constructor(
@ -31,10 +30,7 @@ class QueryStringValueProcessor @Inject constructor(
fun <T : RealmObject> RealmQuery<T>.process(field: String, queryStringValue: QueryStringValue): RealmQuery<T> {
return when (queryStringValue) {
is QueryStringValue.NoCondition -> {
Timber.v("No condition to process")
this
}
is QueryStringValue.NoCondition -> this
is QueryStringValue.IsNotNull -> isNotNull(field)
is QueryStringValue.IsNull -> isNull(field)
is QueryStringValue.IsEmpty -> isEmpty(field)
@ -48,15 +44,17 @@ class QueryStringValueProcessor @Inject constructor(
private fun ContentQueryStringValue.toRealmValue(): String {
return when (case) {
QueryStringValue.Case.NORMALIZED -> normalizer.normalize(string)
QueryStringValue.Case.SENSITIVE, QueryStringValue.Case.INSENSITIVE -> string
QueryStringValue.Case.NORMALIZED -> normalizer.normalize(string)
QueryStringValue.Case.SENSITIVE,
QueryStringValue.Case.INSENSITIVE -> string
}
}
}
private fun QueryStringValue.Case.toRealmCase(): Case {
return when (this) {
QueryStringValue.Case.INSENSITIVE -> Case.INSENSITIVE
QueryStringValue.Case.SENSITIVE, QueryStringValue.Case.NORMALIZED -> Case.SENSITIVE
QueryStringValue.Case.INSENSITIVE -> Case.INSENSITIVE
QueryStringValue.Case.SENSITIVE,
QueryStringValue.Case.NORMALIZED -> Case.SENSITIVE
}
}