contact picker recents will not put most recent contact top

This commit is contained in:
2026-06-13 23:17:57 +05:00
parent 3182e14873
commit e997969070
@@ -984,17 +984,31 @@ class TransferFragment : Fragment() {
updateTransferButton() updateTransferButton()
val contact = contacts.firstOrNull { it.benefAccount == accountNumber } val contact = contacts.firstOrNull { it.benefAccount == accountNumber }
if (contact != null) { val recentImageHash: String?
val recentIsProfileImage: Boolean
when {
ownAccount != null -> {
recentImageHash = ownAccount.profileImageHash
recentIsProfileImage = true
}
contact != null -> {
recentImageHash = contact.customerImgHash ?: imageHash
recentIsProfileImage = false
}
else -> {
recentImageHash = imageHash
recentIsProfileImage = false
}
}
RecentsCache.save(requireContext(), RecentPick( RecentsCache.save(requireContext(), RecentPick(
accountNumber = contact.benefAccount, accountNumber = accountNumber,
displayName = contact.benefNickName, displayName = displayName,
subtitle = subtitle, subtitle = subtitle,
colorHex = colorHex, colorHex = colorHex,
imageHash = imageHash, imageHash = recentImageHash,
isProfileImage = false isProfileImage = recentIsProfileImage
)) ))
if (imageHash != null) loadToPhoto(imageHash, isProfile = false) if (contact != null && imageHash != null) loadToPhoto(imageHash, isProfile = false)
}
} }
private fun prefillToFromContact(accountNumber: String, label: String) { private fun prefillToFromContact(accountNumber: String, label: String) {