diff --git a/src/conversations/AndroidManifest.xml b/src/conversations/AndroidManifest.xml
index 2c01f6d6c..0a01c6c0f 100644
--- a/src/conversations/AndroidManifest.xml
+++ b/src/conversations/AndroidManifest.xml
@@ -12,9 +12,13 @@
android:name=".ui.WelcomeActivity"
android:label="@string/app_name"
android:launchMode="singleTask"/>
+ {
+ final Intent intent = new Intent(this, MagicCreateActivity.class);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
+ addInviteUri(intent);
+ startActivity(intent);
+ });
+ binding.useOwnProvider.setOnClickListener(v -> {
+ List accounts = xmppConnectionService.getAccounts();
+ Intent intent = new Intent(this, EditAccountActivity.class);
+ intent.putExtra(EditAccountActivity.EXTRA_FORCE_REGISTER, true);
+ if (accounts.size() == 1) {
+ intent.putExtra("jid", accounts.get(0).getJid().asBareJid().toString());
+ intent.putExtra("init", true);
+ } else if (accounts.size() >= 1) {
+ intent = new Intent(this, ManageAccountActivity.class);
+ }
+ addInviteUri(intent);
+ startActivity(intent);
+ });
+
+ }
+
+ public void addInviteUri(Intent intent) {
+ StartConversationActivity.addInviteUri(intent, getIntent());
+ }
+
+ public static void launch(AppCompatActivity activity) {
+ Intent intent = new Intent(activity, PickServerActivity.class);
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+ activity.startActivity(intent);
+ activity.overridePendingTransition(0, 0);
+ }
+
+}
diff --git a/src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java b/src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java
index eb466e37a..02613f368 100644
--- a/src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java
+++ b/src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java
@@ -2,18 +2,19 @@ package eu.siacs.conversations.ui;
import android.content.Intent;
import android.content.pm.ActivityInfo;
+import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.NonNull;
-import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
-import android.widget.Button;
import android.widget.Toast;
import java.util.List;
import eu.siacs.conversations.R;
+import eu.siacs.conversations.databinding.ActivityWelcomeBinding;
import eu.siacs.conversations.entities.Account;
import static eu.siacs.conversations.utils.PermissionUtils.allGranted;
@@ -55,24 +56,18 @@ public class WelcomeActivity extends XmppActivity {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
super.onCreate(savedInstanceState);
- setContentView(R.layout.welcome);
- setSupportActionBar(findViewById(R.id.toolbar));
- final ActionBar ab = getSupportActionBar();
- if (ab != null) {
- ab.setDisplayShowHomeEnabled(false);
- ab.setDisplayHomeAsUpEnabled(false);
- }
- final Button createAccount = findViewById(R.id.create_account);
- createAccount.setOnClickListener(v -> {
- final Intent intent = new Intent(WelcomeActivity.this, MagicCreateActivity.class);
- intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
+ ActivityWelcomeBinding binding = DataBindingUtil.setContentView(this,R.layout.activity_welcome);
+ setSupportActionBar((Toolbar) binding.toolbar);
+ configureActionBar(getSupportActionBar(), false);
+ binding.registerNewAccount.setOnClickListener(v -> {
+ final Intent intent = new Intent(this, PickServerActivity.class);
addInviteUri(intent);
startActivity(intent);
});
- final Button useOwnProvider = findViewById(R.id.use_own_provider);
- useOwnProvider.setOnClickListener(v -> {
+ binding.useExisting.setOnClickListener(v -> {
List accounts = xmppConnectionService.getAccounts();
Intent intent = new Intent(WelcomeActivity.this, EditAccountActivity.class);
+ intent.putExtra(EditAccountActivity.EXTRA_FORCE_REGISTER,false);
if (accounts.size() == 1) {
intent.putExtra("jid", accounts.get(0).getJid().asBareJid().toString());
intent.putExtra("init", true);
diff --git a/src/conversations/java/eu/siacs/conversations/utils/SignupUtils.java b/src/conversations/java/eu/siacs/conversations/utils/SignupUtils.java
index ee5433cf4..6e8ed2eff 100644
--- a/src/conversations/java/eu/siacs/conversations/utils/SignupUtils.java
+++ b/src/conversations/java/eu/siacs/conversations/utils/SignupUtils.java
@@ -9,13 +9,23 @@ import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.ui.ConversationsActivity;
import eu.siacs.conversations.ui.EditAccountActivity;
import eu.siacs.conversations.ui.ManageAccountActivity;
+import eu.siacs.conversations.ui.PickServerActivity;
import eu.siacs.conversations.ui.StartConversationActivity;
import eu.siacs.conversations.ui.WelcomeActivity;
public class SignupUtils {
public static Intent getSignUpIntent(final Activity activity) {
- Intent intent = new Intent(activity, WelcomeActivity.class);
+ return getSignUpIntent(activity, false);
+ }
+
+ public static Intent getSignUpIntent(final Activity activity, final boolean toServerChooser) {
+ Intent intent;
+ if (toServerChooser) {
+ intent = new Intent(activity, PickServerActivity.class);
+ } else {
+ intent = new Intent(activity, WelcomeActivity.class);
+ }
StartConversationActivity.addInviteUri(intent, activity.getIntent());
return intent;
}
@@ -27,6 +37,9 @@ public class SignupUtils {
if (pendingAccount != null) {
intent = new Intent(activity, EditAccountActivity.class);
intent.putExtra("jid", pendingAccount.getJid().asBareJid().toString());
+ if (!pendingAccount.isOptionSet(Account.OPTION_MAGIC_CREATE)) {
+ intent.putExtra(EditAccountActivity.EXTRA_FORCE_REGISTER, pendingAccount.isOptionSet(Account.OPTION_REGISTER));
+ }
} else {
if (service.getAccounts().size() == 0) {
if (Config.X509_VERIFICATION) {
diff --git a/src/conversations/res/layout/activity_pick_server.xml b/src/conversations/res/layout/activity_pick_server.xml
new file mode 100644
index 000000000..16be52ec4
--- /dev/null
+++ b/src/conversations/res/layout/activity_pick_server.xml
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/conversations/res/layout/activity_welcome.xml b/src/conversations/res/layout/activity_welcome.xml
new file mode 100644
index 000000000..f3035d502
--- /dev/null
+++ b/src/conversations/res/layout/activity_welcome.xml
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/conversations/res/layout/welcome.xml b/src/conversations/res/layout/welcome.xml
deleted file mode 100644
index 1c23119f7..000000000
--- a/src/conversations/res/layout/welcome.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/conversations/res/values/strings.xml b/src/conversations/res/values/strings.xml
new file mode 100644
index 000000000..e5023eda2
--- /dev/null
+++ b/src/conversations/res/values/strings.xml
@@ -0,0 +1,9 @@
+
+
+ Pick your XMPP provider
+ Use conversations.im
+ Create new account
+ Do you already have an XMPP account? This might be the case if you are already using a different XMPP client or have used Conversations before. If not you can create a new XMPP account right now.\nHint: Some email providers also provide XMPP accounts.
+ XMPP is a provider independent instant messaging network. You can use this client with what ever XMPP server you choose.\nHowever for your convenience we made it easy to create an account on conversations.im¹; a provider specially suited for the use with Conversations.
+
+
\ No newline at end of file
diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
index 5be8525f6..7c7f3b847 100644
--- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
@@ -83,6 +83,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
OnKeyStatusUpdated, OnCaptchaRequested, KeyChainAliasCallback, XmppConnectionService.OnShowErrorToast, XmppConnectionService.OnMamPreferencesFetched {
public static final String EXTRA_OPENED_FROM_NOTIFICATION = "opened_from_notification";
+ public static final String EXTRA_FORCE_REGISTER = "force_register";
private static final int REQUEST_DATA_SAVER = 0xf244;
private static final int REQUEST_CHANGE_STATUS = 0xee11;
@@ -92,6 +93,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
private AlertDialog mCaptchaDialog = null;
private Jid jidToEdit;
private boolean mInitMode = false;
+ private Boolean mForceRegister = null;
private boolean mUsernameMode = Config.DOMAIN_LOCK != null;
private boolean mShowOptions = false;
private Account mAccount;
@@ -152,7 +154,12 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
return;
}
- final boolean registerNewAccount = binding.accountRegisterNew.isChecked() && !Config.DISALLOW_REGISTRATION_IN_UI;
+ final boolean registerNewAccount;
+ if (mForceRegister != null) {
+ registerNewAccount = mForceRegister;
+ } else {
+ registerNewAccount = binding.accountRegisterNew.isChecked() && !Config.DISALLOW_REGISTRATION_IN_UI;
+ }
if (mUsernameMode && binding.accountJid.getText().toString().contains("@")) {
binding.accountJidLayout.setError(getString(R.string.invalid_username));
removeErrorsOnAllBut(binding.accountJidLayout);
@@ -395,7 +402,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
if (xmppConnectionService.getAccounts().size() == 0 && Config.MAGIC_CREATE_DOMAIN != null) {
- Intent intent = SignupUtils.getSignUpIntent(this);
+ Intent intent = SignupUtils.getSignUpIntent(this, mForceRegister != null && mForceRegister);
startActivity(intent);
}
}
@@ -676,6 +683,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
boolean init = intent.getBooleanExtra("init", false);
boolean openedFromNotification = intent.getBooleanExtra(EXTRA_OPENED_FROM_NOTIFICATION, false);
+ Log.d(Config.LOGTAG,"extras "+intent.getExtras());
+ this.mForceRegister = intent.hasExtra(EXTRA_FORCE_REGISTER) ? intent.getBooleanExtra(EXTRA_FORCE_REGISTER,false) : null;
+ Log.d(Config.LOGTAG,"force register="+mForceRegister);
this.mInitMode = init || this.jidToEdit == null;
this.messageFingerprint = intent.getStringExtra("fingerprint");
if (!mInitMode) {
@@ -685,13 +695,24 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
} else {
this.binding.avater.setVisibility(View.GONE);
configureActionBar(getSupportActionBar(), !(init && Config.MAGIC_CREATE_DOMAIN == null));
- setTitle(R.string.action_add_account);
+ if (mForceRegister != null) {
+ if (mForceRegister) {
+ setTitle(R.string.register_new_account);
+ } else {
+ setTitle(R.string.add_existing_account);
+ }
+ } else {
+ setTitle(R.string.action_add_account);
+ }
}
}
SharedPreferences preferences = getPreferences();
mUseTor = QuickConversationsService.isConversations() && preferences.getBoolean("use_tor", getResources().getBoolean(R.bool.use_tor));
this.mShowOptions = mUseTor || (QuickConversationsService.isConversations() && preferences.getBoolean("show_connection_options", getResources().getBoolean(R.bool.show_connection_options)));
this.binding.namePort.setVisibility(mShowOptions ? View.VISIBLE : View.GONE);
+ if (mForceRegister != null) {
+ this.binding.accountRegisterNew.setVisibility(View.GONE);
+ }
}
@Override
@@ -967,7 +988,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
}
this.binding.accountRegisterNew.setVisibility(View.GONE);
- } else if (this.mAccount.isOptionSet(Account.OPTION_REGISTER)) {
+ } else if (this.mAccount.isOptionSet(Account.OPTION_REGISTER) && mForceRegister == null) {
this.binding.accountRegisterNew.setVisibility(View.VISIBLE);
} else {
this.binding.accountRegisterNew.setVisibility(View.GONE);
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index ee81f1a44..355b2801e 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -527,7 +527,6 @@
No application found to share URIShare URI with…Join the Conversation
- XMPP is a provider independent instant messaging network. You can use this client with what ever XMPP server you choose.\nHowever for your convenience we made it easy to create an account on conversations.im¹; a provider specially suited for the use with Conversations.Have some Quick Conversations You sign up with your phone number and Quicksy will automatically—based on the phone numbers in your address book—suggest possible contacts to you.
By signing up you agree to our privacy policy.]]>Agree & continue
@@ -861,4 +860,7 @@
Search channelsPossible privacy violation!search.jabbercat.org.
Using this feature will transmit your IP address and search terms to that service. See their Privacy Policy for more information.]]>
+ I already have an account
+ Add existing account
+ Register new account
diff --git a/src/quicksy/java/eu/siacs/conversations/utils/SignupUtils.java b/src/quicksy/java/eu/siacs/conversations/utils/SignupUtils.java
index 72f82bb38..a147adac3 100644
--- a/src/quicksy/java/eu/siacs/conversations/utils/SignupUtils.java
+++ b/src/quicksy/java/eu/siacs/conversations/utils/SignupUtils.java
@@ -16,9 +16,12 @@ import eu.siacs.conversations.ui.VerifyActivity;
public class SignupUtils {
+ public static Intent getSignUpIntent(Activity activity, boolean ignored) {
+ return getSignUpIntent(activity);
+ }
+
public static Intent getSignUpIntent(Activity activity) {
- final Intent intent = new Intent(activity, EnterPhoneNumberActivity.class);
- return intent;
+ return new Intent(activity, EnterPhoneNumberActivity.class);
}
public static Intent getRedirectionIntent(ConversationsActivity activity) {