Skip to content

Commit

Permalink
Cleanup some of the UIButton deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jun 19, 2023
1 parent de22f2a commit 59df2f5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,7 @@ import WordPressShared
}

fileprivate func adjustInsetsForTextDirection() {
guard userInterfaceLayoutDirection() == .rightToLeft else {
return
}

followButton.contentEdgeInsets = followButton.contentEdgeInsets.flippedForRightToLeftLayoutDirection()
followButton.imageEdgeInsets = followButton.imageEdgeInsets.flippedForRightToLeftLayoutDirection()
followButton.titleEdgeInsets = followButton.titleEdgeInsets.flippedForRightToLeftLayoutDirection()
followButton.flipInsetsForRightToLeftLayoutDirection()
}

// MARK: - Actions
Expand Down
28 changes: 0 additions & 28 deletions WordPress/Classes/ViewRelated/Reader/WPStyleGuide+Reader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -264,34 +264,6 @@ extension WPStyleGuide {
button.setTitleColor(disabledColor, for: .disabled)
}

@objc public class func applyReaderFollowConversationButtonStyle(_ button: UIButton) {
// General
button.naturalContentHorizontalAlignment = .leading
button.backgroundColor = .clear
button.titleLabel?.font = fontForTextStyle(.footnote)

// Color(s)
let normalColor = UIColor.primary
let highlightedColor = UIColor.neutral
let selectedColor = UIColor.success

button.setTitleColor(normalColor, for: .normal)
button.setTitleColor(selectedColor, for: .selected)
button.setTitleColor(highlightedColor, for: .highlighted)

// Image(s)
let side = WPStyleGuide.fontSizeForTextStyle(.headline)
let size = CGSize(width: side, height: side)
let followIcon = UIImage.gridicon(.readerFollowConversation, size: size)
let followingIcon = UIImage.gridicon(.readerFollowingConversation, size: size)

button.setImage(followIcon.imageWithTintColor(normalColor), for: .normal)
button.setImage(followingIcon.imageWithTintColor(selectedColor), for: .selected)
button.setImage(followingIcon.imageWithTintColor(highlightedColor), for: .highlighted)
button.imageEdgeInsets = FollowConversationButton.Style.imageEdgeInsets
button.contentEdgeInsets = FollowConversationButton.Style.contentEdgeInsets
}

@objc public class func applyReaderFollowButtonStyle(_ button: UIButton) {
let side = WPStyleGuide.fontSizeForTextStyle(.callout)
let size = CGSize(width: side, height: side)
Expand Down

0 comments on commit 59df2f5

Please sign in to comment.