diff --git a/Signal/Images.xcassets/NavBarBackRTL.imageset/Contents.json b/Signal/Images.xcassets/NavBarBackRTL.imageset/Contents.json new file mode 100644 index 000000000..ff07ee435 --- /dev/null +++ b/Signal/Images.xcassets/NavBarBackRTL.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "NavBarBackWhiteRTL@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "NavBarBackWhiteRTL@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "NavBarBackWhiteRTL@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Signal/Images.xcassets/NavBarBackRTL.imageset/NavBarBackWhiteRTL@1x.png b/Signal/Images.xcassets/NavBarBackRTL.imageset/NavBarBackWhiteRTL@1x.png new file mode 100644 index 000000000..bf1c39342 Binary files /dev/null and b/Signal/Images.xcassets/NavBarBackRTL.imageset/NavBarBackWhiteRTL@1x.png differ diff --git a/Signal/Images.xcassets/NavBarBackRTL.imageset/NavBarBackWhiteRTL@2x.png b/Signal/Images.xcassets/NavBarBackRTL.imageset/NavBarBackWhiteRTL@2x.png new file mode 100644 index 000000000..87eced2d2 Binary files /dev/null and b/Signal/Images.xcassets/NavBarBackRTL.imageset/NavBarBackWhiteRTL@2x.png differ diff --git a/Signal/Images.xcassets/NavBarBackRTL.imageset/NavBarBackWhiteRTL@3x.png b/Signal/Images.xcassets/NavBarBackRTL.imageset/NavBarBackWhiteRTL@3x.png new file mode 100644 index 000000000..f39a733c5 Binary files /dev/null and b/Signal/Images.xcassets/NavBarBackRTL.imageset/NavBarBackWhiteRTL@3x.png differ diff --git a/Signal/src/ViewControllers/ConversationView/MessagesViewController.m b/Signal/src/ViewControllers/ConversationView/MessagesViewController.m index bf4a25a6d..76cffb563 100644 --- a/Signal/src/ViewControllers/ConversationView/MessagesViewController.m +++ b/Signal/src/ViewControllers/ConversationView/MessagesViewController.m @@ -1079,6 +1079,7 @@ typedef enum : NSUInteger { // This method gets called multiple times, so it's important we re-layout the unread badge // with respect to the new backItem. [backItem.customView addSubview:_backButtonUnreadCountView]; + // TODO: [_backButtonUnreadCountView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:-6]; [_backButtonUnreadCountView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:1]; [_backButtonUnreadCountView autoSetDimension:ALDimensionHeight toSize:unreadCountViewDiameter]; @@ -1097,7 +1098,7 @@ typedef enum : NSUInteger { const CGFloat kTitleVSpacing = 0.f; if (!self.navigationBarTitleView) { - self.navigationBarTitleView = [UIView new]; + self.navigationBarTitleView = [UIView containerView]; [self.navigationBarTitleView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(navigationTitleTapped:)]]; @@ -1161,7 +1162,9 @@ typedef enum : NSUInteger { + kTitleVSpacing); self.navigationBarTitleLabel.frame = CGRectMake(0, 0, titleViewWidth, self.navigationBarTitleLabel.frame.size.height); - self.navigationBarSubtitleLabel.frame = CGRectMake(0, + self.navigationBarSubtitleLabel.frame = CGRectMake((self.view.isRTL ? self.navigationBarTitleView.frame.size.width + - self.navigationBarSubtitleLabel.frame.size.width + : 0), self.navigationBarTitleView.frame.size.height - self.navigationBarSubtitleLabel.frame.size.height, titleViewWidth, self.navigationBarSubtitleLabel.frame.size.height); diff --git a/Signal/src/ViewControllers/OWSConversationSettingsTableViewController.m b/Signal/src/ViewControllers/OWSConversationSettingsTableViewController.m index 95a5d94b7..dba59d2f0 100644 --- a/Signal/src/ViewControllers/OWSConversationSettingsTableViewController.m +++ b/Signal/src/ViewControllers/OWSConversationSettingsTableViewController.m @@ -293,18 +293,20 @@ NS_ASSUME_NONNULL_BEGIN [mainSection addItem:[OWSTableItem itemWithCustomCellBlock:^{ UITableViewCell *cell = [UITableViewCell new]; + cell.preservesSuperviewLayoutMargins = YES; + cell.contentView.preservesSuperviewLayoutMargins = YES; cell.selectionStyle = UITableViewCellSelectionStyleNone; - UIView *topView = [UIView new]; + UIView *topView = [UIView containerView]; [cell.contentView addSubview:topView]; - [topView autoPinWidthToSuperview]; + [topView autoPinLeadingAndTrailingToSuperview]; [topView autoPinEdgeToSuperviewEdge:ALEdgeTop]; [topView autoSetDimension:ALDimensionHeight toSize:kOWSTable_DefaultCellHeight]; UIImageView *iconView = [self viewForIconWithName:@"table_ic_hourglass"]; [topView addSubview:iconView]; [iconView autoVCenterInSuperview]; - [iconView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:16.f]; + [iconView autoPinLeadingToSuperView]; UILabel *rowLabel = [UILabel new]; rowLabel.text = NSLocalizedString(@"DISAPPEARING_MESSAGES", @"table cell label in conversation settings"); @@ -313,7 +315,7 @@ NS_ASSUME_NONNULL_BEGIN rowLabel.lineBreakMode = NSLineBreakByTruncatingTail; [topView addSubview:rowLabel]; [rowLabel autoVCenterInSuperview]; - [rowLabel autoPinEdge:ALEdgeLeft toEdge:ALEdgeRight ofView:iconView withOffset:12.f]; + [rowLabel autoPinLeadingToTrailingOfView:iconView margin:weakSelf.iconSpacing]; UISwitch *switchView = [UISwitch new]; switchView.on = self.disappearingMessagesConfiguration.isEnabled; @@ -322,7 +324,8 @@ NS_ASSUME_NONNULL_BEGIN forControlEvents:UIControlEventValueChanged]; [topView addSubview:switchView]; [switchView autoVCenterInSuperview]; - [switchView autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:16.f]; + [switchView autoPinLeadingToTrailingOfView:rowLabel margin:weakSelf.iconSpacing]; + [switchView autoPinTrailingToSuperView]; UILabel *subtitleLabel = [UILabel new]; subtitleLabel.text @@ -333,8 +336,8 @@ NS_ASSUME_NONNULL_BEGIN subtitleLabel.lineBreakMode = NSLineBreakByWordWrapping; [cell.contentView addSubview:subtitleLabel]; [subtitleLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:topView]; - [subtitleLabel autoPinEdge:ALEdgeLeft toEdge:ALEdgeLeft ofView:rowLabel]; - [subtitleLabel autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:16.f]; + [subtitleLabel autoPinEdge:ALEdgeLeading toEdge:ALEdgeLeading ofView:rowLabel]; + [subtitleLabel autoPinTrailingToSuperView]; return cell; } @@ -347,18 +350,20 @@ NS_ASSUME_NONNULL_BEGIN addItem:[OWSTableItem itemWithCustomCellBlock:^{ UITableViewCell *cell = [UITableViewCell new]; + cell.preservesSuperviewLayoutMargins = YES; + cell.contentView.preservesSuperviewLayoutMargins = YES; cell.selectionStyle = UITableViewCellSelectionStyleNone; - UIView *topView = [UIView new]; + UIView *topView = [UIView containerView]; [cell.contentView addSubview:topView]; - [topView autoPinWidthToSuperview]; + [topView autoPinLeadingAndTrailingToSuperview]; [topView autoPinEdgeToSuperviewEdge:ALEdgeTop]; [topView autoSetDimension:ALDimensionHeight toSize:kOWSTable_DefaultCellHeight]; UIImageView *iconView = [self viewForIconWithName:@"table_ic_hourglass"]; [topView addSubview:iconView]; [iconView autoVCenterInSuperview]; - [iconView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:16.f]; + [iconView autoPinLeadingToSuperView]; UILabel *rowLabel = self.disappearingMessagesDurationLabel; [self updateDisappearingMessagesDurationLabel]; @@ -367,7 +372,7 @@ NS_ASSUME_NONNULL_BEGIN rowLabel.lineBreakMode = NSLineBreakByTruncatingTail; [topView addSubview:rowLabel]; [rowLabel autoVCenterInSuperview]; - [rowLabel autoPinEdge:ALEdgeLeft toEdge:ALEdgeRight ofView:iconView withOffset:12.f]; + [rowLabel autoPinLeadingToTrailingOfView:iconView margin:weakSelf.iconSpacing]; UISlider *slider = [UISlider new]; slider.maximumValue = (float)(self.disappearingMessagesDurations.count - 1); @@ -379,8 +384,8 @@ NS_ASSUME_NONNULL_BEGIN forControlEvents:UIControlEventValueChanged]; [cell.contentView addSubview:slider]; [slider autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:topView]; - [slider autoPinEdge:ALEdgeLeft toEdge:ALEdgeLeft ofView:rowLabel]; - [slider autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:16.f]; + [slider autoPinEdge:ALEdgeLeading toEdge:ALEdgeLeading ofView:rowLabel]; + [slider autoPinTrailingToSuperView]; return cell; } @@ -431,12 +436,14 @@ NS_ASSUME_NONNULL_BEGIN OWSTableSection *muteSection = [OWSTableSection new]; [muteSection addItem:[OWSTableItem itemWithCustomCellBlock:^{ UITableViewCell *cell = [UITableViewCell new]; + cell.preservesSuperviewLayoutMargins = YES; + cell.contentView.preservesSuperviewLayoutMargins = YES; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; UIImageView *iconView = [self viewForIconWithName:@"table_ic_mute_thread"]; [cell.contentView addSubview:iconView]; [iconView autoVCenterInSuperview]; - [iconView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:16.f]; + [iconView autoPinLeadingToSuperView]; UILabel *rowLabel = [UILabel new]; rowLabel.text = NSLocalizedString( @@ -446,7 +453,7 @@ NS_ASSUME_NONNULL_BEGIN rowLabel.lineBreakMode = NSLineBreakByTruncatingTail; [cell.contentView addSubview:rowLabel]; [rowLabel autoVCenterInSuperview]; - [rowLabel autoPinEdge:ALEdgeLeft toEdge:ALEdgeRight ofView:iconView withOffset:12.f]; + [rowLabel autoPinLeadingToTrailingOfView:iconView margin:weakSelf.iconSpacing]; NSString *muteStatus = NSLocalizedString( @"CONVERSATION_SETTINGS_MUTE_NOT_MUTED", @"Indicates that the current thread is not muted."); @@ -481,7 +488,8 @@ NS_ASSUME_NONNULL_BEGIN statusLabel.text = muteStatus; [cell.contentView addSubview:statusLabel]; [statusLabel autoVCenterInSuperview]; - [statusLabel autoPinEdgeToSuperviewEdge:ALEdgeRight]; + // [statusLabel autoPinLeadingToTrailingOfView:rowLabel margin:weakSelf.iconSpacing]; + [statusLabel autoPinTrailingToSuperView]; return cell; } customRowHeight:45.f @@ -523,18 +531,25 @@ NS_ASSUME_NONNULL_BEGIN [self.tableView reloadData]; } +- (CGFloat)iconSpacing +{ + return 12.f; +} + - (UITableViewCell *)disclosureCellWithName:(NSString *)name iconName:(NSString *)iconName { OWSAssert(name.length > 0); OWSAssert(iconName.length > 0); UITableViewCell *cell = [UITableViewCell new]; + cell.preservesSuperviewLayoutMargins = YES; + cell.contentView.preservesSuperviewLayoutMargins = YES; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; UIImageView *iconView = [self viewForIconWithName:iconName]; [cell.contentView addSubview:iconView]; [iconView autoVCenterInSuperview]; - [iconView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:16.f]; + [iconView autoPinLeadingToSuperView]; UILabel *rowLabel = [UILabel new]; rowLabel.text = name; @@ -543,7 +558,8 @@ NS_ASSUME_NONNULL_BEGIN rowLabel.lineBreakMode = NSLineBreakByTruncatingTail; [cell.contentView addSubview:rowLabel]; [rowLabel autoVCenterInSuperview]; - [rowLabel autoPinEdge:ALEdgeLeft toEdge:ALEdgeRight ofView:iconView withOffset:12.f]; + [rowLabel autoPinLeadingToTrailingOfView:iconView margin:self.iconSpacing]; + [rowLabel autoPinTrailingToSuperView]; return cell; } diff --git a/Signal/src/ViewControllers/SelectThreadViewController.m b/Signal/src/ViewControllers/SelectThreadViewController.m index c4dd7db05..6c1b10505 100644 --- a/Signal/src/ViewControllers/SelectThreadViewController.m +++ b/Signal/src/ViewControllers/SelectThreadViewController.m @@ -7,7 +7,6 @@ #import "ContactTableViewCell.h" #import "ContactsViewHelper.h" #import "Environment.h" -#import "InboxTableViewCell.h" #import "OWSContactsManager.h" #import "OWSContactsSearcher.h" #import "OWSTableViewController.h" diff --git a/Signal/src/ViewControllers/SignalsViewController.h b/Signal/src/ViewControllers/SignalsViewController.h index 3cc126370..fd6b54335 100644 --- a/Signal/src/ViewControllers/SignalsViewController.h +++ b/Signal/src/ViewControllers/SignalsViewController.h @@ -3,9 +3,8 @@ // #import -#import "InboxTableViewCell.h" -#import "Contact.h" -#import "TSGroupModel.h" + +@class TSThread; @interface SignalsViewController : UIViewController diff --git a/Signal/src/util/UIViewController+OWS.m b/Signal/src/util/UIViewController+OWS.m index 79d04a01e..7d47dafa0 100644 --- a/Signal/src/util/UIViewController+OWS.m +++ b/Signal/src/util/UIViewController+OWS.m @@ -2,6 +2,7 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // +#import "UIView+OWS.h" #import "UIViewController+OWS.h" NS_ASSUME_NONNULL_BEGIN @@ -18,13 +19,16 @@ NS_ASSUME_NONNULL_BEGIN OWSAssert(target); OWSAssert(selector); + UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom]; + BOOL isRTL = [backButton isRTL]; + // Nudge closer to the left edge to match default back button item. - const CGFloat kExtraLeftPadding = -8; + const CGFloat kExtraLeftPadding = isRTL ? +0 : -8; // Give some extra hit area to the back button. This is a little smaller // than the default back button, but makes sense for our left aligned title // view in the MessagesViewController - const CGFloat kExtraRightPadding = 10; + const CGFloat kExtraRightPadding = isRTL ? -0 : +10; // Extra hit area above/below const CGFloat kExtraHeightPadding = 4; @@ -33,10 +37,9 @@ NS_ASSUME_NONNULL_BEGIN // We can't just adjust the imageEdgeInsets on a UIBarButtonItem directly, // so we adjust the imageEdgeInsets on a UIButton, then wrap that // in a UIBarButtonItem. - UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom]; [backButton addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside]; - UIImage *backImage = [UIImage imageNamed:@"NavBarBack"]; + UIImage *backImage = [UIImage imageNamed:(isRTL ? @"NavBarBackRTL" : @"NavBarBack")]; OWSAssert(backImage); [backButton setImage:backImage forState:UIControlStateNormal];