Clean up ahead of PR.

// FREEBIE
This commit is contained in:
Matthew Chen 2017-10-11 09:58:20 -04:00
parent 5621fe893c
commit b833976b77
4 changed files with 10 additions and 12 deletions

View File

@ -217,6 +217,8 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - View State
// TODO: Now that we're caching the displayable text on the view items,
// I don't think we need this cache any more.
- (NSCache *)displayableTextCache
{
static NSCache *cache = nil;
@ -285,7 +287,6 @@ NS_ASSUME_NONNULL_BEGIN
TSMessage *interaction = (TSMessage *)self.interaction;
if (interaction.body.length > 0) {
self.messageCellType = OWSMessageCellType_TextMessage;
// TODO: This can be expensive. Should we cache it on the view item?
self.textMessage = [self displayableTextForText:interaction.body interactionId:interaction.uniqueId];
return;
} else {
@ -297,7 +298,6 @@ NS_ASSUME_NONNULL_BEGIN
if ([attachment.contentType isEqualToString:OWSMimeTypeOversizeTextMessage]) {
self.messageCellType = OWSMessageCellType_OversizeTextMessage;
// TODO: This can be expensive. Should we cache it on the view item?
self.textMessage = [self displayableTextForAttachmentStream:self.attachmentStream
interactionId:interaction.uniqueId];
return;

View File

@ -5,6 +5,7 @@
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, ConversationViewLayoutAlignment) {
// We use incoming/outgoing, not left/right to support RTL.
ConversationViewLayoutAlignment_Incoming,
ConversationViewLayoutAlignment_Outgoing,
ConversationViewLayoutAlignment_FullWidth,
@ -29,6 +30,8 @@ typedef NS_ENUM(NSInteger, ConversationViewLayoutAlignment) {
#pragma mark -
// A new lean and efficient layout for conversation view designed to
// handle our edge cases (e.g. full-width unread indicators, etc.).
@interface ConversationViewLayout : UICollectionViewLayout
@property (nonatomic, weak) id<ConversationViewLayoutDelegate> delegate;

View File

@ -12,11 +12,11 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic) CGSize contentSize;
@property (nonatomic, readonly) NSMutableDictionary<NSNumber *, UICollectionViewLayoutAttributes *> *itemAttributesMap;
// This may be redundant with logic in UICollectionViewLayout, but
// it can't hurt and it ensures that we can safely & cheaply call
// prepareLayout from view logic to ensure that we always have a
// valid layout without incurring any of the (great) expense of
// performing an unnecessary layout pass.
// This dirty flag may be redundant with logic in UICollectionViewLayout,
// but it can't hurt and it ensures that we can safely & cheaply call
// prepareLayout from view logic to ensure that we always have a¸valid
// layout without incurring any of the (great) expense of performing an
// unnecessary layout pass.
@property (nonatomic) BOOL hasLayout;
@end

View File

@ -270,11 +270,6 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
}
[self updateBarButtonItems];
dispatch_async(dispatch_get_main_queue(), ^{
TSThread *thread = [self threadForIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
[self presentThread:thread keyboardOnViewAppearing:NO callOnViewAppearing:NO];
});
}
- (void)updateBarButtonItems