Signal-iOS/SignalMessaging/utils/DateUtil.h
Jordan Rose 0a982ebc83 Include timestamp in missed call notifications
...if the call was more than five minutes ago. This should help in two
scenarios:

- you've been offline for a while, and you see "missed call" but don't
  know when they tried to call

- you hit that NSE bug where a ring gets processed hours or even days
  later, possibly when a second call arrives
2022-04-05 10:48:05 -07:00

39 lines
1.2 KiB
Objective-C

//
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
//
NS_ASSUME_NONNULL_BEGIN
@interface DateUtil : NSObject
+ (NSDateFormatter *)dateFormatter;
+ (NSDateFormatter *)monthAndDayFormatter;
+ (NSDateFormatter *)shortDayOfWeekFormatter;
+ (NSDateFormatter *)weekdayFormatter;
+ (BOOL)dateIsOlderThanToday:(NSDate *)date;
+ (BOOL)dateIsOlderThanOneWeek:(NSDate *)date;
+ (BOOL)dateIsToday:(NSDate *)date;
+ (BOOL)dateIsThisYear:(NSDate *)date;
+ (BOOL)dateIsYesterday:(NSDate *)date;
+ (NSString *)formatPastTimestampRelativeToNow:(uint64_t)pastTimestamp
NS_SWIFT_NAME(formatPastTimestampRelativeToNow(_:));
+ (NSString *)formatTimestampShort:(uint64_t)timestamp;
+ (NSString *)formatDateShort:(NSDate *)date;
+ (NSString *)formatTimestampAsTime:(uint64_t)timestamp NS_SWIFT_NAME(formatTimestampAsTime(_:));
+ (NSString *)formatDateAsTime:(NSDate *)date NS_SWIFT_NAME(formatDateAsTime(_:));
+ (NSString *)formatTimestampAsDate:(uint64_t)timestamp NS_SWIFT_NAME(formatTimestampAsDate(_:));
+ (NSString *)formatDateAsDate:(NSDate *)date NS_SWIFT_NAME(formatDateAsDate(_:));
+ (BOOL)isTimestampFromLastHour:(uint64_t)timestamp NS_SWIFT_NAME(isTimestampFromLastHour(_:));
+ (BOOL)dateIsOlderThanYesterday:(NSDate *)date;
@end
NS_ASSUME_NONNULL_END