mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 14:27:24 +00:00
Mark as read - use message ID retrieved from server
Minimal set of changes, to be cleaned-up. Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
This commit is contained in:
parent
f977b566a5
commit
7243142676
@ -247,6 +247,8 @@ public class NotificationWorker extends Worker {
|
||||
}
|
||||
}
|
||||
|
||||
decryptedPushMessage.setObjectId(notification.getObjectId());
|
||||
|
||||
showNotification(intent);
|
||||
}
|
||||
|
||||
@ -427,7 +429,9 @@ public class NotificationWorker extends Worker {
|
||||
actualIntent.putExtra(BundleKeys.INSTANCE.getKEY_SYSTEM_NOTIFICATION_ID(), systemNotificationId);
|
||||
actualIntent.putExtra(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN(), decryptedPushMessage.getId());
|
||||
if (decryptedPushMessage.getNotificationId() != null) {
|
||||
actualIntent.putExtra(BundleKeys.KEY_MESSAGE_ID, decryptedPushMessage.getNotificationId().intValue());
|
||||
// TODO - improve parsing when server returns unexpected objectId
|
||||
int messageId = Integer.parseInt(decryptedPushMessage.getObjectId().split("/")[1]);
|
||||
actualIntent.putExtra(BundleKeys.KEY_MESSAGE_ID, messageId);
|
||||
}
|
||||
|
||||
int intentFlag;
|
||||
|
@ -62,10 +62,13 @@ data class DecryptedPushMessage(
|
||||
var text: String?,
|
||||
|
||||
@JsonIgnore
|
||||
var timestamp: Long
|
||||
var timestamp: Long,
|
||||
|
||||
@JsonIgnore
|
||||
var objectId: String?
|
||||
) : Parcelable {
|
||||
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
|
||||
constructor() : this(null, null, "", null, 0, null, false, false, false, null, null, 0)
|
||||
constructor() : this(null, null, "", null, 0, null, false, false, false, null, null, 0, null)
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
@ -88,6 +91,7 @@ data class DecryptedPushMessage(
|
||||
if (notificationUser != other.notificationUser) return false
|
||||
if (text != other.text) return false
|
||||
if (timestamp != other.timestamp) return false
|
||||
if (objectId != other.objectId) return false
|
||||
|
||||
return true
|
||||
}
|
||||
@ -105,6 +109,7 @@ data class DecryptedPushMessage(
|
||||
result = 31 * result + (notificationUser?.hashCode() ?: 0)
|
||||
result = 31 * result + (text?.hashCode() ?: 0)
|
||||
result = 31 * result + (timestamp?.hashCode() ?: 0)
|
||||
result = 31 * result + (objectId?.hashCode() ?: 0)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user