From a16197f193f27ff1c2c6b83931e0d162ba98b225 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Mon, 23 Oct 2017 17:30:03 -0400 Subject: [PATCH] Respond to CR. // FREEBIE --- .../ConversationView/ConversationCollectionView.m | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationCollectionView.m b/Signal/src/ViewControllers/ConversationView/ConversationCollectionView.m index 8d823c056..dd73aa288 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationCollectionView.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationCollectionView.m @@ -15,6 +15,13 @@ NS_ASSUME_NONNULL_BEGIN if (frame.size.width == 0 || frame.size.height == 0) { // Ignore iOS Auto Layout's tendency to temporarily zero out the // frame of this view during the layout process. + // + // The conversation view has an invariant that the collection view + // should always have a "reasonable" (correct width, non-zero height) + // size. This lets us manipulate scroll state at all times, especially + // before the view has been presented for the first time. This + // invariant also saves us from needing all sorts of ugly and incomplete + // hacks in the conversation view's code. return; } BOOL isChanging = !CGSizeEqualToSize(frame.size, self.frame.size); @@ -32,6 +39,13 @@ NS_ASSUME_NONNULL_BEGIN if (bounds.size.width == 0 || bounds.size.height == 0) { // Ignore iOS Auto Layout's tendency to temporarily zero out the // frame of this view during the layout process. + // + // The conversation view has an invariant that the collection view + // should always have a "reasonable" (correct width, non-zero height) + // size. This lets us manipulate scroll state at all times, especially + // before the view has been presented for the first time. This + // invariant also saves us from needing all sorts of ugly and incomplete + // hacks in the conversation view's code. return; } BOOL isChanging = !CGSizeEqualToSize(bounds.size, self.bounds.size);