mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-11 22:13:38 +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));
|
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);
|
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 {
|
} finally {
|
||||||
if (reader != null)
|
if (reader != null)
|
||||||
@ -329,6 +329,11 @@ public class MessageNotifier {
|
|||||||
long threadId = record.getThreadId();
|
long threadId = record.getThreadId();
|
||||||
SpannableString body = record.getDisplayBody();
|
SpannableString body = record.getDisplayBody();
|
||||||
Uri image = null;
|
Uri image = null;
|
||||||
|
Recipients threadRecipients = null;
|
||||||
|
|
||||||
|
if (threadId != -1) {
|
||||||
|
threadRecipients = DatabaseFactory.getThreadDatabase(context).getRecipientsForThreadId(threadId);
|
||||||
|
}
|
||||||
|
|
||||||
// XXXX This is so fucked up. FIX ME!
|
// XXXX This is so fucked up. FIX ME!
|
||||||
if (body.toString().equals(context.getString(R.string.MessageDisplayHelper_decrypting_please_wait))) {
|
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);
|
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();
|
reader.close();
|
||||||
|
@ -15,15 +15,18 @@ public class NotificationItem {
|
|||||||
|
|
||||||
private final Recipients recipients;
|
private final Recipients recipients;
|
||||||
private final Recipient individualRecipient;
|
private final Recipient individualRecipient;
|
||||||
|
private final Recipients threadRecipients;
|
||||||
private final long threadId;
|
private final long threadId;
|
||||||
private final CharSequence text;
|
private final CharSequence text;
|
||||||
private final Uri image;
|
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)
|
CharSequence text, Uri image)
|
||||||
{
|
{
|
||||||
this.individualRecipient = individualRecipient;
|
this.individualRecipient = individualRecipient;
|
||||||
this.recipients = recipients;
|
this.recipients = recipients;
|
||||||
|
this.threadRecipients = threadRecipients;
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.image = image;
|
this.image = image;
|
||||||
this.threadId = threadId;
|
this.threadId = threadId;
|
||||||
@ -70,8 +73,10 @@ public class NotificationItem {
|
|||||||
Intent intent = new Intent(context, RoutingActivity.class);
|
Intent intent = new Intent(context, RoutingActivity.class);
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
|
|
||||||
if (recipients != null) {
|
if (recipients != null || threadRecipients != null) {
|
||||||
intent.putExtra("recipients", recipients);
|
if (threadRecipients != null) intent.putExtra("recipients", threadRecipients);
|
||||||
|
else intent.putExtra("recipients", recipients);
|
||||||
|
|
||||||
intent.putExtra("thread_id", threadId);
|
intent.putExtra("thread_id", threadId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user