diff --git a/Signal/src/ViewControllers/CodeVerificationViewController.m b/Signal/src/ViewControllers/CodeVerificationViewController.m index b417bc97c..de51033bc 100644 --- a/Signal/src/ViewControllers/CodeVerificationViewController.m +++ b/Signal/src/ViewControllers/CodeVerificationViewController.m @@ -117,7 +117,7 @@ NS_ASSUME_NONNULL_BEGIN forState:UIControlStateNormal]; backButton.titleLabel.font = [UIFont ows_mediumFontWithSize:14.f]; [header addSubview:backButton]; - [backButton autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:10]; + [backButton autoPinLeadingToSuperViewWithMargin:10.f]; [backButton autoAlignAxis:ALAxisHorizontal toSameAxisOfView:titleLabel]; [backButton addTarget:self action:@selector(backButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; diff --git a/Signal/src/ViewControllers/ConversationView/MessagesViewController.m b/Signal/src/ViewControllers/ConversationView/MessagesViewController.m index 76cffb563..5101f7e89 100644 --- a/Signal/src/ViewControllers/ConversationView/MessagesViewController.m +++ b/Signal/src/ViewControllers/ConversationView/MessagesViewController.m @@ -771,7 +771,7 @@ typedef enum : NSUInteger { OWSAssert(title.length > 0); OWSAssert(bannerColor); - UIView *bannerView = [UIView new]; + UIView *bannerView = [UIView containerView]; bannerView.backgroundColor = bannerColor; bannerView.layer.cornerRadius = 2.5f; @@ -794,7 +794,7 @@ typedef enum : NSUInteger { [bannerView addSubview:closeButton]; const CGFloat kBannerCloseButtonPadding = 8.f; [closeButton autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:kBannerCloseButtonPadding]; - [closeButton autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:kBannerCloseButtonPadding]; + [closeButton autoPinTrailingToSuperViewWithMargin:kBannerCloseButtonPadding]; [closeButton autoSetDimension:ALDimensionWidth toSize:closeIcon.size.width]; [closeButton autoSetDimension:ALDimensionHeight toSize:closeIcon.size.height]; @@ -802,9 +802,9 @@ typedef enum : NSUInteger { [label autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:5]; [label autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:5]; const CGFloat kBannerHPadding = 15.f; - [label autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:kBannerHPadding]; + [label autoPinLeadingToSuperViewWithMargin:kBannerHPadding]; const CGFloat kBannerHSpacing = 10.f; - [label autoPinEdge:ALEdgeRight toEdge:ALEdgeLeft ofView:closeButton withOffset:-kBannerHSpacing]; + [closeButton autoPinLeadingToTrailingOfView:label margin:kBannerHSpacing]; [bannerView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:tapSelector]]; @@ -1081,7 +1081,7 @@ typedef enum : NSUInteger { [backItem.customView addSubview:_backButtonUnreadCountView]; // TODO: [_backButtonUnreadCountView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:-6]; - [_backButtonUnreadCountView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:1]; + [_backButtonUnreadCountView autoPinLeadingToSuperViewWithMargin:1]; [_backButtonUnreadCountView autoSetDimension:ALDimensionHeight toSize:unreadCountViewDiameter]; // We set a min width, but we will also pin to our subview label, so we can grow to accommodate multiple digits. [_backButtonUnreadCountView autoSetDimension:ALDimensionWidth diff --git a/Signal/src/ViewControllers/ConversationView/OWSMessagesInputToolbar.m b/Signal/src/ViewControllers/ConversationView/OWSMessagesInputToolbar.m index 0ef379d0c..85b51ce91 100644 --- a/Signal/src/ViewControllers/ConversationView/OWSMessagesInputToolbar.m +++ b/Signal/src/ViewControllers/ConversationView/OWSMessagesInputToolbar.m @@ -81,9 +81,18 @@ NS_ASSUME_NONNULL_BEGIN NSMutableAttributedString *cancelString = [NSMutableAttributedString new]; const CGFloat cancelArrowFontSize = ScaleFromIPhone5To7Plus(18.4, 20.f); const CGFloat cancelFontSize = ScaleFromIPhone5To7Plus(14.f, 16.f); + NSString *arrowHead = (self.isRTL ? @"\uf105" : @"\uf104"); [cancelString appendAttributedString:[[NSAttributedString alloc] - initWithString:@"\uf104 " + initWithString:arrowHead + attributes:@{ + NSFontAttributeName : [UIFont ows_fontAwesomeFont:cancelArrowFontSize], + NSForegroundColorAttributeName : [UIColor ows_destructiveRedColor], + NSBaselineOffsetAttributeName : @(-1.f), + }]]; + [cancelString + appendAttributedString:[[NSAttributedString alloc] + initWithString:@" " attributes:@{ NSFontAttributeName : [UIFont ows_fontAwesomeFont:cancelArrowFontSize], NSForegroundColorAttributeName : [UIColor ows_destructiveRedColor], @@ -99,7 +108,15 @@ NS_ASSUME_NONNULL_BEGIN }]]; [cancelString appendAttributedString:[[NSAttributedString alloc] - initWithString:@" \uf104" + initWithString:@" " + attributes:@{ + NSFontAttributeName : [UIFont ows_fontAwesomeFont:cancelArrowFontSize], + NSForegroundColorAttributeName : [UIColor ows_destructiveRedColor], + NSBaselineOffsetAttributeName : @(-1.f), + }]]; + [cancelString + appendAttributedString:[[NSAttributedString alloc] + initWithString:arrowHead attributes:@{ NSFontAttributeName : [UIFont ows_fontAwesomeFont:cancelArrowFontSize], NSForegroundColorAttributeName : [UIColor ows_destructiveRedColor], @@ -126,9 +143,9 @@ NS_ASSUME_NONNULL_BEGIN [whiteIconView autoCenterInSuperview]; [imageView autoVCenterInSuperview]; - [imageView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:10]; + [imageView autoPinLeadingToSuperViewWithMargin:10.f]; [self.recordingLabel autoVCenterInSuperview]; - [self.recordingLabel autoPinEdge:ALEdgeLeft toEdge:ALEdgeRight ofView:imageView withOffset:5.f]; + [self.recordingLabel autoPinLeadingToTrailingOfView:imageView margin:5.f]; [cancelLabel autoVCenterInSuperview]; [cancelLabel autoHCenterInSuperview]; [self.voiceMemoUI setNeedsLayout]; @@ -137,7 +154,8 @@ NS_ASSUME_NONNULL_BEGIN // Slide in the "slide to cancel" label. CGRect cancelLabelStartFrame = cancelLabel.frame; CGRect cancelLabelEndFrame = cancelLabel.frame; - cancelLabelStartFrame.origin.x = self.voiceMemoUI.bounds.size.width; + cancelLabelStartFrame.origin.x + = (self.isRTL ? -self.voiceMemoUI.bounds.size.width : self.voiceMemoUI.bounds.size.width); cancelLabel.frame = cancelLabelStartFrame; [UIView animateWithDuration:0.35f delay:0.f diff --git a/Signal/src/ViewControllers/ConversationView/OWSMessagesToolbarContentView.m b/Signal/src/ViewControllers/ConversationView/OWSMessagesToolbarContentView.m index 22ffca174..9b59ab19c 100644 --- a/Signal/src/ViewControllers/ConversationView/OWSMessagesToolbarContentView.m +++ b/Signal/src/ViewControllers/ConversationView/OWSMessagesToolbarContentView.m @@ -142,7 +142,7 @@ NS_ASSUME_NONNULL_BEGIN if (self.isRecordingVoiceMemo) { // Check for "slide to cancel" gesture. CGPoint location = [sender locationInView:self]; - CGFloat offset = MAX(0, self.voiceMemoGestureStartLocation.x - location.x); + CGFloat offset = fabs(self.voiceMemoGestureStartLocation.x - location.x); // The lower this value, the easier it is to cancel by accident. // The higher this value, the harder it is to cancel. const CGFloat kCancelOffsetPoints = 100.f; diff --git a/Signal/src/ViewControllers/OWSConversationSettingsTableViewController.m b/Signal/src/ViewControllers/OWSConversationSettingsTableViewController.m index ca20420bc..7aad681cc 100644 --- a/Signal/src/ViewControllers/OWSConversationSettingsTableViewController.m +++ b/Signal/src/ViewControllers/OWSConversationSettingsTableViewController.m @@ -598,8 +598,7 @@ NS_ASSUME_NONNULL_BEGIN threadTitleLabel.lineBreakMode = NSLineBreakByTruncatingTail; [threadNameView addSubview:threadTitleLabel]; [threadTitleLabel autoPinEdgeToSuperviewEdge:ALEdgeTop]; - [threadTitleLabel autoPinEdgeToSuperviewEdge:ALEdgeLeft]; - [threadTitleLabel autoPinEdgeToSuperviewEdge:ALEdgeRight]; + [threadTitleLabel autoPinWidthToSuperview]; __block UIView *lastTitleView = threadTitleLabel;