CR: remove "k" from non constant

// FREEBIE
pull/1/head
Michael Kirk 7 years ago
parent 999b0f0f9c
commit d9a2effff6

@ -10,6 +10,7 @@
#import <AxolotlKit/PreKeyBundle.h> #import <AxolotlKit/PreKeyBundle.h>
#import <Curve25519Kit/Randomness.h> #import <Curve25519Kit/Randomness.h>
#import <SignalMessaging/Environment.h> #import <SignalMessaging/Environment.h>
#import <SignalServiceKit/NSDate+OWS.h>
#import <SignalServiceKit/OWSBatchMessageProcessor.h> #import <SignalServiceKit/OWSBatchMessageProcessor.h>
#import <SignalServiceKit/OWSDisappearingConfigurationUpdateInfoMessage.h> #import <SignalServiceKit/OWSDisappearingConfigurationUpdateInfoMessage.h>
#import <SignalServiceKit/OWSDisappearingMessagesConfiguration.h> #import <SignalServiceKit/OWSDisappearingMessagesConfiguration.h>
@ -1200,7 +1201,7 @@ NS_ASSUME_NONNULL_BEGIN
for (NSUInteger i = 0; i < counter; i++) { for (NSUInteger i = 0; i < counter; i++) {
// Random time within last n years. Helpful for filling out a media gallery over time. // Random time within last n years. Helpful for filling out a media gallery over time.
double yearsMillis = 4.0 * 365.0 * 24.0 * 60.0 * 60.0 * 1000.0; double yearsMillis = 4.0 * kYearsInMillis;
uint64_t millisAgo = (uint64_t)(((double)arc4random() / ((double)0xffffffff)) * yearsMillis); uint64_t millisAgo = (uint64_t)(((double)arc4random() / ((double)0xffffffff)) * yearsMillis);
uint64_t timestamp = [NSDate ows_millisecondTimeStamp] - millisAgo; uint64_t timestamp = [NSDate ows_millisecondTimeStamp] - millisAgo;

@ -155,7 +155,7 @@ public class MediaTileViewController: UICollectionViewController, MediaGalleryCe
return 0 return 0
} }
if sectionIdx == kLoadNewerSectionIdx { if sectionIdx == loadNewerSectionIdx {
// load more recent // load more recent
return 0 return 0
} }
@ -187,7 +187,7 @@ public class MediaTileViewController: UICollectionViewController, MediaGalleryCe
let title = NSLocalizedString("GALLERY_TILES_LOADING_OLDER_LABEL", comment: "Label indicating loading is in progress") let title = NSLocalizedString("GALLERY_TILES_LOADING_OLDER_LABEL", comment: "Label indicating loading is in progress")
sectionHeader.configure(title: title) sectionHeader.configure(title: title)
return sectionHeader return sectionHeader
case kLoadNewerSectionIdx: case loadNewerSectionIdx:
guard let sectionHeader = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: MediaGalleryLoadingHeader.reuseIdentifier, for: indexPath) as? MediaGalleryLoadingHeader else { guard let sectionHeader = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: MediaGalleryLoadingHeader.reuseIdentifier, for: indexPath) as? MediaGalleryLoadingHeader else {
owsFail("\(logTag) in \(#function) unable to build section header for kLoadOlderSectionIdx") owsFail("\(logTag) in \(#function) unable to build section header for kLoadOlderSectionIdx")
@ -223,8 +223,8 @@ public class MediaTileViewController: UICollectionViewController, MediaGalleryCe
case kLoadOlderSectionIdx: case kLoadOlderSectionIdx:
owsFail("\(logTag) in \(#function) unexpected cell for kLoadOlderSectionIdx") owsFail("\(logTag) in \(#function) unexpected cell for kLoadOlderSectionIdx")
return defaultCell return defaultCell
case kLoadNewerSectionIdx: case loadNewerSectionIdx:
owsFail("\(logTag) in \(#function) unexpected cell for kLoadNewerSectionIdx") owsFail("\(logTag) in \(#function) unexpected cell for loadNewerSectionIdx")
return defaultCell return defaultCell
default: default:
guard let sectionDate = self.galleryDates[safe: indexPath.section - 1] else { guard let sectionDate = self.galleryDates[safe: indexPath.section - 1] else {
@ -269,7 +269,7 @@ public class MediaTileViewController: UICollectionViewController, MediaGalleryCe
return CGSize.zero return CGSize.zero
} }
return mediaGalleryDataSource.hasFetchedOldest ? CGSize.zero : CGSize(width: 0, height: 100) return mediaGalleryDataSource.hasFetchedOldest ? CGSize.zero : CGSize(width: 0, height: 100)
case kLoadNewerSectionIdx: case loadNewerSectionIdx:
// Show "loading newer..." iff there is still more recent data to be fetched // Show "loading newer..." iff there is still more recent data to be fetched
guard let mediaGalleryDataSource = self.mediaGalleryDataSource else { guard let mediaGalleryDataSource = self.mediaGalleryDataSource else {
owsFail("\(logTag) in \(#function) mediaGalleryDataSource was unexpectedly nil") owsFail("\(logTag) in \(#function) mediaGalleryDataSource was unexpectedly nil")
@ -311,7 +311,7 @@ public class MediaTileViewController: UICollectionViewController, MediaGalleryCe
var isFetchingMoreData: Bool = false var isFetchingMoreData: Bool = false
let kLoadOlderSectionIdx = 0 let kLoadOlderSectionIdx = 0
var kLoadNewerSectionIdx: Int { var loadNewerSectionIdx: Int {
return galleryDates.count + 1 return galleryDates.count + 1
} }

@ -17,6 +17,7 @@ extern const NSTimeInterval kMonthInterval;
#define kDayInMs (kHourInMs * 24) #define kDayInMs (kHourInMs * 24)
#define kWeekInMs (kDayInMs * 7) #define kWeekInMs (kDayInMs * 7)
#define kMonthInMs (kDayInMs * 30) #define kMonthInMs (kDayInMs * 30)
#define kYearsInMs (kDayInMs * 365)
@interface NSDate (OWS) @interface NSDate (OWS)

Loading…
Cancel
Save