mirror of
https://github.com/moparisthebest/Conversations
synced 2024-12-26 01:09:13 -05:00
handle app links
invites in the form of https://conversations/i/localpart/domainpart
This commit is contained in:
parent
9afafe387a
commit
49cefd1c0c
@ -76,6 +76,15 @@
|
|||||||
|
|
||||||
<data android:scheme="xmpp"/>
|
<data android:scheme="xmpp"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<intent-filter android:autoVerify="true">
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="https" />
|
||||||
|
<data android:host="conversations.im" />
|
||||||
|
<data android:pathPrefix="/i/"/>
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.WelcomeActivity"
|
android:name=".ui.WelcomeActivity"
|
||||||
|
@ -4,6 +4,7 @@ import android.net.Uri;
|
|||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
|
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
|
||||||
import eu.siacs.conversations.xmpp.jid.Jid;
|
import eu.siacs.conversations.xmpp.jid.Jid;
|
||||||
@ -32,8 +33,13 @@ public class XmppUri {
|
|||||||
|
|
||||||
protected void parse(Uri uri) {
|
protected void parse(Uri uri) {
|
||||||
String scheme = uri.getScheme();
|
String scheme = uri.getScheme();
|
||||||
if ("xmpp".equalsIgnoreCase(scheme)) {
|
String host = uri.getHost();
|
||||||
// sample: xmpp:jid@foo.com
|
List<String> segments = uri.getPathSegments();
|
||||||
|
if ("https".equalsIgnoreCase(scheme) && "conversations.im".equalsIgnoreCase(host) && segments.size() >= 3) {
|
||||||
|
// sample : https://conversations.im/i/foo/bar.com
|
||||||
|
jid = segments.get(1)+"@"+segments.get(2);
|
||||||
|
} else if ("xmpp".equalsIgnoreCase(scheme)) {
|
||||||
|
// sample: xmpp:foo@bar.com
|
||||||
muc = "join".equalsIgnoreCase(uri.getQuery());
|
muc = "join".equalsIgnoreCase(uri.getQuery());
|
||||||
if (uri.getAuthority() != null) {
|
if (uri.getAuthority() != null) {
|
||||||
jid = uri.getAuthority();
|
jid = uri.getAuthority();
|
||||||
@ -42,7 +48,7 @@ public class XmppUri {
|
|||||||
}
|
}
|
||||||
fingerprint = parseFingerprint(uri.getQuery());
|
fingerprint = parseFingerprint(uri.getQuery());
|
||||||
} else if ("imto".equalsIgnoreCase(scheme)) {
|
} else if ("imto".equalsIgnoreCase(scheme)) {
|
||||||
// sample: imto://xmpp/jid@foo.com
|
// sample: imto://xmpp/foo@bar.com
|
||||||
try {
|
try {
|
||||||
jid = URLDecoder.decode(uri.getEncodedPath(), "UTF-8").split("/")[1];
|
jid = URLDecoder.decode(uri.getEncodedPath(), "UTF-8").split("/")[1];
|
||||||
} catch (final UnsupportedEncodingException ignored) {
|
} catch (final UnsupportedEncodingException ignored) {
|
||||||
|
Loading…
Reference in New Issue
Block a user