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

Commit 5c23a8ac authored by Moez Bhatti's avatar Moez Bhatti
Browse files

Improve randomness of contact colours

parent ea2edbb8
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]
    }
}