[Messages/Compose] Fix when adding duplicated recipient.

This commit is contained in:
Kuba Szczodrzyński 2020-01-02 20:02:48 +01:00
parent 1553173300
commit 52ef24ae7b
2 changed files with 4 additions and 1 deletions

View File

@ -275,8 +275,10 @@ class MessagesComposeFragment : Fragment(), CoroutineScope {
return null return null
} }
b.recipients.allChips.forEach { b.recipients.allChips.forEach {
if (it.data == data) if (it.data == data) {
Toast.makeText(activity, R.string.messages_compose_recipient_exists, Toast.LENGTH_SHORT).show()
return null return null
}
} }
val chipSpan = ChipSpan(context, data.fullName, BitmapDrawable(context.resources, data.image), data) val chipSpan = ChipSpan(context, data.fullName, BitmapDrawable(context.resources, data.image), data)
chipSpan.setIconBackgroundColor(Colors.stringToMaterialColor(data.fullName)) chipSpan.setIconBackgroundColor(Colors.stringToMaterialColor(data.fullName))

View File

@ -1146,4 +1146,5 @@
<string name="compose">Napisz</string> <string name="compose">Napisz</string>
<string name="messages_reply">Odpowiedz</string> <string name="messages_reply">Odpowiedz</string>
<string name="error_unknown_format">Kod błędu: %d (w %s)</string> <string name="error_unknown_format">Kod błędu: %d (w %s)</string>
<string name="messages_compose_recipient_exists">Ten odbiorca został już wybrany</string>
</resources> </resources>