From 6d86b25acd15579be970875b5c7a8d3904f7995c Mon Sep 17 00:00:00 2001 From: Cody Henthorne Date: Wed, 6 Apr 2022 15:23:33 -0400 Subject: [PATCH] Improve story contact search. --- .../securesms/database/DistributionListDatabase.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/DistributionListDatabase.kt b/app/src/main/java/org/thoughtcrime/securesms/database/DistributionListDatabase.kt index 12b12ba6e3..943e53d039 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/DistributionListDatabase.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/DistributionListDatabase.kt @@ -140,14 +140,14 @@ class DistributionListDatabase constructor(context: Context?, databaseHelper: Si val where = when { query.isNullOrEmpty() && includeMyStory -> ListTable.IS_NOT_DELETED query.isNullOrEmpty() -> "${ListTable.ID} != ? AND ${ListTable.IS_NOT_DELETED}" - includeMyStory -> "(${ListTable.NAME} LIKE ? OR ${ListTable.ID} == ?) AND ${ListTable.IS_NOT_DELETED}" - else -> "${ListTable.NAME} LIKE ? AND ${ListTable.ID} != ? AND ${ListTable.IS_NOT_DELETED}" + includeMyStory -> "(${ListTable.NAME} GLOB ? OR ${ListTable.ID} == ?) AND ${ListTable.IS_NOT_DELETED}" + else -> "${ListTable.NAME} GLOB ? AND ${ListTable.ID} != ? AND ${ListTable.IS_NOT_DELETED}" } val whereArgs = when { query.isNullOrEmpty() && includeMyStory -> null query.isNullOrEmpty() -> SqlUtil.buildArgs(DistributionListId.MY_STORY_ID) - else -> SqlUtil.buildArgs("%$query%", DistributionListId.MY_STORY_ID) + else -> SqlUtil.buildArgs(SqlUtil.buildCaseInsensitiveGlobPattern(query), DistributionListId.MY_STORY_ID) } return db.query(ListTable.TABLE_NAME, projection, where, whereArgs, null, null, null)