File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
app/src/main/kotlin/ee/ria/DigiDoc/viewmodel Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ class EncryptRecipientViewModel
9292
9393 private fun filterRecipients () =
9494 queryText
95- .combine(_recipientList ) { text, recipients ->
95+ .combine(_recipientList ) { text, _ ->
9696 if (! text.isEmpty()) {
9797 var allRecipients: Pair <List <Addressee >, Int > = Pair (listOf (), 0 )
9898 try {
@@ -136,14 +136,16 @@ class EncryptRecipientViewModel
136136 ) {
137137 val cryptoContainer = sharedContainerViewModel.cryptoContainer.value
138138
139- if ( cryptoContainer?.getRecipients()?.contains(recipient) == true ) {
140- _errorState .postValue( R .string.crypto_recipients_error_exists)
141- handleIsRecipientAdded( false )
142- return
143- } else {
144- cryptoContainer?.addRecipients( listOf (recipient))
139+ cryptoContainer?.getRecipients()?.forEach {
140+ if (recipient.data.contentEquals(it.data)) {
141+ _errorState .postValue( R .string.crypto_recipients_error_exists )
142+ handleIsRecipientAdded( false )
143+ return
144+ }
145145 }
146146
147+ cryptoContainer?.addRecipients(listOf (recipient))
148+
147149 sharedContainerViewModel.setCryptoContainer(cryptoContainer)
148150 handleIsRecipientAdded(true )
149151 }
You can’t perform that action at this time.
0 commit comments