support ?roster;ibr=y xmpp uris
This commit is contained in:
parent
d039c4870f
commit
6205574bcb
|
@ -20,10 +20,10 @@ public class SignupUtils {
|
|||
return true;
|
||||
}
|
||||
|
||||
public static Intent getTokenRegistrationIntent(final Activity activity, String domain, String preauth) {
|
||||
public static Intent getTokenRegistrationIntent(final Activity activity, String domain, String preAuth) {
|
||||
final Intent intent = new Intent(activity, MagicCreateActivity.class);
|
||||
intent.putExtra(MagicCreateActivity.EXTRA_DOMAIN, domain);
|
||||
intent.putExtra(MagicCreateActivity.EXTRA_PRE_AUTH, preauth);
|
||||
intent.putExtra(MagicCreateActivity.EXTRA_PRE_AUTH, preAuth);
|
||||
return intent;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,11 +95,11 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC
|
|||
});
|
||||
this.cancelButton.setOnClickListener(v -> {
|
||||
if (mInitialAccountSetup) {
|
||||
Intent intent = new Intent(getApplicationContext(), StartConversationActivity.class);
|
||||
final Intent intent = new Intent(getApplicationContext(), StartConversationActivity.class);
|
||||
if (xmppConnectionService != null && xmppConnectionService.getAccounts().size() == 1) {
|
||||
StartConversationActivity.addInviteUri(intent, getIntent());
|
||||
intent.putExtra("init", true);
|
||||
}
|
||||
StartConversationActivity.addInviteUri(intent, getIntent());
|
||||
startActivity(intent);
|
||||
}
|
||||
finish();
|
||||
|
|
|
@ -857,7 +857,8 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
|||
showJoinConferenceDialog(invite.getJid().asBareJid().toString());
|
||||
return false;
|
||||
}
|
||||
} else if (contacts.size() == 0) {
|
||||
} else if (contacts.size() == 0) { //TODO or init mode
|
||||
//TODO if init mode; prefill dialog with account jid
|
||||
showCreateContactDialog(invite.getJid().toString(), invite);
|
||||
return false;
|
||||
} else if (contacts.size() == 1) {
|
||||
|
@ -1279,7 +1280,8 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
|||
|
||||
public static void addInviteUri(Intent to, Intent from) {
|
||||
if (from != null && from.hasExtra(EXTRA_INVITE_URI)) {
|
||||
to.putExtra(EXTRA_INVITE_URI, from.getStringExtra(EXTRA_INVITE_URI));
|
||||
final String invite = from.getStringExtra(EXTRA_INVITE_URI);
|
||||
to.putExtra(EXTRA_INVITE_URI, invite);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1287,17 +1289,14 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
|||
|
||||
public String account;
|
||||
|
||||
public boolean forceDialog = false;
|
||||
boolean forceDialog = false;
|
||||
|
||||
public Invite(final Uri uri) {
|
||||
|
||||
Invite(final String uri) {
|
||||
super(uri);
|
||||
}
|
||||
|
||||
public Invite(final String uri) {
|
||||
super(uri);
|
||||
}
|
||||
|
||||
public Invite(Uri uri, boolean safeSource) {
|
||||
Invite(Uri uri, boolean safeSource) {
|
||||
super(uri, safeSource);
|
||||
}
|
||||
|
||||
|
|
|
@ -89,17 +89,24 @@ public class UriHandlerActivity extends AppCompatActivity {
|
|||
final XmppUri xmppUri = new XmppUri(uri);
|
||||
final List<Jid> accounts = DatabaseBackend.getInstance(this).getAccountJids(true);
|
||||
|
||||
if (SignupUtils.isSupportTokenRegistry() && xmppUri.isJidValid() && xmppUri.isAction(XmppUri.ACTION_REGISTER)) {
|
||||
if (SignupUtils.isSupportTokenRegistry() && xmppUri.isJidValid()) {
|
||||
final String preauth = xmppUri.getParamater("preauth");
|
||||
final Jid jid = xmppUri.getJid();
|
||||
if (xmppUri.isAction(XmppUri.ACTION_REGISTER)) {
|
||||
if (jid.isDomainJid()) {
|
||||
intent = SignupUtils.getTokenRegistrationIntent(this, jid.getDomain(), preauth);
|
||||
startActivity(intent);
|
||||
return;
|
||||
}
|
||||
Log.d(Config.LOGTAG,"attempting to register on "+jid+" with preauth="+preauth);
|
||||
return;
|
||||
}
|
||||
if (xmppUri.isAction(XmppUri.ACTION_ROSTER) && "y".equals(xmppUri.getParamater("ibr"))) {
|
||||
intent = SignupUtils.getTokenRegistrationIntent(this, jid.getDomain(), preauth);
|
||||
intent.putExtra(StartConversationActivity.EXTRA_INVITE_URI, xmppUri.toString());
|
||||
startActivity(intent);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (accounts.size() == 0) {
|
||||
if (xmppUri.isJidValid()) {
|
||||
|
|
|
@ -29,6 +29,7 @@ public class XmppUri {
|
|||
public static final String ACTION_JOIN = "join";
|
||||
public static final String ACTION_MESSAGE = "message";
|
||||
public static final String ACTION_REGISTER = "register";
|
||||
public static final String ACTION_ROSTER = "roster";
|
||||
|
||||
public XmppUri(String uri) {
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue