catch conversations.im invite urls directly in fragment

This commit is contained in:
Daniel Gultsch 2018-09-18 17:15:52 +02:00
parent 53cd58c955
commit 5be64de7be
3 changed files with 6 additions and 3 deletions

View file

@ -3441,7 +3441,7 @@ public class XmppConnectionService extends Service {
public Conversation findUniqueConversationByJid(XmppUri xmppUri) {
List<Conversation> findings = new ArrayList<>();
for (Conversation c : getConversations()) {
if (c.getJid().asBareJid().equals(xmppUri.getJid()) && ((c.getMode() == Conversational.MODE_MULTI) == xmppUri.isAction(XmppUri.ACTION_JOIN))) {
if (c.getAccount().isEnabled() && c.getJid().asBareJid().equals(xmppUri.getJid()) && ((c.getMode() == Conversational.MODE_MULTI) == xmppUri.isAction(XmppUri.ACTION_JOIN))) {
findings.add(c);
}
}

View file

@ -167,7 +167,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
@Override
protected String getShareableUri(boolean http) {
if (http) {
return "https://conversations.im/j/" + XmppUri.lameUrlEncode(contact.getJid().asBareJid().toEscapedString());
return "https://conversations.im/i/" + XmppUri.lameUrlEncode(contact.getJid().asBareJid().toEscapedString());
} else {
return "xmpp:" + contact.getJid().asBareJid().toEscapedString();
}

View file

@ -42,6 +42,8 @@ import android.util.Log;
import android.view.View;
import android.widget.Toast;
import java.util.Arrays;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.ui.ConversationsActivity;
@ -68,7 +70,8 @@ public class FixedURLSpan extends URLSpan {
public void onClick(View widget) {
final Uri uri = Uri.parse(getURL());
final Context context = widget.getContext();
if (uri.getScheme().equals("xmpp") && context instanceof ConversationsActivity) {
final boolean candidateToProcessDirecty = "xmpp".equals(uri.getScheme()) || ("https".equals(uri.getScheme()) && "conversations.im".equals(uri.getHost()) && uri.getPathSegments().size() > 1 && Arrays.asList("j","i").contains(uri.getPathSegments().get(0)));
if (candidateToProcessDirecty && context instanceof ConversationsActivity) {
if (((ConversationsActivity) context).onXmppUriClicked(uri)) {
widget.playSoundEffect(0);
return;