Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8720a666 authored by Moez Bhatti's avatar Moez Bhatti Committed by Dayona Joseph
Browse files

Improve randomness of contact colours

parent e45ce20e
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -134,11 +134,7 @@ class Colors @Inject constructor(
    }

    private fun generateColor(recipient: Recipient): Int {
        val first = recipient.contact?.name?.firstOrNull()
                ?: phoneNumberUtils.normalizeNumber(recipient.address).firstOrNull()
                ?: '#'

        val index = first.hashCode().absoluteValue % randomColors.size
        val index = recipient.address.hashCode().absoluteValue % randomColors.size
        return randomColors[index]
    }
}