work around race condition after opening easy invite dialog

This commit is contained in:
Daniel Gultsch 2020-12-11 11:29:23 +01:00
parent e38aa30a84
commit d1490673bb
3 changed files with 9 additions and 1 deletions

View File

@ -2,6 +2,8 @@ package eu.siacs.conversations.services;
import android.util.Log;
import org.jetbrains.annotations.NotNull;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashSet;
@ -615,6 +617,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
}
}
@NotNull
@Override
public String toString() {
StringBuilder builder = new StringBuilder();

View File

@ -48,6 +48,7 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.google.common.collect.Collections2;
@ -371,7 +372,10 @@ public class ConversationsOverviewFragment extends XmppFragment {
private void selectAccountToStartEasyInvite() {
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));
} else {
final AtomicReference<Account> selectedAccount = new AtomicReference<>(accounts.get(0));

View File

@ -953,4 +953,5 @@
<string name="invite_to_app">Invite to Conversations</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="no_active_accounts_support_this">No active accounts support this feature</string>
</resources>