Allow building with the macOS 10.14 SDK

This does mean that NSRelativeDateTimeFormatter is not used, even when running on macOS 10.15.
This commit is contained in:
Allan Odgaard
2020-05-14 15:47:01 +07:00
parent fb165589c3
commit 0a04a77a89

View File

@@ -56,8 +56,10 @@ static NSUserInterfaceItemIdentifier const kTableColumnIdentifierDescription = @
if(NSDate* date = [NSUserDefaults.standardUserDefaults objectForKey:kUserDefaultsLastBundleUpdateCheckKey])
{
NSString* dateString = [NSDateFormatter localizedStringFromDate:date dateStyle:NSDateFormatterShortStyle timeStyle:NSDateFormatterShortStyle];
#if defined(MAC_OS_X_VERSION_10_15) && (MAC_OS_X_VERSION_10_15 <= MAC_OS_X_VERSION_MAX_ALLOWED)
if(@available(macos 10.15, *))
dateString = -[date timeIntervalSinceNow] < 5 ? @"Just now" : [[[NSRelativeDateTimeFormatter alloc] init] localizedStringForDate:date relativeToDate:NSDate.now];
#endif
return [NSString stringWithFormat:@"Bundle index last updated: %@", dateString];
}