work around race condition after opening easy invite dialog
This commit is contained in:
parent
e38aa30a84
commit
d1490673bb
|
@ -2,6 +2,8 @@ package eu.siacs.conversations.services;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -615,6 +617,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
|
@ -48,6 +48,7 @@ import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.common.collect.Collections2;
|
import com.google.common.collect.Collections2;
|
||||||
|
|
||||||
|
@ -371,7 +372,10 @@ public class ConversationsOverviewFragment extends XmppFragment {
|
||||||
|
|
||||||
private void selectAccountToStartEasyInvite() {
|
private void selectAccountToStartEasyInvite() {
|
||||||
final List<Account> accounts = EasyOnboardingInvite.getSupportingAccounts(activity.xmppConnectionService);
|
final List<Account> accounts = EasyOnboardingInvite.getSupportingAccounts(activity.xmppConnectionService);
|
||||||
if (accounts.size() == 1) {
|
if (accounts.size() == 0) {
|
||||||
|
//This can technically happen if opening the menu item races with accounts reconnecting or something
|
||||||
|
Toast.makeText(getActivity(),R.string.no_active_accounts_support_this, Toast.LENGTH_LONG).show();
|
||||||
|
} else if (accounts.size() == 1) {
|
||||||
openEasyInviteScreen(accounts.get(0));
|
openEasyInviteScreen(accounts.get(0));
|
||||||
} else {
|
} else {
|
||||||
final AtomicReference<Account> selectedAccount = new AtomicReference<>(accounts.get(0));
|
final AtomicReference<Account> selectedAccount = new AtomicReference<>(accounts.get(0));
|
||||||
|
|
|
@ -953,4 +953,5 @@
|
||||||
<string name="invite_to_app">Invite to Conversations</string>
|
<string name="invite_to_app">Invite to Conversations</string>
|
||||||
<string name="unable_to_parse_invite">Unable to parse invite</string>
|
<string name="unable_to_parse_invite">Unable to parse invite</string>
|
||||||
<string name="server_does_not_support_easy_onboarding_invites">Server does not support generating invites</string>
|
<string name="server_does_not_support_easy_onboarding_invites">Server does not support generating invites</string>
|
||||||
|
<string name="no_active_accounts_support_this">No active accounts support this feature</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue