Fix bug allowing creation of new and sending in existing MMS groups.

This commit is contained in:
Cody Henthorne 2023-11-16 12:25:04 -05:00 committed by Greyson Parrelli
parent df4bd1fa4a
commit 19626361ec
4 changed files with 31 additions and 6 deletions

View file

@ -133,10 +133,16 @@ class DisabledInputView @JvmOverloads constructor(
existingView = inviteToSignal,
create = { inflater.inflate(R.layout.conversation_activity_sms_export_stub, this, false) },
bind = {
findViewById<TextView>(R.id.export_sms_message).text = context.getString(R.string.ConversationActivity__sms_messaging_is_no_longer_supported_in_signal_invite_s_to_to_signal_to_keep_the_conversation_here, recipient.getDisplayName(context))
findViewById<TextView>(R.id.export_sms_message).text = if (recipient.isMmsGroup) {
context.getString(R.string.ConversationActivity__sms_messaging_is_no_longer_supported)
} else {
context.getString(R.string.ConversationActivity__sms_messaging_is_no_longer_supported_in_signal_invite_s_to_to_signal_to_keep_the_conversation_here, recipient.getDisplayName(context))
}
findViewById<MaterialButton>(R.id.export_sms_button).apply {
setText(R.string.ConversationActivity__invite_to_signal)
setOnClickListener { listener?.onInviteToSignal(recipient) }
visible = !recipient.isMmsGroup
}
}
)

View file

@ -28,7 +28,7 @@ class InputReadyState(
val isRequestingMember: Boolean? = selfMemberLevel?.equals(GroupTable.MemberLevel.REQUESTING_MEMBER)
fun shouldShowInviteToSignal(): Boolean {
return !conversationRecipient.isGroup &&
return !conversationRecipient.isPushGroup &&
!conversationRecipient.isRegistered &&
!conversationRecipient.isReleaseNotes
}

View file

@ -10,6 +10,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import org.signal.core.util.DimensionUnit;
@ -155,7 +156,7 @@ public class CreateGroupActivity extends ContactSelectionActivity {
stopwatch.split("resolve");
Set<Recipient> registeredChecks = resolved.stream()
.filter(r -> r.getRegistered() == RecipientTable.RegisteredState.UNKNOWN)
.filter(r -> !r.isRegistered() || !r.hasServiceId())
.collect(Collectors.toSet());
Log.i(TAG, "Need to do " + registeredChecks.size() + " registration checks.");
@ -170,11 +171,22 @@ public class CreateGroupActivity extends ContactSelectionActivity {
stopwatch.split("registered");
return ids;
}, recipientIds -> {
return Recipient.resolvedList(ids);
}, recipients -> {
dismissibleDialog.dismiss();
stopwatch.stop(TAG);
startActivityForResult(AddGroupDetailsActivity.newIntent(this, recipientIds), REQUEST_CODE_ADD_DETAILS);
List<Recipient> notRegistered = recipients.stream().filter(r -> !r.isRegistered() || !r.hasServiceId()).collect(Collectors.toList());
if (notRegistered.isEmpty()) {
startActivityForResult(AddGroupDetailsActivity.newIntent(this, recipients.stream().map(Recipient::getId).collect(Collectors.toList())), REQUEST_CODE_ADD_DETAILS);
} else {
String notRegisteredNames = notRegistered.stream().map(r -> r.getDisplayName(this)).collect(Collectors.joining(", "));
new MaterialAlertDialogBuilder(this)
.setMessage(getResources().getQuantityString(R.plurals.CreateGroupActivity_not_signal_users, notRegistered.size(), notRegisteredNames))
.setPositiveButton(android.R.string.ok, null)
.show();
}
});
}
}

View file

@ -405,6 +405,8 @@
<string name="ConversationActivity_error_sending_media">Error sending media</string>
<!-- Message shown when opening an MMS group conversation with SMS disabled and there are no exported messages -->
<string name="ConversationActivity__sms_messaging_is_no_longer_supported">SMS messaging is no longer supported in Signal.</string>
<!-- Message shown when opening an SMS conversation with SMS disabled and there are no exported messages -->
<string name="ConversationActivity__sms_messaging_is_no_longer_supported_in_signal_invite_s_to_to_signal_to_keep_the_conversation_here">SMS messaging is no longer supported in Signal. Invite %1$s to Signal to keep the conversation here.</string>
<!-- Action button shown when opening an SMS conversation with SMS disabled and there are no exported messages -->
@ -4581,6 +4583,11 @@
<string name="NewConversationActivity__s_is_not_a_signal_user">%1$s is not a Signal user</string>
<!-- Error message shown when we could not get a user from the username link -->
<string name="NewConversationActivity__">%1$s is not a Signal user</string>
<!-- Error message shown in a dialog when trying to create a new group with non-signal users (e.g., unregistered or phone number only contacts) -->
<plurals name="CreateGroupActivity_not_signal_users">
<item quantity="one">%1$s is not a Signal user</item>
<item quantity="other">%1$s are not Signal users</item>
</plurals>
<!-- ContactFilterView -->
<string name="ContactFilterView__search_name_or_number">Search name or number</string>