Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,4 @@ extension WPStyleGuide {
return (UIDevice.isPad()) ? .basicBackground : .neutral(.shade0)
}
}

static func configureBetaButton(_ button: UIButton) {
button.setImage(.gridicon(.helpOutline), for: .normal)
button.tintColor = .neutral(.shade20)

let edgeInsets = UIEdgeInsets(top: 2.0, left: 2.0, bottom: 2.0, right: 2.0)
button.contentEdgeInsets = edgeInsets
}
}
2 changes: 0 additions & 2 deletions WordPress/Classes/System/WordPress-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#import "MenuItemsViewController.h"
#import "MenusViewController.h"

#import "NavBarTitleDropdownButton.h"
#import "NSObject+Helpers.h"

#import "PageListTableViewCell.h"
Expand All @@ -47,7 +46,6 @@
#import "PostCategoryService.h"
#import "PostContentProvider.h"
#import "PostListFooterView.h"
#import "PostMetaButton.h"
#import "PostService.h"
#import "PostServiceOptions.h"
#import "PostSettingsViewController.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ - (void)setupTrashButton
[trashButton setImage:[UIImage gridiconOfType:GridiconTypeTrash] forState:UIControlStateNormal];
[trashButton addTarget:self action:@selector(trashButtonPressed) forControlEvents:UIControlEventTouchUpInside];
trashButton.backgroundColor = [UIColor clearColor];
trashButton.adjustsImageWhenHighlighted = YES;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no-op because true is the default value. (Yes, it's deprecated in iOS 15).

trashButton.accessibilityLabel = NSLocalizedString(@"Delete menu", @"Screen Reader: Button that deletes a menu.");
}

Expand Down
22 changes: 6 additions & 16 deletions WordPress/Classes/ViewRelated/Menus/MenuItemAbstractView.m
Original file line number Diff line number Diff line change
Expand Up @@ -217,28 +217,18 @@ - (UIButton *)addAccessoryButtonIconViewWithImage:(UIImage *)image
button.translatesAutoresizingMaskIntoConstraints = NO;
button.backgroundColor = [UIColor clearColor];

[button setImage:image forState:UIControlStateNormal];
UIImage *resizedImage = [image resizedImageWithContentMode:UIViewContentModeScaleAspectFit bounds:CGSizeMake(MenusDesignItemIconSize, MenusDesignItemIconSize) interpolationQuality:kCGInterpolationDefault];
[button setImage:[resizedImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] forState:UIControlStateNormal];
button.tintColor = [UIColor murielTextTertiary];

CGFloat padding = 6.0;
CGFloat width = MenusDesignItemIconSize + (padding * 2);
CGFloat height = MenusDesignItemIconSize + (padding * 2);
CGFloat side = MenusDesignItemIconSize + (padding * 2);

UIEdgeInsets inset = button.imageEdgeInsets;
inset.top = padding;
inset.bottom = padding;
inset.left = padding;
inset.right = padding;
button.imageEdgeInsets = inset;

NSLayoutConstraint *widthConstraint = [button.widthAnchor constraintEqualToConstant:width];
NSLayoutConstraint *widthConstraint = [button.widthAnchor constraintEqualToConstant:side];
widthConstraint.priority = 999;
NSLayoutConstraint *heightConstraint = [button.heightAnchor constraintEqualToConstant:height];
NSLayoutConstraint *heightConstraint = [button.heightAnchor constraintEqualToConstant:side];
heightConstraint.priority = 999;
[NSLayoutConstraint activateConstraints:@[
widthConstraint,
heightConstraint
]];
[NSLayoutConstraint activateConstraints:@[widthConstraint, heightConstraint]];
[self addAccessoryButton:button];

return button;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ - (void)setupCancelButton
- (void)setupTrashButton
{
UIButton *button = self.trashButton;
button.adjustsImageWhenHighlighted = YES;
[button setTitle:nil forState:UIControlStateNormal];
button.tintColor = [UIColor murielNeutral30];
[button setImage:[UIImage gridiconOfType:GridiconTypeTrash] forState:UIControlStateNormal];
Expand Down
16 changes: 11 additions & 5 deletions WordPress/Classes/ViewRelated/Menus/MenuItemView.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,20 @@ - (void)setupCancelButton
button.titleLabel.adjustsFontForContentSizeCategory = YES;
[button setTitle:NSLocalizedString(@"Cancel", @"") forState:UIControlStateNormal];

UIEdgeInsets inset = button.contentEdgeInsets;
inset.left = 6.0;
inset.right = inset.left;
button.contentEdgeInsets = inset;
if (@available(iOS 15, *)) {
UIButtonConfiguration *configuration = [UIButtonConfiguration plainButtonConfiguration];
configuration.contentInsets = NSDirectionalEdgeInsetsMake(0, 6, 0, 6);
button.configuration = configuration;
} else {
UIEdgeInsets inset = button.contentEdgeInsets;
inset.left = 6.0;
inset.right = inset.left;
button.contentEdgeInsets = inset;
}
button.hidden = YES;

[self.accessoryStackView addArrangedSubview:button];
[button setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
[button setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why hugging behavior changes with the new button configuration. I couldn't find any related documentation. I asked on Mastodon, and other folks also encountered it. The goal is to ensure the label on the right has a lower hugging priority.

[button setContentCompressionResistancePriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];

NSLayoutConstraint *heightConstraint = [button.heightAnchor constraintEqualToAnchor:self.accessoryStackView.heightAnchor];
Expand Down

This file was deleted.

75 changes: 0 additions & 75 deletions WordPress/Classes/ViewRelated/Post/NavBarTitleDropdownButton.m

This file was deleted.

5 changes: 0 additions & 5 deletions WordPress/Classes/ViewRelated/Post/PostMetaButton.h

This file was deleted.

13 changes: 0 additions & 13 deletions WordPress/Classes/ViewRelated/Post/PostMetaButton.m

This file was deleted.

12 changes: 12 additions & 0 deletions WordPress/Classes/ViewRelated/Post/PostMetaButton.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import UIKit

// Temporary converted to Swift silence the compiler warnings that are treated
// as errors in Objective-C files.
final class PostMetaButton: UIButton {
override var intrinsicContentSize: CGSize {
var newSize = super.intrinsicContentSize
newSize.width += (imageEdgeInsets.left + imageEdgeInsets.right)
newSize.width += (titleEdgeInsets.left + titleEdgeInsets.right)
return newSize
}
}
2 changes: 0 additions & 2 deletions WordPress/Classes/ViewRelated/Views/VerticallyStackedButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ - (void)layoutSubviews {
CGRectGetMaxY(self.imageView.frame) + ImageLabelSeparation,
titleSize.width,
titleSize.height));

self.contentEdgeInsets = UIEdgeInsetsMake(5.0f, 0.0f, 5.0f, 0.0f);
}

@end
Loading