diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2020-12-11 13:29:23 +0300 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2020-12-11 13:29:23 +0300 |
commit | d1490673bb64efc45aea932280152602a11a38cc (patch) | |
tree | aa444e5fb6a2386bc9b8fd7ef280d58762bb3e90 /src/main | |
parent | e38aa30a847cd100084e28749c98a6e1df76e490 (diff) |
work around race condition after opening easy invite dialog
Diffstat (limited to 'src/main')
3 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java index 89ddec12b..47d4a240b 100644 --- a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java +++ b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java @@ -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(); diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java index ae81874e1..3c3c53f63 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java @@ -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)); diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index a9670533f..5aba03dfd 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -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> |