Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
22 changes: 0 additions & 22 deletions WooCommerce/Classes/Extensions/UIButton+TitleAndImage.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,9 @@ private extension CardPresentPaymentsModalViewController {
func configureAuxiliaryButton() {

guard shouldShowAuxiliaryButton() else {
auxiliaryButton.isHidden = true
// Only for testing, switch back to true before merging
//auxiliaryButton.isHidden = true
auxiliaryButton.isHidden = false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is for convenience when testing the Case 2, has to be removed before merging.

return
}

Expand All @@ -293,7 +295,9 @@ private extension CardPresentPaymentsModalViewController {
auxiliaryButton.setAttributedTitle(viewModel.auxiliaryAttributedButtonTitle, for: .normal)
auxiliaryButton.setImage(viewModel.auxiliaryButtonimage, for: .normal)
if viewModel.auxiliaryButtonimage != nil {
auxiliaryButton.distributeTitleAndImage(spacing: 8.0)
var config = UIButton.Configuration.plain()
config.imagePadding = CGFloat(Constants.buttonTitleAndImageSpacing)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: buttonTitleAndImageSpacing is already declared as CGFloat, no need to wrap/convert.
Applies also to 3 similar cases below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nit: buttonTitleAndImageSpacing is already declared as CGFloat, no need to wrap/convert. Applies also to 3 similar cases below.

Oops! Removed on 3d9760b

auxiliaryButton.configuration = config
}
view.layoutIfNeeded()
}
Expand Down Expand Up @@ -389,6 +393,7 @@ private extension CardPresentPaymentsModalViewController {
static let extraInfoCustomInsets = UIEdgeInsets(top: 12, left: 10, bottom: 12, right: 10)
static let modalHeight: CGFloat = 382
static let modalWidth: CGFloat = 280
static let buttonTitleAndImageSpacing: CGFloat = 8
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,22 @@ private extension BottomButtonContainerView {
button.setTitle(viewModel.title, for: .normal)
button.addTarget(self, action: #selector(buttonTapped(sender:)), for: .touchUpInside)
button.titleLabel?.lineBreakMode = .byTruncatingTail
var configuration = UIButton.Configuration.plain()
configuration.contentInsets = .init(.zero)

switch viewModel.style {
case .primary:
button.applyPrimaryButtonStyle()
case .link:
button.applyLinkButtonStyle()
button.contentHorizontalAlignment = .leading
button.contentEdgeInsets = .zero
}

if let image = viewModel.image {
button.setImage(image, for: .normal)
button.distributeTitleAndImage(spacing: Constants.buttonTitleAndImageSpacing)
configuration.imagePadding = CGFloat(Constants.buttonTitleAndImageSpacing)
}
button.configuration = configuration
}

@objc func buttonTapped(sender: UIButton) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ private extension CustomerInfoTableViewCell {
addButton.setImage(.plusImage, for: .normal)
addButton.contentHorizontalAlignment = .leading
addButton.contentVerticalAlignment = .bottom
addButton.contentEdgeInsets = .zero
addButton.distributeTitleAndImage(spacing: Constants.buttonTitleAndImageSpacing)
var configuration = UIButton.Configuration.plain()
configuration.contentInsets = .init(.zero)
configuration.imagePadding = CGFloat(Constants.buttonTitleAndImageSpacing)
addButton.configuration = configuration
addButton.addTarget(self, action: #selector(addButtonTapped), for: .touchUpInside)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ private extension CustomerNoteTableViewCell {
addButton.contentVerticalAlignment = .bottom
var configuration = UIButton.Configuration.plain()
configuration.contentInsets = .init(.zero)
configuration.imagePadding = CGFloat(Constants.buttonTitleAndImageSpacing)
addButton.configuration = configuration
addButton.distributeTitleAndImage(spacing: Constants.buttonTitleAndImageSpacing)
addButton.addTarget(self, action: #selector(addButtonTapped), for: .touchUpInside)
}

Expand Down
4 changes: 0 additions & 4 deletions WooCommerce/WooCommerce.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@
0298431225936DFC00979CAE /* ShippingLabelsTopBannerFactoryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0298431125936DFC00979CAE /* ShippingLabelsTopBannerFactoryTests.swift */; };
029A9C672535873000BECEC5 /* AppCoordinatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 029A9C662535873000BECEC5 /* AppCoordinatorTests.swift */; };
029B0F57234197B80010C1F3 /* ProductSearchUICommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 029B0F56234197B80010C1F3 /* ProductSearchUICommand.swift */; };
029BFD4F24597D4B00FDDEEC /* UIButton+TitleAndImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 029BFD4E24597D4B00FDDEEC /* UIButton+TitleAndImage.swift */; };
029D444922F13F8A00DEFA8A /* DashboardUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 029D444822F13F8A00DEFA8A /* DashboardUI.swift */; };
029F29FA24D93E9E004751CA /* EditableProductModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 029F29F924D93E9E004751CA /* EditableProductModel.swift */; };
029F29FC24D94106004751CA /* EditableProductVariationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 029F29FB24D94106004751CA /* EditableProductVariationModel.swift */; };
Expand Down Expand Up @@ -2268,7 +2267,6 @@
0298431125936DFC00979CAE /* ShippingLabelsTopBannerFactoryTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShippingLabelsTopBannerFactoryTests.swift; sourceTree = "<group>"; };
029A9C662535873000BECEC5 /* AppCoordinatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinatorTests.swift; sourceTree = "<group>"; };
029B0F56234197B80010C1F3 /* ProductSearchUICommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductSearchUICommand.swift; sourceTree = "<group>"; };
029BFD4E24597D4B00FDDEEC /* UIButton+TitleAndImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIButton+TitleAndImage.swift"; sourceTree = "<group>"; };
029D444822F13F8A00DEFA8A /* DashboardUI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashboardUI.swift; sourceTree = "<group>"; };
029F29F924D93E9E004751CA /* EditableProductModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditableProductModel.swift; sourceTree = "<group>"; };
029F29FB24D94106004751CA /* EditableProductVariationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditableProductVariationModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -7794,7 +7792,6 @@
02396250239948470096F34C /* UIImage+TintColor.swift */,
F997174323DC065900592D8E /* XLPagerStrip+AccessibilityIdentifier.swift */,
0215320A24231D5A003F2BBD /* UIStackView+Subviews.swift */,
029BFD4E24597D4B00FDDEEC /* UIButton+TitleAndImage.swift */,
57612988245888E2007BB2D9 /* NumberFormatter+LocalizedOrNinetyNinePlus.swift */,
02BA12842461674B008D8325 /* Optional+String.swift */,
02B8650E24A9E2D800265779 /* Product+SwiftUIPreviewHelpers.swift */,
Expand Down Expand Up @@ -9809,7 +9806,6 @@
DE8C94662646990000C94823 /* PluginListViewController.swift in Sources */,
B6E851F3276320C70041D1BA /* RefundFeesDetailsViewModel.swift in Sources */,
024DF31F23743045006658FE /* Header+AztecFormatting.swift in Sources */,
029BFD4F24597D4B00FDDEEC /* UIButton+TitleAndImage.swift in Sources */,
AE7C957B27C3D5DA007E8E12 /* FeeLineDetails.swift in Sources */,
B5A8F8AD20B88D9900D211DE /* LoginPrologueViewController.swift in Sources */,
B5D1AFC620BC7B7300DB0E8C /* StorePickerViewController.swift in Sources */,
Expand Down