mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-11 16:33:39 +00:00
Fix bug that broke notifications for group messages.
This commit is contained in:
parent
d3148b6766
commit
37a52df4e6
@ -304,7 +304,7 @@ public class MessageNotifier {
|
||||
SpannableString body = new SpannableString(context.getString(R.string.MessageNotifier_encrypted_message));
|
||||
body.setSpan(new StyleSpan(android.graphics.Typeface.ITALIC), 0, body.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
||||
notificationState.addNotification(new NotificationItem(recipient, recipients, threadId, body, null));
|
||||
notificationState.addNotification(new NotificationItem(recipient, recipients, null, threadId, body, null));
|
||||
}
|
||||
} finally {
|
||||
if (reader != null)
|
||||
@ -324,11 +324,16 @@ public class MessageNotifier {
|
||||
else reader = DatabaseFactory.getMmsSmsDatabase(context).readerFor(cursor, masterSecret);
|
||||
|
||||
while ((record = reader.getNext()) != null) {
|
||||
Recipient recipient = record.getIndividualRecipient();
|
||||
Recipients recipients = record.getRecipients();
|
||||
long threadId = record.getThreadId();
|
||||
SpannableString body = record.getDisplayBody();
|
||||
Uri image = null;
|
||||
Recipient recipient = record.getIndividualRecipient();
|
||||
Recipients recipients = record.getRecipients();
|
||||
long threadId = record.getThreadId();
|
||||
SpannableString body = record.getDisplayBody();
|
||||
Uri image = null;
|
||||
Recipients threadRecipients = null;
|
||||
|
||||
if (threadId != -1) {
|
||||
threadRecipients = DatabaseFactory.getThreadDatabase(context).getRecipientsForThreadId(threadId);
|
||||
}
|
||||
|
||||
// XXXX This is so fucked up. FIX ME!
|
||||
if (body.toString().equals(context.getString(R.string.MessageDisplayHelper_decrypting_please_wait))) {
|
||||
@ -336,7 +341,7 @@ public class MessageNotifier {
|
||||
body.setSpan(new StyleSpan(android.graphics.Typeface.ITALIC), 0, body.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
|
||||
notificationState.addNotification(new NotificationItem(recipient, recipients, threadId, body, image));
|
||||
notificationState.addNotification(new NotificationItem(recipient, recipients, threadRecipients, threadId, body, image));
|
||||
}
|
||||
|
||||
reader.close();
|
||||
|
@ -15,15 +15,18 @@ public class NotificationItem {
|
||||
|
||||
private final Recipients recipients;
|
||||
private final Recipient individualRecipient;
|
||||
private final Recipients threadRecipients;
|
||||
private final long threadId;
|
||||
private final CharSequence text;
|
||||
private final Uri image;
|
||||
|
||||
public NotificationItem(Recipient individualRecipient, Recipients recipients, long threadId,
|
||||
public NotificationItem(Recipient individualRecipient, Recipients recipients,
|
||||
Recipients threadRecipients, long threadId,
|
||||
CharSequence text, Uri image)
|
||||
{
|
||||
this.individualRecipient = individualRecipient;
|
||||
this.recipients = recipients;
|
||||
this.threadRecipients = threadRecipients;
|
||||
this.text = text;
|
||||
this.image = image;
|
||||
this.threadId = threadId;
|
||||
@ -70,8 +73,10 @@ public class NotificationItem {
|
||||
Intent intent = new Intent(context, RoutingActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
|
||||
if (recipients != null) {
|
||||
intent.putExtra("recipients", recipients);
|
||||
if (recipients != null || threadRecipients != null) {
|
||||
if (threadRecipients != null) intent.putExtra("recipients", threadRecipients);
|
||||
else intent.putExtra("recipients", recipients);
|
||||
|
||||
intent.putExtra("thread_id", threadId);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user