display toast when trying to join channel with no enabled accounts
This commit is contained in:
parent
3d0138506d
commit
ff18ea452d
|
@ -18,6 +18,7 @@ import android.view.View;
|
|||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -224,10 +225,12 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
|
|||
|
||||
@Override
|
||||
public void onChannelSearchResult(final Room result) {
|
||||
List<String> accounts = AccountUtils.getEnabledAccounts(xmppConnectionService);
|
||||
final List<String> accounts = AccountUtils.getEnabledAccounts(xmppConnectionService);
|
||||
if (accounts.size() == 1) {
|
||||
joinChannelSearchResult(accounts.get(0), result);
|
||||
} else if (accounts.size() > 0) {
|
||||
} else if (accounts.size() == 0) {
|
||||
Toast.makeText(this, R.string.please_enable_your_account_first, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
final AtomicReference<String> account = new AtomicReference<>(accounts.get(0));
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(R.string.choose_account);
|
||||
|
|
|
@ -420,7 +420,8 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
|||
}
|
||||
|
||||
|
||||
if (xmppConnectionService.getAccounts().size() == 0 && Config.MAGIC_CREATE_DOMAIN != null) {
|
||||
final List<Account> accounts = xmppConnectionService == null ? null : xmppConnectionService.getAccounts();
|
||||
if (accounts != null && accounts.size() == 0 && Config.MAGIC_CREATE_DOMAIN != null) {
|
||||
Intent intent = SignupUtils.getSignUpIntent(this, mForceRegister != null && mForceRegister);
|
||||
StartConversationActivity.addInviteUri(intent, getIntent());
|
||||
startActivity(intent);
|
||||
|
|
|
@ -883,6 +883,7 @@
|
|||
<string name="pref_channel_discovery">Channel discovery method</string>
|
||||
<string name="backup">Backup</string>
|
||||
<string name="category_about">About</string>
|
||||
<string name="please_enable_your_account_first">Please enable your account first</string>
|
||||
<plurals name="view_users">
|
||||
<item quantity="one">View %1$d Participant</item>
|
||||
<item quantity="other">View %1$d Participants</item>
|
||||
|
|
Loading…
Reference in a new issue