Show message while Adding a Already Invited member
This commit is contained in:
parent
35a6c1e5c9
commit
453795613e
2 changed files with 10 additions and 5 deletions
|
@ -8,6 +8,7 @@ import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
import org.signal.core.util.concurrent.SignalExecutors;
|
import org.signal.core.util.concurrent.SignalExecutors;
|
||||||
import org.thoughtcrime.securesms.R;
|
import org.thoughtcrime.securesms.R;
|
||||||
|
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||||
import org.thoughtcrime.securesms.dependencies.AppDependencies;
|
import org.thoughtcrime.securesms.dependencies.AppDependencies;
|
||||||
import org.thoughtcrime.securesms.groups.ui.GroupChangeFailureReason;
|
import org.thoughtcrime.securesms.groups.ui.GroupChangeFailureReason;
|
||||||
import org.thoughtcrime.securesms.groups.ui.GroupErrors;
|
import org.thoughtcrime.securesms.groups.ui.GroupErrors;
|
||||||
|
@ -43,12 +44,15 @@ public final class AddToGroupViewModel extends ViewModel {
|
||||||
events.postValue(new Event.CloseEvent());
|
events.postValue(new Event.CloseEvent());
|
||||||
} else if (groupRecipientIds.size() == 1) {
|
} else if (groupRecipientIds.size() == 1) {
|
||||||
SignalExecutors.BOUNDED.execute(() -> {
|
SignalExecutors.BOUNDED.execute(() -> {
|
||||||
Recipient recipient = Recipient.resolved(recipientId);
|
Recipient recipient = Recipient.resolved(recipientId);
|
||||||
Recipient groupRecipient = Recipient.resolved(groupRecipientIds.get(0));
|
Recipient groupRecipient = Recipient.resolved(groupRecipientIds.get(0));
|
||||||
String recipientName = recipient.getDisplayName(context);
|
String recipientName = recipient.getDisplayName(context);
|
||||||
String groupName = groupRecipient.getDisplayName(context);
|
String groupName = groupRecipient.getDisplayName(context);
|
||||||
|
boolean isAlreadyInvited = SignalDatabase.groups().getGroup(groupRecipientIds.get(0)).get().isPendingMember(recipient);
|
||||||
|
|
||||||
if (groupRecipient.getGroupId().get().isV1() && !recipient.getHasE164()) {
|
if(isAlreadyInvited) {
|
||||||
|
events.postValue(new Event.ToastEvent(context.getResources().getString(R.string.AddToGroupActivity_s_has_already_been_invited_to_s, recipientName, groupName)));
|
||||||
|
} else if (groupRecipient.getGroupId().get().isV1() && !recipient.getHasE164()) {
|
||||||
events.postValue(new Event.LegacyGroupDenialEvent());
|
events.postValue(new Event.LegacyGroupDenialEvent());
|
||||||
} else {
|
} else {
|
||||||
events.postValue(new Event.AddToSingleGroupConfirmationEvent(context.getResources().getString(R.string.AddToGroupActivity_add_member),
|
events.postValue(new Event.AddToSingleGroupConfirmationEvent(context.getResources().getString(R.string.AddToGroupActivity_add_member),
|
||||||
|
|
|
@ -1112,6 +1112,7 @@
|
||||||
<string name="AddToGroupActivity_add_to_group">Add to group</string>
|
<string name="AddToGroupActivity_add_to_group">Add to group</string>
|
||||||
<string name="AddToGroupActivity_add_to_groups">Add to groups</string>
|
<string name="AddToGroupActivity_add_to_groups">Add to groups</string>
|
||||||
<string name="AddToGroupActivity_this_person_cant_be_added_to_legacy_groups">This person can\'t be added to legacy groups.</string>
|
<string name="AddToGroupActivity_this_person_cant_be_added_to_legacy_groups">This person can\'t be added to legacy groups.</string>
|
||||||
|
<string name="AddToGroupActivity_s_has_already_been_invited_to_s">\"%1$s\" has already been invited to \"%2$s\".</string>
|
||||||
<string name="AddToGroupActivity_add">Add</string>
|
<string name="AddToGroupActivity_add">Add</string>
|
||||||
<string name="AddToGroupActivity_add_to_a_group">Add to a group</string>
|
<string name="AddToGroupActivity_add_to_a_group">Add to a group</string>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue