From 5e71f3130b3e8d2e2ce0117c802e36820a06ce61 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Mon, 9 Jul 2018 16:39:48 -0400 Subject: [PATCH] Respond to CR. --- Signal/src/util/DateUtil.h | 2 ++ Signal/src/util/DateUtil.m | 1 + SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Signal/src/util/DateUtil.h b/Signal/src/util/DateUtil.h index ac2c13f96..3a5974a21 100644 --- a/Signal/src/util/DateUtil.h +++ b/Signal/src/util/DateUtil.h @@ -29,6 +29,8 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *)formatMessageTimestamp:(uint64_t)timestamp; + (BOOL)isTimestampFromLastHour:(uint64_t)timestamp; +// These two "exemplary" values can be used by views to measure +// the likely size for recent values formatted using isTimestampFromLastHour:. + (NSString *)exemplaryNowTimeFormat; + (NSString *)exemplaryMinutesTimeFormat; diff --git a/Signal/src/util/DateUtil.m b/Signal/src/util/DateUtil.m index 2c92f1c2d..bda7dcaec 100644 --- a/Signal/src/util/DateUtil.m +++ b/Signal/src/util/DateUtil.m @@ -263,6 +263,7 @@ static NSString *const DATE_FORMAT_WEEKDAY = @"EEEE"; NSCalendar *calendar = [NSCalendar currentCalendar]; + // Note: we are careful to treat "future" dates as "now". NSInteger yearsDiff = [self yearsFromFirstDate:date toSecondDate:nowDate]; NSInteger daysDiff = [self daysFromFirstDate:date toSecondDate:nowDate]; NSInteger minutesDiff diff --git a/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m b/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m index eec26fb63..a42666d52 100644 --- a/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m +++ b/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m @@ -469,7 +469,7 @@ NS_ASSUME_NONNULL_BEGIN } if (result == nil) { - DDLogError(@"%@ Unable to build thumbnail for attachmentId: %@", self.logTag, self.uniqueId); + OWSFail(@"%@ Unable to build thumbnail for attachmentId: %@", self.logTag, self.uniqueId); return; }