Clean up ahead of PR.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent 5621fe893c
commit b833976b77

@ -217,6 +217,8 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - View State #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 - (NSCache *)displayableTextCache
{ {
static NSCache *cache = nil; static NSCache *cache = nil;
@ -285,7 +287,6 @@ NS_ASSUME_NONNULL_BEGIN
TSMessage *interaction = (TSMessage *)self.interaction; TSMessage *interaction = (TSMessage *)self.interaction;
if (interaction.body.length > 0) { if (interaction.body.length > 0) {
self.messageCellType = OWSMessageCellType_TextMessage; 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]; self.textMessage = [self displayableTextForText:interaction.body interactionId:interaction.uniqueId];
return; return;
} else { } else {
@ -297,7 +298,6 @@ NS_ASSUME_NONNULL_BEGIN
if ([attachment.contentType isEqualToString:OWSMimeTypeOversizeTextMessage]) { if ([attachment.contentType isEqualToString:OWSMimeTypeOversizeTextMessage]) {
self.messageCellType = OWSMessageCellType_OversizeTextMessage; self.messageCellType = OWSMessageCellType_OversizeTextMessage;
// TODO: This can be expensive. Should we cache it on the view item?
self.textMessage = [self displayableTextForAttachmentStream:self.attachmentStream self.textMessage = [self displayableTextForAttachmentStream:self.attachmentStream
interactionId:interaction.uniqueId]; interactionId:interaction.uniqueId];
return; return;

@ -5,6 +5,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, ConversationViewLayoutAlignment) { typedef NS_ENUM(NSInteger, ConversationViewLayoutAlignment) {
// We use incoming/outgoing, not left/right to support RTL.
ConversationViewLayoutAlignment_Incoming, ConversationViewLayoutAlignment_Incoming,
ConversationViewLayoutAlignment_Outgoing, ConversationViewLayoutAlignment_Outgoing,
ConversationViewLayoutAlignment_FullWidth, ConversationViewLayoutAlignment_FullWidth,
@ -29,6 +30,8 @@ typedef NS_ENUM(NSInteger, ConversationViewLayoutAlignment) {
#pragma mark - #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 @interface ConversationViewLayout : UICollectionViewLayout
@property (nonatomic, weak) id<ConversationViewLayoutDelegate> delegate; @property (nonatomic, weak) id<ConversationViewLayoutDelegate> delegate;

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

@ -270,11 +270,6 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
} }
[self updateBarButtonItems]; [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 - (void)updateBarButtonItems

Loading…
Cancel
Save