mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Open chats - only match leftovers
This commit is contained in:
parent
751d13a35e
commit
7a6184aef7
1 changed files with 13 additions and 8 deletions
|
|
@ -335,14 +335,19 @@ class DefaultIntentHandler: INExtension, INSendMessageIntentHandling, INSearchFo
|
|||
|> castError(IntentContactsError.self)
|
||||
|> mapToSignal { account -> Signal<[(String, TelegramUser)], IntentContactsError> in
|
||||
if let account = account {
|
||||
return combineLatest(
|
||||
matchingCloudContacts(postbox: account.postbox, contacts: matchedContacts),
|
||||
matchingOpenChatWithDeviceContacts(postbox: account.postbox, contacts: matchedContacts)
|
||||
)
|
||||
|> map { cloudContacts, openChatContacts in
|
||||
var result = cloudContacts
|
||||
result.append(contentsOf: openChatContacts)
|
||||
return result
|
||||
return matchingCloudContacts(postbox: account.postbox, contacts: matchedContacts)
|
||||
|> mapToSignal { cloudContacts -> Signal<[(String, TelegramUser)], NoError> in
|
||||
let matchedStableIds = Set(cloudContacts.map { $0.0 })
|
||||
let unmatchedContacts = matchedContacts.filter { !matchedStableIds.contains($0.stableId) }
|
||||
if unmatchedContacts.isEmpty {
|
||||
return .single(cloudContacts)
|
||||
}
|
||||
return matchingOpenChatWithDeviceContacts(postbox: account.postbox, contacts: unmatchedContacts)
|
||||
|> map { openChatContacts -> [(String, TelegramUser)] in
|
||||
var result = cloudContacts
|
||||
result.append(contentsOf: openChatContacts)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|> castError(IntentContactsError.self)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue