Skip to content

Commit 85e8ddf

Browse files
committed
fix(inbox): check if date is null, adding doc
1 parent 8c24345 commit 85e8ddf

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

AndroidSDK/src/com/leanplum/LeanplumInbox.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,16 @@ public int compare(String firstMessageId, String secondMessageId) {
316316
if (secondMessage == null) {
317317
return 1;
318318
}
319+
319320
Date firstDate = firstMessage.getDeliveryTimestamp();
320321
Date secondDate = secondMessage.getDeliveryTimestamp();
322+
// Message with null date will be moved to the back of the list.
323+
if (firstDate == null) {
324+
return -1;
325+
}
326+
if (secondDate == null) {
327+
return 1;
328+
}
321329
return firstDate.compareTo(secondDate);
322330
}
323331
});

AndroidSDK/src/com/leanplum/NewsfeedMessage.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,12 @@ public Date deliveryTimestamp() {
146146
}
147147

148148
/**
149-
* Returns the delivery timestamp of the newsfeed message.
149+
* Returns the delivery timestamp of the newsfeed message,
150+
* or null if delivery timestamp is not present.
150151
*/
151152
public Date getDeliveryTimestamp() {
152153
if (deliveryTimestamp == null) {
153-
return new Date();
154+
return null;
154155
}
155156
return new Date(deliveryTimestamp);
156157
}

0 commit comments

Comments
 (0)