|
|
@ -457,6 +457,7 @@ typedef enum : NSUInteger {
|
|
|
|
|
|
|
|
|
|
|
|
[self initializeToolbars];
|
|
|
|
[self initializeToolbars];
|
|
|
|
[self createScrollDownButton];
|
|
|
|
[self createScrollDownButton];
|
|
|
|
|
|
|
|
[self createHeaderViews];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)registerCustomMessageNibs
|
|
|
|
- (void)registerCustomMessageNibs
|
|
|
@ -545,8 +546,6 @@ typedef enum : NSUInteger {
|
|
|
|
// or on another device.
|
|
|
|
// or on another device.
|
|
|
|
[self hideInputIfNeeded];
|
|
|
|
[self hideInputIfNeeded];
|
|
|
|
|
|
|
|
|
|
|
|
[self setNavigationTitle];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.isViewVisible = YES;
|
|
|
|
self.isViewVisible = YES;
|
|
|
|
|
|
|
|
|
|
|
|
// restart any animations that were stopped e.g. while inspecting the contact info screens.
|
|
|
|
// restart any animations that were stopped e.g. while inspecting the contact info screens.
|
|
|
@ -1033,14 +1032,10 @@ typedef enum : NSUInteger {
|
|
|
|
[self setBarButtonItemsForDisappearingMessagesConfiguration:configuration];
|
|
|
|
[self setBarButtonItemsForDisappearingMessagesConfiguration:configuration];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)setBarButtonItemsForDisappearingMessagesConfiguration:
|
|
|
|
- (void)createHeaderViews
|
|
|
|
(OWSDisappearingMessagesConfiguration *)disappearingMessagesConfiguration
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
UIBarButtonItem *backItem = [self createOWSBackButton];
|
|
|
|
|
|
|
|
const CGFloat unreadCountViewDiameter = 16;
|
|
|
|
|
|
|
|
if (_backButtonUnreadCountView == nil) {
|
|
|
|
|
|
|
|
_backButtonUnreadCountView = [UIView new];
|
|
|
|
_backButtonUnreadCountView = [UIView new];
|
|
|
|
_backButtonUnreadCountView.layer.cornerRadius = unreadCountViewDiameter / 2;
|
|
|
|
_backButtonUnreadCountView.layer.cornerRadius = self.unreadCountViewDiameter / 2;
|
|
|
|
_backButtonUnreadCountView.backgroundColor = [UIColor redColor];
|
|
|
|
_backButtonUnreadCountView.backgroundColor = [UIColor redColor];
|
|
|
|
_backButtonUnreadCountView.hidden = YES;
|
|
|
|
_backButtonUnreadCountView.hidden = YES;
|
|
|
|
_backButtonUnreadCountView.userInteractionEnabled = NO;
|
|
|
|
_backButtonUnreadCountView.userInteractionEnabled = NO;
|
|
|
@ -1050,32 +1045,7 @@ typedef enum : NSUInteger {
|
|
|
|
_backButtonUnreadCountLabel.textColor = [UIColor whiteColor];
|
|
|
|
_backButtonUnreadCountLabel.textColor = [UIColor whiteColor];
|
|
|
|
_backButtonUnreadCountLabel.font = [UIFont systemFontOfSize:11];
|
|
|
|
_backButtonUnreadCountLabel.font = [UIFont systemFontOfSize:11];
|
|
|
|
_backButtonUnreadCountLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
|
_backButtonUnreadCountLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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: The back button assets are assymetrical. There are strong reasons
|
|
|
|
|
|
|
|
// to use spacing in the assets to manipulate the size and positioning of
|
|
|
|
|
|
|
|
// bar button items, but it means we'll probably need separate RTL and LTR
|
|
|
|
|
|
|
|
// flavors of these assets.
|
|
|
|
|
|
|
|
[_backButtonUnreadCountView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:-6];
|
|
|
|
|
|
|
|
[_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
|
|
|
|
|
|
|
|
toSize:unreadCountViewDiameter
|
|
|
|
|
|
|
|
relation:NSLayoutRelationGreaterThanOrEqual];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[_backButtonUnreadCountView addSubview:_backButtonUnreadCountLabel];
|
|
|
|
|
|
|
|
[_backButtonUnreadCountLabel autoPinWidthToSuperviewWithMargin:4];
|
|
|
|
|
|
|
|
[_backButtonUnreadCountLabel autoPinHeightToSuperview];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Initialize newly created unread count badge to accurately reflect the current unread count.
|
|
|
|
|
|
|
|
[self updateBackButtonUnreadCount];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const CGFloat kTitleVSpacing = 0.f;
|
|
|
|
|
|
|
|
if (!self.navigationBarTitleView) {
|
|
|
|
|
|
|
|
self.navigationBarTitleView = [UIView containerView];
|
|
|
|
self.navigationBarTitleView = [UIView containerView];
|
|
|
|
[self.navigationBarTitleView
|
|
|
|
[self.navigationBarTitleView
|
|
|
|
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self
|
|
|
|
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self
|
|
|
@ -1095,8 +1065,40 @@ typedef enum : NSUInteger {
|
|
|
|
self.navigationBarSubtitleLabel = [UILabel new];
|
|
|
|
self.navigationBarSubtitleLabel = [UILabel new];
|
|
|
|
[self updateNavigationBarSubtitleLabel];
|
|
|
|
[self updateNavigationBarSubtitleLabel];
|
|
|
|
[self.navigationBarTitleView addSubview:self.navigationBarSubtitleLabel];
|
|
|
|
[self.navigationBarTitleView addSubview:self.navigationBarSubtitleLabel];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (CGFloat)unreadCountViewDiameter
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return 16;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)setBarButtonItemsForDisappearingMessagesConfiguration:
|
|
|
|
|
|
|
|
(OWSDisappearingMessagesConfiguration *)disappearingMessagesConfiguration
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
UIBarButtonItem *backItem = [self createOWSBackButton];
|
|
|
|
|
|
|
|
// 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: The back button assets are assymetrical. There are strong reasons
|
|
|
|
|
|
|
|
// to use spacing in the assets to manipulate the size and positioning of
|
|
|
|
|
|
|
|
// bar button items, but it means we'll probably need separate RTL and LTR
|
|
|
|
|
|
|
|
// flavors of these assets.
|
|
|
|
|
|
|
|
[_backButtonUnreadCountView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:-6];
|
|
|
|
|
|
|
|
[_backButtonUnreadCountView autoPinLeadingToSuperViewWithMargin:1];
|
|
|
|
|
|
|
|
[_backButtonUnreadCountView autoSetDimension:ALDimensionHeight toSize:self.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
|
|
|
|
|
|
|
|
toSize:self.unreadCountViewDiameter
|
|
|
|
|
|
|
|
relation:NSLayoutRelationGreaterThanOrEqual];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[_backButtonUnreadCountView addSubview:_backButtonUnreadCountLabel];
|
|
|
|
|
|
|
|
[_backButtonUnreadCountLabel autoPinWidthToSuperviewWithMargin:4];
|
|
|
|
|
|
|
|
[_backButtonUnreadCountLabel autoPinHeightToSuperview];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Initialize newly created unread count badge to accurately reflect the current unread count.
|
|
|
|
|
|
|
|
[self updateBackButtonUnreadCount];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const CGFloat kTitleVSpacing = 0.f;
|
|
|
|
// We need to manually resize and position the title views;
|
|
|
|
// We need to manually resize and position the title views;
|
|
|
|
// iOS AutoLayout doesn't work inside navigation bar items.
|
|
|
|
// iOS AutoLayout doesn't work inside navigation bar items.
|
|
|
|
[self.navigationBarTitleLabel sizeToFit];
|
|
|
|
[self.navigationBarTitleLabel sizeToFit];
|
|
|
|