Update unsupported message UI.

This commit is contained in:
Michelle Tang
2025-08-27 13:02:56 -04:00
parent 8322bf3ecc
commit d4f08e6d46
10 changed files with 42 additions and 2 deletions

View File

@@ -346,5 +346,7 @@ class V2ConversationItemShapeTest {
override fun onDisplayMediaNoLongerAvailableSheet() = Unit
override fun onShowUnverifiedProfileSheet(forGroup: Boolean) = Unit
override fun onUpdateSignalClicked() = Unit
}
}

View File

@@ -332,5 +332,9 @@ class InternalConversationTestFragment : Fragment(R.layout.conversation_test_fra
override fun onShowUnverifiedProfileSheet(forGroup: Boolean) {
Toast.makeText(requireContext(), "Can't touch this.", Toast.LENGTH_SHORT).show()
}
override fun onUpdateSignalClicked() {
Toast.makeText(requireContext(), "Can't touch this.", Toast.LENGTH_SHORT).show()
}
}
}

View File

@@ -142,5 +142,6 @@ public interface BindableConversationItem extends Unbindable, GiphyMp4Playable,
void onPaymentTombstoneClicked();
void onDisplayMediaNoLongerAvailableSheet();
void onShowUnverifiedProfileSheet(boolean forGroup);
void onUpdateSignalClicked();
}
}

View File

@@ -634,6 +634,16 @@ public final class ConversationUpdateItem extends FrameLayout
passthroughClickListener.onClick(v);
}
});
} else if (conversationMessage.getMessageRecord().isUnsupported()) {
actionButton.setText(R.string.ConversationFragment__update_build);
actionButton.setVisibility(VISIBLE);
actionButton.setOnClickListener(v -> {
if (batchSelected.isEmpty() && eventListener != null) {
eventListener.onUpdateSignalClicked();
} else {
passthroughClickListener.onClick(v);
}
});
} else {
actionButton.setVisibility(GONE);
actionButton.setOnClickListener(null);

View File

@@ -3040,6 +3040,10 @@ class ConversationFragment :
UnverifiedProfileNameBottomSheet.show(parentFragmentManager, forGroup)
}
override fun onUpdateSignalClicked() {
PlayStoreUtil.openPlayStoreOrOurApkDownloadPage(requireContext())
}
override fun onJoinGroupCallClicked() {
val activity = activity ?: return
val recipient = viewModel.recipientSnapshot ?: return

View File

@@ -256,4 +256,8 @@ public abstract class DisplayRecord {
public boolean isUnblocked() {
return MessageTypes.isUnblocked(type);
}
public boolean isUnsupported() {
return MessageTypes.isUnsupportedMessageType(type);
}
}

View File

@@ -291,6 +291,8 @@ public abstract class MessageRecord extends DisplayRecord {
return staticUpdateDescription(context.getString(isGroupV2() ? R.string.MessageRecord_you_blocked_this_group : R.string.MessageRecord_you_blocked_this_person), Glyph.BLOCK);
} else if (isUnblocked()) {
return staticUpdateDescription(context.getString(isGroupV2() ? R.string.MessageRecord_you_unblocked_this_group : R.string.MessageRecord_you_unblocked_this_person) , Glyph.THREAD);
} else if (isUnsupported()) {
return staticUpdateDescription(context.getString(R.string.MessageRecord_unsupported_feature, getFromRecipient().getDisplayName(context)), Glyph.ERROR);
}
return null;
@@ -730,7 +732,7 @@ public abstract class MessageRecord extends DisplayRecord {
isProfileChange() || isGroupV1MigrationEvent() || isChatSessionRefresh() || isBadDecryptType() ||
isChangeNumber() || isReleaseChannelDonationRequest() || isThreadMergeEventType() || isSmsExportType() || isSessionSwitchoverEventType() ||
isPaymentsRequestToActivate() || isPaymentsActivated() || isReportedSpam() || isMessageRequestAccepted() ||
isBlocked() || isUnblocked();
isBlocked() || isUnblocked() || isUnsupported();
}
public boolean isMediaPending() {

View File

@@ -5,6 +5,7 @@ import android.net.Uri
import android.os.Bundle
import android.view.View
import android.widget.FrameLayout
import android.widget.Toast
import androidx.fragment.app.DialogFragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
@@ -391,6 +392,10 @@ class MessageDetailsFragment : FullScreenDialogFragment(), MessageDetailsAdapter
Log.w(TAG, "Not yet implemented!", Exception())
}
override fun onUpdateSignalClicked() {
Toast.makeText(requireContext(), "Can't touch this.", Toast.LENGTH_SHORT).show()
}
interface Callback {
fun onMessageDetailsFragmentDismissed()
}

View File

@@ -45,6 +45,7 @@ import org.thoughtcrime.securesms.jobs.SendRetryReceiptJob
import org.thoughtcrime.securesms.keyvalue.SignalStore
import org.thoughtcrime.securesms.logsubmit.SubmitDebugLogActivity
import org.thoughtcrime.securesms.messages.MessageDecryptor.FollowUpOperation
import org.thoughtcrime.securesms.messages.SignalServiceProtoUtil.hasGroupContext
import org.thoughtcrime.securesms.messages.protocol.BufferedProtocolStore
import org.thoughtcrime.securesms.notifications.NotificationChannels
import org.thoughtcrime.securesms.notifications.NotificationIds
@@ -528,10 +529,15 @@ object MessageDecryptor {
}
private fun SignalServiceCipherResult.toErrorMetadata(): ErrorMetadata {
val groupId = if (this.content.dataMessage.hasGroupContext) {
GroupId.v2(GroupMasterKey(this.content.dataMessage!!.groupV2!!.masterKey!!.toByteArray()))
} else {
null
}
return ErrorMetadata(
sender = this.metadata.sourceServiceId.toString(),
senderDevice = this.metadata.sourceDeviceId,
groupId = null
groupId = groupId
)
}

View File

@@ -2115,6 +2115,8 @@
<string name="MessageRecord_you_blocked_this_group">You blocked this group</string>
<!-- Update message shown in chat after you unblock a group -->
<string name="MessageRecord_you_unblocked_this_group">You unblocked this group</string>
<!-- Update message shown when you receive a message that cannot be processed because your Signal version is too old. %1$s is the sender\'s name -->
<string name="MessageRecord_unsupported_feature">%1$s sent you a message that can\'t be processed or displayed because it uses a new Signal feature.</string>
<!-- MessageRequestBottomView -->
<string name="MessageRequestBottomView_accept">Accept</string>