Treat unregistered user during send as general failure.
This commit is contained in:
parent
2ce6ea9a2a
commit
ea081e981f
12 changed files with 9 additions and 54 deletions
|
@ -35,12 +35,6 @@ public class AlertView extends AppCompatImageView {
|
|||
setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void setPendingApproval() {
|
||||
setVisibility(View.VISIBLE);
|
||||
setColorFilter(ContextCompat.getColor(getContext(), R.color.signal_colorOnSurfaceVariant));
|
||||
setContentDescription(getContext().getString(R.string.conversation_item_sent__pending_approval_description));
|
||||
}
|
||||
|
||||
public void setFailed() {
|
||||
setVisibility(View.VISIBLE);
|
||||
setColorFilter(ContextCompat.getColor(getContext(), R.color.signal_colorError));
|
||||
|
|
|
@ -315,8 +315,6 @@ public class ConversationItemFooter extends ConstraintLayout {
|
|||
}
|
||||
|
||||
dateView.setText(errorMsg);
|
||||
} else if (messageRecord.isPendingInsecureSmsFallback()) {
|
||||
dateView.setText(R.string.ConversationItem_click_to_approve_unencrypted);
|
||||
} else if (messageRecord.isRateLimited()) {
|
||||
dateView.setText(R.string.ConversationItem_send_paused);
|
||||
} else if (MessageRecordUtil.isScheduled(messageRecord)) {
|
||||
|
@ -410,7 +408,7 @@ public class ConversationItemFooter extends ConstraintLayout {
|
|||
previousMessageId = newMessageId;
|
||||
|
||||
|
||||
if (messageRecord.isFailed() || messageRecord.isPendingInsecureSmsFallback() || MessageRecordUtil.isScheduled(messageRecord)) {
|
||||
if (messageRecord.isFailed() || MessageRecordUtil.isScheduled(messageRecord)) {
|
||||
deliveryStatusView.setNone();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1573,8 +1573,6 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
|||
|
||||
if (!messageRecord.isMediaPending() && messageRecord.isFailed()) {
|
||||
alertView.setFailed();
|
||||
} else if (messageRecord.isPendingInsecureSmsFallback()) {
|
||||
alertView.setPendingApproval();
|
||||
} else if (messageRecord.isRateLimited()) {
|
||||
alertView.setRateLimited();
|
||||
} else {
|
||||
|
@ -1826,7 +1824,6 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
|||
return batchSelected.isEmpty() &&
|
||||
((messageRecord.isFailed() && !messageRecord.isMmsNotification()) ||
|
||||
(messageRecord.isRateLimited() && SignalStore.rateLimit().needsRecaptcha()) ||
|
||||
messageRecord.isPendingInsecureSmsFallback() ||
|
||||
messageRecord.isBundleKeyExchange());
|
||||
}
|
||||
|
||||
|
@ -1990,7 +1987,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
|||
private boolean isFooterVisible(@NonNull MessageRecord current, @NonNull Optional<MessageRecord> next, boolean isGroupThread) {
|
||||
boolean differentTimestamps = next.isPresent() && !DateUtils.isSameExtendedRelativeTimestamp(next.get().getTimestamp(), current.getTimestamp());
|
||||
|
||||
return forceFooter(messageRecord) || current.getExpiresIn() > 0 || !current.isSecure() || current.isPending() || current.isPendingInsecureSmsFallback() ||
|
||||
return forceFooter(messageRecord) || current.getExpiresIn() > 0 || !current.isSecure() || current.isPending() ||
|
||||
current.isFailed() || current.isRateLimited() || differentTimestamps || isEndOfMessageCluster(current, next, isGroupThread);
|
||||
}
|
||||
|
||||
|
|
|
@ -578,7 +578,6 @@ open class V2ConversationItemTextOnlyViewHolder<Model : MappingModel<Model>>(
|
|||
|
||||
when {
|
||||
record.isFailed -> alert.setFailed()
|
||||
record.isPendingInsecureSmsFallback -> alert.setPendingApproval()
|
||||
record.isRateLimited -> alert.setRateLimited()
|
||||
else -> alert.setNone()
|
||||
}
|
||||
|
@ -645,8 +644,6 @@ open class V2ConversationItemTextOnlyViewHolder<Model : MappingModel<Model>>(
|
|||
binding.footerDate.setOnClickListener {
|
||||
conversationContext.clickListener.onMessageWithErrorClicked(record)
|
||||
}
|
||||
} else if (record.isPendingInsecureSmsFallback) {
|
||||
binding.footerDate.setText(R.string.ConversationItem_click_to_approve_unencrypted)
|
||||
} else if (record.isRateLimited) {
|
||||
binding.footerDate.setText(R.string.ConversationItem_send_paused)
|
||||
} else if (record.isScheduled()) {
|
||||
|
@ -694,7 +691,7 @@ open class V2ConversationItemTextOnlyViewHolder<Model : MappingModel<Model>>(
|
|||
|
||||
messageId = newMessageId
|
||||
|
||||
if (!record.isOutgoing || record.isFailed || record.isPendingInsecureSmsFallback || record.isScheduled()) {
|
||||
if (!record.isOutgoing || record.isFailed || record.isScheduled()) {
|
||||
deliveryStatus.setNone()
|
||||
return
|
||||
}
|
||||
|
|
|
@ -508,9 +508,6 @@ public final class ConversationListItem extends ConstraintLayout implements Bind
|
|||
} else if (thread.isFailed()) {
|
||||
deliveryStatusIndicator.setNone();
|
||||
alertView.setFailed();
|
||||
} else if (thread.isPendingInsecureSmsFallback()) {
|
||||
deliveryStatusIndicator.setNone();
|
||||
alertView.setPendingApproval();
|
||||
} else {
|
||||
alertView.setNone();
|
||||
|
||||
|
|
|
@ -1915,12 +1915,6 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
|
|||
}
|
||||
}
|
||||
|
||||
fun markAsPendingInsecureSmsFallback(messageId: Long) {
|
||||
val threadId = getThreadIdForMessage(messageId)
|
||||
updateMailboxBitmask(messageId, MessageTypes.BASE_TYPE_MASK, MessageTypes.BASE_PENDING_INSECURE_SMS_FALLBACK, Optional.of(threadId))
|
||||
ApplicationDependencies.getDatabaseObserver().notifyMessageUpdateObservers(MessageId(messageId))
|
||||
}
|
||||
|
||||
fun markAsSending(messageId: Long) {
|
||||
val threadId = getThreadIdForMessage(messageId)
|
||||
updateMailboxBitmask(messageId, MessageTypes.BASE_TYPE_MASK, MessageTypes.BASE_SENDING_TYPE, Optional.of(threadId))
|
||||
|
|
|
@ -75,6 +75,7 @@ public abstract class DisplayRecord {
|
|||
return
|
||||
MessageTypes.isFailedMessageType(type) ||
|
||||
MessageTypes.isPendingSecureSmsFallbackType(type) ||
|
||||
MessageTypes.isPendingInsecureSmsFallbackType(type) ||
|
||||
deliveryStatus >= MessageTable.Status.STATUS_FAILED;
|
||||
}
|
||||
|
||||
|
@ -224,10 +225,6 @@ public abstract class DisplayRecord {
|
|||
return hasReadReceipt;
|
||||
}
|
||||
|
||||
public boolean isPendingInsecureSmsFallback() {
|
||||
return MessageTypes.isPendingInsecureSmsFallbackType(type);
|
||||
}
|
||||
|
||||
public boolean isPaymentNotification() {
|
||||
return MessageTypes.isPaymentsNotification(type);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ final class StatusUtil {
|
|||
static boolean isFailed(long type, long deliveryStatus) {
|
||||
return MessageTypes.isFailedMessageType(type) ||
|
||||
MessageTypes.isPendingSecureSmsFallbackType(type) ||
|
||||
MessageTypes.isPendingInsecureSmsFallbackType(type) ||
|
||||
deliveryStatus >= MessageTable.Status.STATUS_FAILED;
|
||||
}
|
||||
|
||||
|
|
|
@ -180,10 +180,6 @@ public final class ThreadRecord {
|
|||
return hasReadReceipt;
|
||||
}
|
||||
|
||||
public boolean isPendingInsecureSmsFallback() {
|
||||
return MessageTypes.isPendingInsecureSmsFallbackType(type);
|
||||
}
|
||||
|
||||
public boolean isDelivered() {
|
||||
return StatusUtil.isDelivered(deliveryStatus, hasDeliveryReceipt);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
|||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientUtil;
|
||||
import org.thoughtcrime.securesms.service.ExpiringMessageManager;
|
||||
import org.thoughtcrime.securesms.transport.InsecureFallbackApprovalException;
|
||||
import org.thoughtcrime.securesms.transport.RetryLaterException;
|
||||
import org.thoughtcrime.securesms.transport.UndeliverableMessageException;
|
||||
import org.thoughtcrime.securesms.util.SignalLocalMetrics;
|
||||
|
@ -205,9 +204,9 @@ public class IndividualSendJob extends PushSendJob {
|
|||
|
||||
log(TAG, String.valueOf(message.getSentTimeMillis()), "Sent message: " + messageId);
|
||||
|
||||
} catch (InsecureFallbackApprovalException ifae) {
|
||||
warn(TAG, "Failure", ifae);
|
||||
database.markAsPendingInsecureSmsFallback(messageId);
|
||||
} catch (UnregisteredUserException uue) {
|
||||
warn(TAG, "Failure", uue);
|
||||
database.markAsSentFailed(messageId);
|
||||
notifyMediaMessageDeliveryFailed(context, messageId);
|
||||
ApplicationDependencies.getJobManager().add(new DirectoryRefreshJob(false));
|
||||
} catch (UntrustedIdentityException uie) {
|
||||
|
@ -237,7 +236,7 @@ public class IndividualSendJob extends PushSendJob {
|
|||
}
|
||||
|
||||
private boolean deliver(OutgoingMessage message, MessageRecord originalEditedMessage)
|
||||
throws IOException, InsecureFallbackApprovalException, UntrustedIdentityException, UndeliverableMessageException
|
||||
throws IOException, UnregisteredUserException, UntrustedIdentityException, UndeliverableMessageException
|
||||
{
|
||||
if (message.getThreadRecipient() == null) {
|
||||
throw new UndeliverableMessageException("No destination address.");
|
||||
|
@ -335,9 +334,6 @@ public class IndividualSendJob extends PushSendJob {
|
|||
|
||||
return result.getSuccess().isUnidentified();
|
||||
}
|
||||
} catch (UnregisteredUserException e) {
|
||||
warn(TAG, String.valueOf(message.getSentTimeMillis()), e);
|
||||
throw new InsecureFallbackApprovalException(e);
|
||||
} catch (FileNotFoundException e) {
|
||||
warn(TAG, String.valueOf(message.getSentTimeMillis()), e);
|
||||
throw new UndeliverableMessageException(e);
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
package org.thoughtcrime.securesms.transport;
|
||||
|
||||
public class InsecureFallbackApprovalException extends Exception {
|
||||
public InsecureFallbackApprovalException(String detailMessage) {
|
||||
super(detailMessage);
|
||||
}
|
||||
|
||||
public InsecureFallbackApprovalException(Throwable e) {
|
||||
super(e);
|
||||
}
|
||||
}
|
|
@ -307,7 +307,6 @@
|
|||
<string name="ConversationItem_error_network_not_delivered">Send failed</string>
|
||||
<string name="ConversationItem_group_action_left">%1$s has left the group.</string>
|
||||
<string name="ConversationItem_send_paused">Send paused</string>
|
||||
<string name="ConversationItem_click_to_approve_unencrypted">Send failed, tap for unsecured fallback</string>
|
||||
<string name="ConversationItem_click_to_approve_unencrypted_sms_dialog_title">Fallback to unencrypted SMS?</string>
|
||||
<string name="ConversationItem_click_to_approve_unencrypted_mms_dialog_title">Fallback to unencrypted MMS?</string>
|
||||
<string name="ConversationItem_click_to_approve_unencrypted_dialog_message">This message will <b>not</b> be encrypted because the recipient is no longer a Signal user.\n\nSend unsecured message?</string>
|
||||
|
|
Loading…
Add table
Reference in a new issue