Respond to CR.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent 03a97cdd70
commit 210802994e

@ -11,8 +11,8 @@ NS_ASSUME_NONNULL_BEGIN
// Cells will request that this adapter clear its cached media views, // Cells will request that this adapter clear its cached media views,
// but the adapter should only honor requests from the last cell to // but the adapter should only honor requests from the last cell to
// use its views. // use its views.
- (void)setLastCell:(nullable id)cell; - (void)setLastPresentingCell:(nullable id)cell;
- (void)clearCachedMediaViewsIfLastCell:(id)cell; - (void)clearCachedMediaViewsIfLastPresentingCell:(id)cell;
@end @end

@ -21,7 +21,9 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic) TSAttachmentStream *attachment; @property (nonatomic) TSAttachmentStream *attachment;
@property (nonatomic, nullable) AttachmentUploadView *attachmentUploadView; @property (nonatomic, nullable) AttachmentUploadView *attachmentUploadView;
@property (nonatomic) BOOL incoming; @property (nonatomic) BOOL incoming;
@property (nonatomic, nullable, weak) id lastCell;
// See comments on OWSMessageMediaAdapter.
@property (nonatomic, nullable, weak) id lastPresentingCell;
@end @end
@ -80,11 +82,11 @@ NS_ASSUME_NONNULL_BEGIN
} }
} }
- (void)clearCachedMediaViewsIfLastCell:(id)cell - (void)clearCachedMediaViewsIfLastPresentingCell:(id)cell
{ {
OWSAssert(cell); OWSAssert(cell);
if (cell == self.lastCell) { if (cell == self.lastPresentingCell) {
[self clearCachedMediaViews]; [self clearCachedMediaViews];
} }
} }

@ -21,7 +21,9 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic) TSAttachmentStream *attachment; @property (nonatomic) TSAttachmentStream *attachment;
@property (nonatomic, nullable) AttachmentUploadView *attachmentUploadView; @property (nonatomic, nullable) AttachmentUploadView *attachmentUploadView;
@property (nonatomic) BOOL incoming; @property (nonatomic) BOOL incoming;
@property (nonatomic, nullable, weak) id lastCell;
// See comments on OWSMessageMediaAdapter.
@property (nonatomic, nullable, weak) id lastPresentingCell;
@end @end
@ -211,11 +213,11 @@ NS_ASSUME_NONNULL_BEGIN
// Ignore. // Ignore.
} }
- (void)clearCachedMediaViewsIfLastCell:(id)cell - (void)clearCachedMediaViewsIfLastPresentingCell:(id)cell
{ {
OWSAssert(cell); OWSAssert(cell);
if (cell == self.lastCell) { if (cell == self.lastPresentingCell) {
[self clearCachedMediaViews]; [self clearCachedMediaViews];
} }
} }

@ -16,7 +16,9 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, nullable) UIImageView *cachedImageView; @property (nonatomic, nullable) UIImageView *cachedImageView;
@property (nonatomic, nullable) AttachmentUploadView *attachmentUploadView; @property (nonatomic, nullable) AttachmentUploadView *attachmentUploadView;
@property (nonatomic) BOOL incoming; @property (nonatomic) BOOL incoming;
@property (nonatomic, nullable, weak) id lastCell;
// See comments on OWSMessageMediaAdapter.
@property (nonatomic, nullable, weak) id lastPresentingCell;
@end @end
@ -146,11 +148,11 @@ NS_ASSUME_NONNULL_BEGIN
// Ignore. // Ignore.
} }
- (void)clearCachedMediaViewsIfLastCell:(id)cell - (void)clearCachedMediaViewsIfLastPresentingCell:(id)cell
{ {
OWSAssert(cell); OWSAssert(cell);
if (cell == self.lastCell) { if (cell == self.lastPresentingCell) {
[self clearCachedMediaViews]; [self clearCachedMediaViews];
} }
} }

@ -30,7 +30,9 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, nullable) AttachmentUploadView *attachmentUploadView; @property (nonatomic, nullable) AttachmentUploadView *attachmentUploadView;
@property (nonatomic) BOOL isAudioPlaying; @property (nonatomic) BOOL isAudioPlaying;
@property (nonatomic) BOOL isPaused; @property (nonatomic) BOOL isPaused;
@property (nonatomic, nullable, weak) id lastCell;
// See comments on OWSMessageMediaAdapter.
@property (nonatomic, nullable, weak) id lastPresentingCell;
@end @end
@ -295,11 +297,11 @@ NS_ASSUME_NONNULL_BEGIN
// Ignore. // Ignore.
} }
- (void)clearCachedMediaViewsIfLastCell:(id)cell - (void)clearCachedMediaViewsIfLastPresentingCell:(id)cell
{ {
OWSAssert(cell); OWSAssert(cell);
if (cell == self.lastCell) { if (cell == self.lastPresentingCell) {
[self clearCachedMediaViews]; [self clearCachedMediaViews];
} }
} }

@ -32,8 +32,8 @@ NS_ASSUME_NONNULL_BEGIN
[self.mediaAdapter setCellVisible:NO]; [self.mediaAdapter setCellVisible:NO];
// Clear this adapter's views IFF this was the last cell to use this adapter. // Clear this adapter's views IFF this was the last cell to use this adapter.
[self.mediaAdapter clearCachedMediaViewsIfLastCell:self]; [self.mediaAdapter clearCachedMediaViewsIfLastPresentingCell:self];
[_mediaAdapter setLastCell:nil]; [_mediaAdapter setLastPresentingCell:nil];
self.mediaAdapter = nil; self.mediaAdapter = nil;
} }
@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
_mediaAdapter = mediaAdapter; _mediaAdapter = mediaAdapter;
// Mark this as the last cell to use this adapter. // Mark this as the last cell to use this adapter.
[_mediaAdapter setLastCell:self]; [_mediaAdapter setLastPresentingCell:self];
} }
// pragma mark - OWSMessageCollectionViewCell // pragma mark - OWSMessageCollectionViewCell

@ -33,8 +33,8 @@ NS_ASSUME_NONNULL_BEGIN
[self.mediaAdapter setCellVisible:NO]; [self.mediaAdapter setCellVisible:NO];
// Clear this adapter's views IFF this was the last cell to use this adapter. // Clear this adapter's views IFF this was the last cell to use this adapter.
[self.mediaAdapter clearCachedMediaViewsIfLastCell:self]; [self.mediaAdapter clearCachedMediaViewsIfLastPresentingCell:self];
[_mediaAdapter setLastCell:nil]; [_mediaAdapter setLastPresentingCell:nil];
self.mediaAdapter = nil; self.mediaAdapter = nil;
} }
@ -44,7 +44,7 @@ NS_ASSUME_NONNULL_BEGIN
_mediaAdapter = mediaAdapter; _mediaAdapter = mediaAdapter;
// Mark this as the last cell to use this adapter. // Mark this as the last cell to use this adapter.
[_mediaAdapter setLastCell:self]; [_mediaAdapter setLastPresentingCell:self];
} }
// pragma mark - OWSMessageCollectionViewCell // pragma mark - OWSMessageCollectionViewCell

Loading…
Cancel
Save