mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Only show breaks between new days
// FREEBIE
This commit is contained in:
parent
66521d94c3
commit
68ffd81390
|
@ -4879,25 +4879,15 @@ typedef enum : NSUInteger {
|
|||
OWSAssert(viewItemTimestamp > 0);
|
||||
|
||||
BOOL shouldShowDate = NO;
|
||||
if (!canShowDate) {
|
||||
shouldShowDate = NO;
|
||||
if (previousViewItemTimestamp == 0) {
|
||||
shouldShowDateOnNextViewItem = YES;
|
||||
} else if (shouldShowDateOnNextViewItem) {
|
||||
} else if (![DateUtil isSameDayWithTimestamp:previousViewItemTimestamp timestamp:viewItemTimestamp]) {
|
||||
shouldShowDateOnNextViewItem = YES;
|
||||
}
|
||||
|
||||
if (shouldShowDateOnNextViewItem && canShowDate) {
|
||||
shouldShowDate = YES;
|
||||
shouldShowDateOnNextViewItem = NO;
|
||||
} else if (previousViewItemTimestamp > 0
|
||||
&& ![DateUtil isSameDayWithTimestamp:previousViewItemTimestamp timestamp:viewItemTimestamp]) {
|
||||
// Ensure we always have a date break between messages on different days.
|
||||
shouldShowDate = YES;
|
||||
shouldShowDateOnNextViewItem = NO;
|
||||
} else {
|
||||
OWSAssert(previousViewItemTimestamp > 0);
|
||||
uint64_t timeDifferenceMs = viewItemTimestamp - previousViewItemTimestamp;
|
||||
static const uint64_t kShowTimeIntervalMs = 5 * kMinuteInMs;
|
||||
if (timeDifferenceMs > kShowTimeIntervalMs) {
|
||||
shouldShowDate = YES;
|
||||
}
|
||||
shouldShowDateOnNextViewItem = NO;
|
||||
}
|
||||
|
||||
viewItem.shouldShowDate = shouldShowDate;
|
||||
|
|
Loading…
Reference in a new issue