feat: add PeopleNameFilter for people-sheet search

Pure case-insensitive display-name match so mesh, geohash, bridge, and
group lists can share one query without duplicating trim/empty rules.
This commit is contained in:
Taksh 2026-08-01 14:08:13 +03:00
parent 681c180060
commit 5b5adf2e2e

View File

@ -0,0 +1,19 @@
//
// PeopleNameFilter.swift
// bitchat
//
// This is free and unencumbered software released into the public domain.
// For more information, see <https://unlicense.org>
//
import Foundation
/// Case-insensitive nickname / display-name match for the people sheet search field.
enum PeopleNameFilter {
/// Empty / whitespace-only queries match everything (no filter active).
static func matches(_ displayName: String, query: String) -> Bool {
let trimmed = query.trimmingCharacters(in: .whitespacesAndNewlines)
guard !trimmed.isEmpty else { return true }
return displayName.localizedCaseInsensitiveContains(trimmed)
}
}