diff options
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
3 files changed, 22 insertions, 18 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/PublishProfilePictureActivity.java b/src/main/java/de/pixart/messenger/ui/PublishProfilePictureActivity.java index 960e19ac7..725a74762 100644 --- a/src/main/java/de/pixart/messenger/ui/PublishProfilePictureActivity.java +++ b/src/main/java/de/pixart/messenger/ui/PublishProfilePictureActivity.java @@ -4,7 +4,6 @@ import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; -import androidx.annotation.StringRes; import android.util.Log; import android.view.View; import android.view.View.OnLongClickListener; @@ -13,6 +12,8 @@ import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; +import androidx.annotation.StringRes; + import com.theartofdev.edmodo.cropper.CropImage; import java.util.concurrent.atomic.AtomicBoolean; @@ -95,11 +96,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(); diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java index cabdfc8fa..eb09fe859 100644 --- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java @@ -830,7 +830,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) { @@ -1232,7 +1233,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); } } @@ -1240,17 +1242,13 @@ 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); } diff --git a/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java b/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java index bb34e7958..9d30cdeb6 100644 --- a/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java +++ b/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java @@ -7,7 +7,6 @@ import android.content.pm.PackageManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.util.Log; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; @@ -17,7 +16,6 @@ import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; -import de.pixart.messenger.Config; import de.pixart.messenger.R; import de.pixart.messenger.persistance.DatabaseBackend; import de.pixart.messenger.utils.SignupUtils; @@ -88,16 +86,23 @@ public class UriHandlerActivity extends AppCompatActivity { final Intent intent; 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 (jid.isDomainJid()) { + if (xmppUri.isAction(XmppUri.ACTION_REGISTER)) { + if (jid.isDomainJid()) { + intent = SignupUtils.getTokenRegistrationIntent(this, jid.getDomain(), preauth); + startActivity(intent); + return; + } + 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; } - Log.d(Config.LOGTAG, "attempting to register on " + jid + " with preauth=" + preauth); - return; } if (accounts.size() == 0) { if (xmppUri.isJidValid()) { |