mirror of
https://github.com/FossifyOrg/Phone.git
synced 2025-12-24 00:17:45 -05:00
fix: don't limit search to 32bit ints (#592)
* fix: don't limit search to 32bit ints This is a quick fix. Will do a proper rewrite later. Refs: https://github.com/FossifyOrg/General-Discussion/issues/718 * docs: update changelog
This commit is contained in:
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
## [Unreleased]
|
||||
### Fixed
|
||||
- Fixed wrong contact photo in call history for some contacts ([#585])
|
||||
- Fixed search not matching full phone numbers
|
||||
|
||||
## [1.7.1] - 2025-09-12
|
||||
### Changed
|
||||
|
||||
@@ -162,7 +162,7 @@ class ContactsFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
|
||||
val filtered = allContacts.filter { contact ->
|
||||
getProperText(contact.getNameToDisplay(), shouldNormalize).contains(fixedText, true) ||
|
||||
getProperText(contact.nickname, shouldNormalize).contains(fixedText, true) ||
|
||||
(fixedText.toIntOrNull() != null && contact.doesContainPhoneNumber(fixedText, true)) ||
|
||||
(fixedText.toLongOrNull() != null && contact.doesContainPhoneNumber(fixedText, true)) ||
|
||||
contact.emails.any { it.value.contains(fixedText, true) } ||
|
||||
contact.addresses.any { getProperText(it.value, shouldNormalize).contains(fixedText, true) } ||
|
||||
contact.IMs.any { it.value.contains(fixedText, true) } ||
|
||||
|
||||
@@ -199,7 +199,7 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
|
||||
override fun onSearchQueryChanged(text: String) {
|
||||
val fixedText = text.trim().replace("\\s+".toRegex(), " ")
|
||||
val contacts = allContacts.filter {
|
||||
it.name.contains(fixedText, true) || (text.toIntOrNull() != null && it.doesContainPhoneNumber(fixedText))
|
||||
it.name.contains(fixedText, true) || (text.toLongOrNull() != null && it.doesContainPhoneNumber(fixedText))
|
||||
}.sortedByDescending {
|
||||
it.name.startsWith(fixedText, true)
|
||||
}.toMutableList() as ArrayList<Contact>
|
||||
|
||||
@@ -27,12 +27,12 @@ data class RecentCall(
|
||||
val dayCode = startTS.getDayCode()
|
||||
|
||||
fun doesContainPhoneNumber(text: String): Boolean {
|
||||
return if (text.toIntOrNull() != null) {
|
||||
return if (text.toLongOrNull() != null) {
|
||||
val normalizedText = text.normalizePhoneNumber()
|
||||
PhoneNumberUtils.compare(phoneNumber.normalizePhoneNumber(), normalizedText) ||
|
||||
phoneNumber.contains(text) ||
|
||||
phoneNumber.normalizePhoneNumber().contains(normalizedText) ||
|
||||
phoneNumber.contains(normalizedText)
|
||||
phoneNumber.contains(text) ||
|
||||
phoneNumber.normalizePhoneNumber().contains(normalizedText) ||
|
||||
phoneNumber.contains(normalizedText)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user