mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
fix: completion service matches now any character
also added a test for it
This commit is contained in:
+5
-4
@@ -9,7 +9,8 @@ import Combine
|
||||
import Foundation
|
||||
|
||||
private enum SuggestionTriggerRegex {
|
||||
static let atOrHash = /[@#]\w*/
|
||||
/// Matches any string of characters after an @ or # that is not a whitespace
|
||||
static let atOrHash = /[@#]\S*/
|
||||
|
||||
static let at: Character = "@"
|
||||
static let hash: Character = "#"
|
||||
@@ -138,11 +139,11 @@ final class CompletionSuggestionService: CompletionSuggestionServiceProtocol {
|
||||
guard !searchText.isEmpty else {
|
||||
return true
|
||||
}
|
||||
let containedInUserID = userID.localizedStandardContains(searchText.lowercased())
|
||||
let containedInUserID = userID.localizedStandardContains(searchText)
|
||||
|
||||
let containedInDisplayName: Bool
|
||||
if let displayName {
|
||||
containedInDisplayName = displayName.localizedStandardContains(searchText.lowercased())
|
||||
containedInDisplayName = displayName.localizedStandardContains(searchText)
|
||||
} else {
|
||||
containedInDisplayName = false
|
||||
}
|
||||
@@ -155,6 +156,6 @@ final class CompletionSuggestionService: CompletionSuggestionServiceProtocol {
|
||||
guard !searchText.isEmpty else {
|
||||
return true
|
||||
}
|
||||
return roomName.localizedStandardContains(searchText.lowercased()) || roomAlias.localizedStandardContains(searchText.lowercased())
|
||||
return roomName.localizedStandardContains(searchText) || roomAlias.localizedStandardContains(searchText)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user