Do not allow replying on reactions and messages without visible content.
This commit is contained in:
parent
b1fdbc0151
commit
5ae96905bb
3 changed files with 19 additions and 4 deletions
|
@ -383,7 +383,7 @@ public class DefaultMessageNotifier implements MessageNotifier {
|
||||||
notificationState.getQuickReplyIntent(context, notifications.get(0).getRecipient()),
|
notificationState.getQuickReplyIntent(context, notifications.get(0).getRecipient()),
|
||||||
notificationState.getRemoteReplyIntent(context, notifications.get(0).getRecipient(), replyMethod),
|
notificationState.getRemoteReplyIntent(context, notifications.get(0).getRecipient(), replyMethod),
|
||||||
replyMethod,
|
replyMethod,
|
||||||
!isSingleNotificationContactJoined);
|
!isSingleNotificationContactJoined && notificationState.canReply());
|
||||||
|
|
||||||
builder.addAndroidAutoAction(notificationState.getAndroidAutoReplyIntent(context, notifications.get(0).getRecipient()),
|
builder.addAndroidAutoAction(notificationState.getAndroidAutoReplyIntent(context, notifications.get(0).getRecipient()),
|
||||||
notificationState.getAndroidAutoHeardIntent(context, notificationId), notifications.get(0).getTimestamp());
|
notificationState.getAndroidAutoHeardIntent(context, notificationId), notifications.get(0).getTimestamp());
|
||||||
|
@ -533,6 +533,8 @@ public class DefaultMessageNotifier implements MessageNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isUnreadMessage) {
|
if (isUnreadMessage) {
|
||||||
|
boolean canReply = false;
|
||||||
|
|
||||||
if (KeyCachingService.isLocked(context)) {
|
if (KeyCachingService.isLocked(context)) {
|
||||||
body = SpanUtil.italic(context.getString(R.string.MessageNotifier_locked_message));
|
body = SpanUtil.italic(context.getString(R.string.MessageNotifier_locked_message));
|
||||||
} else if (record.isMms() && !((MmsMessageRecord) record).getSharedContacts().isEmpty()) {
|
} else if (record.isMms() && !((MmsMessageRecord) record).getSharedContacts().isEmpty()) {
|
||||||
|
@ -545,6 +547,9 @@ public class DefaultMessageNotifier implements MessageNotifier {
|
||||||
} else if (record.isMms() && !record.isMmsNotification() && !((MmsMessageRecord) record).getSlideDeck().getSlides().isEmpty()) {
|
} else if (record.isMms() && !record.isMmsNotification() && !((MmsMessageRecord) record).getSlideDeck().getSlides().isEmpty()) {
|
||||||
body = ThreadBodyUtil.getFormattedBodyFor(context, record);
|
body = ThreadBodyUtil.getFormattedBodyFor(context, record);
|
||||||
slideDeck = ((MmsMessageRecord) record).getSlideDeck();
|
slideDeck = ((MmsMessageRecord) record).getSlideDeck();
|
||||||
|
canReply = true;
|
||||||
|
} else {
|
||||||
|
canReply = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean includeMessage = true;
|
boolean includeMessage = true;
|
||||||
|
@ -555,7 +560,7 @@ public class DefaultMessageNotifier implements MessageNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (threadRecipients == null || includeMessage) {
|
if (threadRecipients == null || includeMessage) {
|
||||||
notificationState.addNotification(new NotificationItem(id, mms, recipient, conversationRecipient, threadRecipients, threadId, body, timestamp, receivedTimestamp, slideDeck, false, record.isJoined()));
|
notificationState.addNotification(new NotificationItem(id, mms, recipient, conversationRecipient, threadRecipients, threadId, body, timestamp, receivedTimestamp, slideDeck, false, record.isJoined(), canReply));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -590,7 +595,7 @@ public class DefaultMessageNotifier implements MessageNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (threadRecipients == null || !threadRecipients.isMuted()) {
|
if (threadRecipients == null || !threadRecipients.isMuted()) {
|
||||||
notificationState.addNotification(new NotificationItem(id, mms, reactionSender, conversationRecipient, threadRecipients, threadId, body, reaction.getDateReceived(), receivedTimestamp, null, true, record.isJoined()));
|
notificationState.addNotification(new NotificationItem(id, mms, reactionSender, conversationRecipient, threadRecipients, threadId, body, reaction.getDateReceived(), receivedTimestamp, null, true, record.isJoined(), false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ public class NotificationItem {
|
||||||
@Nullable private final SlideDeck slideDeck;
|
@Nullable private final SlideDeck slideDeck;
|
||||||
private final boolean jumpToMessage;
|
private final boolean jumpToMessage;
|
||||||
private final boolean isJoin;
|
private final boolean isJoin;
|
||||||
|
private final boolean canReply;
|
||||||
|
|
||||||
public NotificationItem(long id,
|
public NotificationItem(long id,
|
||||||
boolean mms,
|
boolean mms,
|
||||||
|
@ -40,7 +41,8 @@ public class NotificationItem {
|
||||||
long messageReceivedTimestamp,
|
long messageReceivedTimestamp,
|
||||||
@Nullable SlideDeck slideDeck,
|
@Nullable SlideDeck slideDeck,
|
||||||
boolean jumpToMessage,
|
boolean jumpToMessage,
|
||||||
boolean isJoin)
|
boolean isJoin,
|
||||||
|
boolean canReply)
|
||||||
{
|
{
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.mms = mms;
|
this.mms = mms;
|
||||||
|
@ -54,6 +56,7 @@ public class NotificationItem {
|
||||||
this.slideDeck = slideDeck;
|
this.slideDeck = slideDeck;
|
||||||
this.jumpToMessage = jumpToMessage;
|
this.jumpToMessage = jumpToMessage;
|
||||||
this.isJoin = isJoin;
|
this.isJoin = isJoin;
|
||||||
|
this.canReply = canReply;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NonNull Recipient getRecipient() {
|
public @NonNull Recipient getRecipient() {
|
||||||
|
@ -112,4 +115,8 @@ public class NotificationItem {
|
||||||
private static void makeIntentUniqueToPreventMerging(@NonNull Intent intent) {
|
private static void makeIntentUniqueToPreventMerging(@NonNull Intent intent) {
|
||||||
intent.setData((Uri.parse("custom://"+System.currentTimeMillis())));
|
intent.setData((Uri.parse("custom://"+System.currentTimeMillis())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canReply() {
|
||||||
|
return canReply;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,5 +208,8 @@ public class NotificationState {
|
||||||
return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canReply() {
|
||||||
|
return notifications.size() == 1 && notifications.get(0).canReply();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue