mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-20 07:11:31 +00:00
parent
c6a4877391
commit
bcd9aa84d6
@ -195,6 +195,9 @@ public class MessageNotifier {
|
|||||||
builder.setDeleteIntent(PendingIntent.getBroadcast(context, 0, new Intent(DeleteReceiver.DELETE_REMINDER_ACTION), 0));
|
builder.setDeleteIntent(PendingIntent.getBroadcast(context, 0, new Intent(DeleteReceiver.DELETE_REMINDER_ACTION), 0));
|
||||||
if (recipient.getContactUri() != null) builder.addPerson(recipient.getContactUri().toString());
|
if (recipient.getContactUri() != null) builder.addPerson(recipient.getContactUri().toString());
|
||||||
|
|
||||||
|
long timestamp = notifications.get(0).getTimestamp();
|
||||||
|
if (timestamp != 0) builder.setWhen(timestamp);
|
||||||
|
|
||||||
if (masterSecret != null) {
|
if (masterSecret != null) {
|
||||||
builder.addAction(R.drawable.check, context.getString(R.string.MessageNotifier_mark_as_read),
|
builder.addAction(R.drawable.check, context.getString(R.string.MessageNotifier_mark_as_read),
|
||||||
notificationState.getMarkAsReadIntent(context, masterSecret));
|
notificationState.getMarkAsReadIntent(context, masterSecret));
|
||||||
@ -243,6 +246,9 @@ public class MessageNotifier {
|
|||||||
builder.setNumber(notificationState.getMessageCount());
|
builder.setNumber(notificationState.getMessageCount());
|
||||||
builder.setCategory(NotificationCompat.CATEGORY_MESSAGE);
|
builder.setCategory(NotificationCompat.CATEGORY_MESSAGE);
|
||||||
|
|
||||||
|
long timestamp = notifications.get(0).getTimestamp();
|
||||||
|
if (timestamp != 0) builder.setWhen(timestamp);
|
||||||
|
|
||||||
builder.setDeleteIntent(PendingIntent.getBroadcast(context, 0, new Intent(DeleteReceiver.DELETE_REMINDER_ACTION), 0));
|
builder.setDeleteIntent(PendingIntent.getBroadcast(context, 0, new Intent(DeleteReceiver.DELETE_REMINDER_ACTION), 0));
|
||||||
|
|
||||||
if (masterSecret != null) {
|
if (masterSecret != null) {
|
||||||
@ -330,7 +336,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, null, threadId, body, null));
|
notificationState.addNotification(new NotificationItem(recipient, recipients, null, threadId, body, null, 0));
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (reader != null)
|
if (reader != null)
|
||||||
@ -356,6 +362,10 @@ public class MessageNotifier {
|
|||||||
CharSequence body = record.getDisplayBody();
|
CharSequence body = record.getDisplayBody();
|
||||||
Uri image = null;
|
Uri image = null;
|
||||||
Recipients threadRecipients = null;
|
Recipients threadRecipients = null;
|
||||||
|
long timestamp;
|
||||||
|
|
||||||
|
if (record.isPush()) timestamp = record.getDateSent();
|
||||||
|
else timestamp = record.getDateReceived();
|
||||||
|
|
||||||
if (threadId != -1) {
|
if (threadId != -1) {
|
||||||
threadRecipients = DatabaseFactory.getThreadDatabase(context).getRecipientsForThreadId(threadId);
|
threadRecipients = DatabaseFactory.getThreadDatabase(context).getRecipientsForThreadId(threadId);
|
||||||
@ -371,7 +381,7 @@ public class MessageNotifier {
|
|||||||
body = SpanUtil.italic(message, italicLength);
|
body = SpanUtil.italic(message, italicLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
notificationState.addNotification(new NotificationItem(recipient, recipients, threadRecipients, threadId, body, image));
|
notificationState.addNotification(new NotificationItem(recipient, recipients, threadRecipients, threadId, body, image, timestamp));
|
||||||
}
|
}
|
||||||
|
|
||||||
reader.close();
|
reader.close();
|
||||||
|
@ -19,10 +19,11 @@ public class NotificationItem {
|
|||||||
private final long threadId;
|
private final long threadId;
|
||||||
private final CharSequence text;
|
private final CharSequence text;
|
||||||
private final Uri image;
|
private final Uri image;
|
||||||
|
private final long timestamp;
|
||||||
|
|
||||||
public NotificationItem(Recipient individualRecipient, Recipients recipients,
|
public NotificationItem(Recipient individualRecipient, Recipients recipients,
|
||||||
Recipients threadRecipients, long threadId,
|
Recipients threadRecipients, long threadId,
|
||||||
CharSequence text, Uri image)
|
CharSequence text, Uri image, long timestamp)
|
||||||
{
|
{
|
||||||
this.individualRecipient = individualRecipient;
|
this.individualRecipient = individualRecipient;
|
||||||
this.recipients = recipients;
|
this.recipients = recipients;
|
||||||
@ -30,6 +31,7 @@ public class NotificationItem {
|
|||||||
this.text = text;
|
this.text = text;
|
||||||
this.image = image;
|
this.image = image;
|
||||||
this.threadId = threadId;
|
this.threadId = threadId;
|
||||||
|
this.timestamp = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Recipient getIndividualRecipient() {
|
public Recipient getIndividualRecipient() {
|
||||||
@ -44,6 +46,10 @@ public class NotificationItem {
|
|||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getTimestamp() {
|
||||||
|
return timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
public Uri getImage() {
|
public Uri getImage() {
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user