From 8da47b64d9c9f88b2f92f27ae99ff7813095cdbe Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Fri, 13 Jul 2018 16:26:58 -0600 Subject: [PATCH] clarify different methods These method names were too similar to existing methods in PureLayout, which have slightly different behavior. ows_autoPinToSuperviewEdges uses left/right, whereas PureLayouts uses leading/trailing ows_autoPinToSuperviewMargins uses our own constraint adding logic, which behaves differently in some cases. --- .../AppSettings/OWSQRCodeScanningViewController.m | 2 +- .../ConversationView/Cells/OWSContactShareButtonsView.m | 2 +- .../ConversationView/Cells/OWSContactShareView.m | 2 +- .../ConversationView/Cells/OWSMessageBubbleView.m | 8 ++++---- .../ConversationView/Cells/OWSMessageTimerView.m | 2 +- .../ConversationView/Cells/OWSQuotedMessageView.m | 2 +- .../ConversationView/ConversationInputToolbar.m | 4 ++-- Signal/src/ViewControllers/GifPicker/GifPickerCell.swift | 2 +- Signal/src/ViewControllers/MediaDetailViewController.m | 2 +- .../src/ViewControllers/MenuActionsViewController.swift | 4 ++-- .../ThreadSettings/FingerprintViewController.m | 2 +- Signal/src/views/ReminderView.swift | 2 +- SignalMessaging/Views/OWSFlatButton.swift | 2 +- SignalMessaging/attachments/VideoPlayerView.swift | 2 +- SignalMessaging/categories/UIView+OWS.h | 4 ++-- SignalMessaging/categories/UIView+OWS.m | 4 ++-- 16 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Signal/src/ViewControllers/AppSettings/OWSQRCodeScanningViewController.m b/Signal/src/ViewControllers/AppSettings/OWSQRCodeScanningViewController.m index 4cd7ba3e9..8d6df66f1 100644 --- a/Signal/src/ViewControllers/AppSettings/OWSQRCodeScanningViewController.m +++ b/Signal/src/ViewControllers/AppSettings/OWSQRCodeScanningViewController.m @@ -75,7 +75,7 @@ NS_ASSUME_NONNULL_BEGIN layer.opacity = 0.5f; }]; [self.view addSubview:maskingView]; - [maskingView autoPinToSuperviewEdges]; + [maskingView ows_autoPinToSuperviewEdges]; } - (void)viewWillAppear:(BOOL)animated diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareButtonsView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareButtonsView.m index d610189d9..bd6a71808 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareButtonsView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareButtonsView.m @@ -132,7 +132,7 @@ NS_ASSUME_NONNULL_BEGIN label.textColor = UIColor.ows_materialBlueColor; label.textAlignment = NSTextAlignmentCenter; [self addSubview:label]; - [label autoPinToSuperviewEdges]; + [label ows_autoPinToSuperviewEdges]; [label autoSetDimension:ALDimensionHeight toSize:OWSContactShareButtonsView.buttonHeight]; self.userInteractionEnabled = YES; diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.m index a51bc035d..077722987 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.m @@ -157,7 +157,7 @@ NS_ASSUME_NONNULL_BEGIN [hStackView addArrangedSubview:labelsView]; [hStackView addArrangedSubview:disclosureImageView]; [self addSubview:hStackView]; - [hStackView autoPinToSuperviewEdges]; + [hStackView ows_autoPinToSuperviewEdges]; } @end diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m index 17fa9c618..ff99305ae 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m @@ -363,7 +363,7 @@ NS_ASSUME_NONNULL_BEGIN [self.viewConstraints addObjectsFromArray:[clipView autoPinToEdgesOfView:proxyView]]; [clipView addSubview:bodyMediaView]; - [self.viewConstraints addObjectsFromArray:[bodyMediaView autoPinToSuperviewEdges]]; + [self.viewConstraints addObjectsFromArray:[bodyMediaView ows_autoPinToSuperviewEdges]]; [self.bubbleView addPartnerView:shadowView1]; [self.bubbleView addPartnerView:shadowView2]; @@ -447,7 +447,7 @@ NS_ASSUME_NONNULL_BEGIN }]; [gradientView.layer addSublayer:gradientLayer]; [bodyMediaView addSubview:gradientView]; - [self.viewConstraints addObjectsFromArray:[gradientView autoPinToSuperviewEdges]]; + [self.viewConstraints addObjectsFromArray:[gradientView ows_autoPinToSuperviewEdges]]; [self.footerView configureWithConversationViewItem:self.viewItem isOverlayingMedia:YES @@ -528,7 +528,7 @@ NS_ASSUME_NONNULL_BEGIN [self.viewConstraints addObjectsFromArray:[clipView autoPinToEdgesOfView:proxyView]]; [clipView addSubview:buttonsView]; - [self.viewConstraints addObjectsFromArray:[buttonsView autoPinToSuperviewEdges]]; + [self.viewConstraints addObjectsFromArray:[buttonsView ows_autoPinToSuperviewEdges]]; [self.bubbleView addPartnerView:shadowView]; [self.bubbleView addPartnerView:clipView]; @@ -1091,7 +1091,7 @@ NS_ASSUME_NONNULL_BEGIN [[AttachmentUploadView alloc] initWithAttachment:self.attachmentStream attachmentStateCallback:attachmentStateCallback]; [self.bubbleView addSubview:attachmentUploadView]; - [attachmentUploadView autoPinToSuperviewEdges]; + [attachmentUploadView ows_autoPinToSuperviewEdges]; } } } diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageTimerView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageTimerView.m index ed7096193..5a8fc48fc 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageTimerView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageTimerView.m @@ -56,7 +56,7 @@ const CGFloat kDisappearingMessageIconSize = 12.f; { self.imageView = [UIImageView new]; [self addSubview:self.imageView]; - [self.imageView autoPinToSuperviewEdges]; + [self.imageView ows_autoPinToSuperviewEdges]; [self.imageView autoSetDimension:ALDimensionWidth toSize:kDisappearingMessageIconSize]; [self.imageView autoSetDimension:ALDimensionHeight toSize:kDisappearingMessageIconSize]; } diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m index 1f65657ab..1c4038a8b 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m @@ -190,7 +190,7 @@ NS_ASSUME_NONNULL_BEGIN hStackView.axis = UILayoutConstraintAxisHorizontal; hStackView.spacing = self.hSpacing; [innerBubbleView addSubview:hStackView]; - [hStackView autoPinToSuperviewEdges]; + [hStackView ows_autoPinToSuperviewEdges]; UIView *stripeView = [UIView new]; stripeView.backgroundColor = [self.conversationStyle quotedReplyStripeColorWithIsIncoming:!self.isOutgoing]; diff --git a/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m b/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m index 9b31d413f..aeb2a92c6 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m @@ -248,7 +248,7 @@ const CGFloat kMaxTextViewHeight = 98; UIView *wrapper = [UIView containerView]; wrapper.layoutMargins = UIEdgeInsetsMake(self.quotedMessageTopMargin, 0, 0, 0); [wrapper addSubview:quotedMessagePreview]; - [quotedMessagePreview autoPinToSuperviewMargins]; + [quotedMessagePreview ows_autoPinToSuperviewMargins]; [self.contentRows insertArrangedSubview:wrapper atIndex:0]; @@ -386,7 +386,7 @@ const CGFloat kMaxTextViewHeight = 98; self.voiceMemoContentView = [UIView new]; [self.voiceMemoUI addSubview:self.voiceMemoContentView]; - [self.voiceMemoContentView autoPinToSuperviewEdges]; + [self.voiceMemoContentView ows_autoPinToSuperviewEdges]; self.recordingLabel = [UILabel new]; self.recordingLabel.textColor = [UIColor ows_destructiveRedColor]; diff --git a/Signal/src/ViewControllers/GifPicker/GifPickerCell.swift b/Signal/src/ViewControllers/GifPicker/GifPickerCell.swift index 0dc4c3ee7..6f2e44ae3 100644 --- a/Signal/src/ViewControllers/GifPicker/GifPickerCell.swift +++ b/Signal/src/ViewControllers/GifPicker/GifPickerCell.swift @@ -206,7 +206,7 @@ class GifPickerCell: UICollectionViewCell { let imageView = YYAnimatedImageView() self.imageView = imageView self.contentView.addSubview(imageView) - imageView.autoPinToSuperviewEdges() + imageView.ows_autoPinToSuperviewEdges() } guard let imageView = imageView else { owsFail("\(TAG) missing imageview.") diff --git a/Signal/src/ViewControllers/MediaDetailViewController.m b/Signal/src/ViewControllers/MediaDetailViewController.m index e96f88a85..24fb2baa6 100644 --- a/Signal/src/ViewControllers/MediaDetailViewController.m +++ b/Signal/src/ViewControllers/MediaDetailViewController.m @@ -180,7 +180,7 @@ NS_ASSUME_NONNULL_BEGIN self.automaticallyAdjustsScrollViewInsets = NO; } - [scrollView autoPinToSuperviewEdges]; + [scrollView ows_autoPinToSuperviewEdges]; if (self.isAnimated) { if (self.attachmentStream.isValidImage) { diff --git a/Signal/src/ViewControllers/MenuActionsViewController.swift b/Signal/src/ViewControllers/MenuActionsViewController.swift index c4ad64f60..758009ee4 100644 --- a/Signal/src/ViewControllers/MenuActionsViewController.swift +++ b/Signal/src/ViewControllers/MenuActionsViewController.swift @@ -293,7 +293,7 @@ class MenuActionSheetView: UIView, MenuActionViewDelegate { backgroundColor = UIColor.ows_light10 addSubview(actionStackView) - actionStackView.autoPinToSuperviewEdges() + actionStackView.ows_autoPinToSuperviewEdges() self.clipsToBounds = true @@ -378,7 +378,7 @@ class MenuActionView: UIButton { contentRow.isUserInteractionEnabled = false self.addSubview(contentRow) - contentRow.autoPinToSuperviewMargins() + contentRow.ows_autoPinToSuperviewMargins() contentRow.autoSetDimension(.height, toSize: 56, relation: .greaterThanOrEqual) self.addTarget(self, action: #selector(didPress(sender:)), for: .touchUpInside) diff --git a/Signal/src/ViewControllers/ThreadSettings/FingerprintViewController.m b/Signal/src/ViewControllers/ThreadSettings/FingerprintViewController.m index 80cf20b1d..f202bee29 100644 --- a/Signal/src/ViewControllers/ThreadSettings/FingerprintViewController.m +++ b/Signal/src/ViewControllers/ThreadSettings/FingerprintViewController.m @@ -289,7 +289,7 @@ typedef void (^CustomLayoutBlock)(void); layer.path = [UIBezierPath bezierPathWithOvalInRect:circle].CGPath; }]; [fingerprintView addSubview:fingerprintCircle]; - [fingerprintCircle autoPinToSuperviewEdges]; + [fingerprintCircle ows_autoPinToSuperviewEdges]; UIImageView *fingerprintImageView = [UIImageView new]; fingerprintImageView.image = self.fingerprint.image; diff --git a/Signal/src/views/ReminderView.swift b/Signal/src/views/ReminderView.swift index c84c3bb44..5b8e4201f 100644 --- a/Signal/src/views/ReminderView.swift +++ b/Signal/src/views/ReminderView.swift @@ -80,7 +80,7 @@ class ReminderView: UIView { self.addSubview(container) container.layoutMargins = UIEdgeInsets(top: 12, left: 16, bottom: 12, right: 16) - container.autoPinToSuperviewEdges() + container.ows_autoPinToSuperviewEdges() // Label label.font = UIFont.ows_dynamicTypeSubheadline diff --git a/SignalMessaging/Views/OWSFlatButton.swift b/SignalMessaging/Views/OWSFlatButton.swift index f3e65715a..12ed64e51 100644 --- a/SignalMessaging/Views/OWSFlatButton.swift +++ b/SignalMessaging/Views/OWSFlatButton.swift @@ -41,7 +41,7 @@ public class OWSFlatButton: UIView { private func createContent() { self.addSubview(button) button.addTarget(self, action: #selector(buttonPressed), for: .touchUpInside) - button.autoPinToSuperviewEdges() + button.ows_autoPinToSuperviewEdges() } @objc diff --git a/SignalMessaging/attachments/VideoPlayerView.swift b/SignalMessaging/attachments/VideoPlayerView.swift index 187802617..c59aa5564 100644 --- a/SignalMessaging/attachments/VideoPlayerView.swift +++ b/SignalMessaging/attachments/VideoPlayerView.swift @@ -109,7 +109,7 @@ public class PlayerProgressBar: UIView { backgroundColor = UIColor.lightGray.withAlphaComponent(0.5) if !UIAccessibilityIsReduceTransparencyEnabled() { addSubview(blurEffectView) - blurEffectView.autoPinToSuperviewEdges() + blurEffectView.ows_autoPinToSuperviewEdges() } // Configure controls diff --git a/SignalMessaging/categories/UIView+OWS.h b/SignalMessaging/categories/UIView+OWS.h index 1206a2e7b..59f27e268 100644 --- a/SignalMessaging/categories/UIView+OWS.h +++ b/SignalMessaging/categories/UIView+OWS.h @@ -27,8 +27,8 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value); - (NSArray *)autoPinHeightToSuperviewWithMargin:(CGFloat)margin; - (NSArray *)autoPinHeightToSuperview; -- (NSArray *)autoPinToSuperviewEdges; -- (NSArray *)autoPinToSuperviewMargins; +- (NSArray *)ows_autoPinToSuperviewEdges; +- (NSArray *)ows_autoPinToSuperviewMargins; - (NSLayoutConstraint *)autoHCenterInSuperview; - (NSLayoutConstraint *)autoVCenterInSuperview; diff --git a/SignalMessaging/categories/UIView+OWS.m b/SignalMessaging/categories/UIView+OWS.m index 5fa542ce9..067e37810 100644 --- a/SignalMessaging/categories/UIView+OWS.m +++ b/SignalMessaging/categories/UIView+OWS.m @@ -79,7 +79,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value) return result; } -- (NSArray *)autoPinToSuperviewEdges +- (NSArray *)ows_autoPinToSuperviewEdges { NSArray *result = @[ [self autoPinEdgeToSuperviewEdge:ALEdgeLeft], @@ -90,7 +90,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value) return result; } -- (NSArray *)autoPinToSuperviewMargins +- (NSArray *)ows_autoPinToSuperviewMargins { NSArray *result = @[ [self autoPinTopToSuperviewMargin],