make presence selector work with empty resources (bare jid)

This commit is contained in:
Daniel Gultsch 2020-06-13 09:59:39 +02:00
parent 0dba9f560c
commit fda9e7b51c
2 changed files with 902 additions and 897 deletions

File diff suppressed because it is too large Load Diff

View File

@ -106,12 +106,21 @@ public class PresenceSelector {
builder.setPositiveButton(
R.string.ok,
(dialog, which) -> onFullJidSelected.onFullJidSelected(
Jid.of(contact.getJid().getLocal(), contact.getJid().getDomain(), resourceArray[selectedResource.get()])
getNextCounterpart(contact, resourceArray[selectedResource.get()])
)
);
builder.create().show();
}
public static Jid getNextCounterpart(final Contact contact, final String resource) {
if (resource.isEmpty()) {
return contact.getJid().asBareJid();
} else {
return contact.getJid().withResource(resource);
}
}
public static void warnMutualPresenceSubscription(Activity activity, final Conversation conversation, final OnPresenceSelected listener) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(conversation.getContact().getJid().toString());