mirror of
https://codeberg.org/monocles/monocles_chat.git
synced 2025-01-28 16:04:10 +01:00
Use known gateways when tel uri clicked
(cherry picked from commit c962d36d1777b299184a1f0529b9d846fb5e8055)
This commit is contained in:
parent
0c46aaac41
commit
acb1dda2b0
1 changed files with 7 additions and 9 deletions
|
@ -96,6 +96,7 @@ import java.util.Set;
|
|||
import java.util.TreeMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import eu.siacs.conversations.Config;
|
||||
import eu.siacs.conversations.R;
|
||||
|
@ -1080,15 +1081,12 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
|
|||
return false;
|
||||
}
|
||||
|
||||
Set<String> gateways = new HashSet<>();
|
||||
for (Account account : (acct == null ? xmppConnectionService.getAccounts() : List.of(acct))) {
|
||||
for (Contact contact : account.getRoster().getContacts()) {
|
||||
if (contact.getPresences().anyIdentity("gateway", "pstn") || contact.getPresences().anyIdentity("gateway", "sms")) {
|
||||
if (acct == null) acct = account;
|
||||
gateways.add(contact.getJid().asBareJid().toEscapedString());
|
||||
}
|
||||
}
|
||||
}
|
||||
Set<String> gateways = (acct == null ? xmppConnectionService.getAccounts().stream() : List.of(acct).stream()).flatMap(account ->
|
||||
Stream.concat(
|
||||
account.getGateways("pstn").stream(),
|
||||
account.getGateways("sms").stream()
|
||||
)
|
||||
).map(a -> a.getJid().asBareJid().toString()).collect(Collectors.toSet());
|
||||
|
||||
for (String gateway : gateways) {
|
||||
if (onXmppUriClicked(Uri.parse("xmpp:" + tel + "@" + gateway))) return true;
|
||||
|
|
Loading…
Add table
Reference in a new issue