mirror of
https://github.com/signalapp/Signal-iOS.git
synced 2025-12-05 01:10:41 +00:00
Work around use of deprecated UIButton API
The old UIButton API is still functional as long as we don't use UIButton.Configuration, so we can safely ignore these warnings until we're ready to adopt the configuration API across the codebase.
This commit is contained in:
@@ -9,6 +9,9 @@
|
||||
/* Begin PBXBuildFile section */
|
||||
0517B9782BFCFF12002CDE7D /* TSThreadTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0517B9772BFCFF12002CDE7D /* TSThreadTests.swift */; };
|
||||
05412B3C2C22219E007AC9C7 /* InboxFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05412B3B2C22219E007AC9C7 /* InboxFilter.swift */; };
|
||||
05412B3F2C29C0A0007AC9C7 /* UIButton+DeprecationWorkaround.m in Sources */ = {isa = PBXBuildFile; fileRef = 05412B3E2C29C0A0007AC9C7 /* UIButton+DeprecationWorkaround.m */; };
|
||||
05412B402C29C0A0007AC9C7 /* UIButton+DeprecationWorkaround.h in Headers */ = {isa = PBXBuildFile; fileRef = 05412B3D2C29C0A0007AC9C7 /* UIButton+DeprecationWorkaround.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
05412B422C29C0F0007AC9C7 /* SignalUI.h in Headers */ = {isa = PBXBuildFile; fileRef = 05412B412C29C0F0007AC9C7 /* SignalUI.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
05572BC42BFC0094006A72F1 /* DoubleTapToEditOnboardingController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05572BC32BFC0094006A72F1 /* DoubleTapToEditOnboardingController.swift */; };
|
||||
0CE014267EDFBD2538E940A0 /* Pods_Signal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7FF88FB580BC19B240EEB86A /* Pods_Signal.framework */; };
|
||||
1404D8B3276A353B0068E2F6 /* ChatListViewController+Multiselect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1404D8B2276A353A0068E2F6 /* ChatListViewController+Multiselect.swift */; };
|
||||
@@ -2887,6 +2890,9 @@
|
||||
/* Begin PBXFileReference section */
|
||||
0517B9772BFCFF12002CDE7D /* TSThreadTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSThreadTests.swift; sourceTree = "<group>"; };
|
||||
05412B3B2C22219E007AC9C7 /* InboxFilter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InboxFilter.swift; sourceTree = "<group>"; };
|
||||
05412B3D2C29C0A0007AC9C7 /* UIButton+DeprecationWorkaround.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIButton+DeprecationWorkaround.h"; sourceTree = "<group>"; };
|
||||
05412B3E2C29C0A0007AC9C7 /* UIButton+DeprecationWorkaround.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIButton+DeprecationWorkaround.m"; sourceTree = "<group>"; };
|
||||
05412B412C29C0F0007AC9C7 /* SignalUI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SignalUI.h; sourceTree = "<group>"; };
|
||||
05572BC32BFC0094006A72F1 /* DoubleTapToEditOnboardingController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DoubleTapToEditOnboardingController.swift; sourceTree = "<group>"; };
|
||||
05E3A4DD8B4442530268AFC1 /* Pods-SignalShareExtension.app store release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SignalShareExtension.app store release.xcconfig"; path = "Target Support Files/Pods-SignalShareExtension/Pods-SignalShareExtension.app store release.xcconfig"; sourceTree = "<group>"; };
|
||||
0BADD293DAFC82BF3274F0F6 /* Pods_SignalTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SignalTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -6387,6 +6393,7 @@
|
||||
34A95566271B510500B05242 /* ViewControllers */,
|
||||
34A95508271B510400B05242 /* Views */,
|
||||
34A955A8271B510500B05242 /* Wallpapers */,
|
||||
05412B412C29C0F0007AC9C7 /* SignalUI.h */,
|
||||
);
|
||||
path = SignalUI;
|
||||
sourceTree = "<group>";
|
||||
@@ -6409,6 +6416,8 @@
|
||||
34A954E9271B4FB000B05242 /* UIKitExtensions */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
05412B3D2C29C0A0007AC9C7 /* UIButton+DeprecationWorkaround.h */,
|
||||
05412B3E2C29C0A0007AC9C7 /* UIButton+DeprecationWorkaround.m */,
|
||||
F963F815292D1B5B007DBBBD /* UIButton+SignalUI.swift */,
|
||||
7685DFFE29EA1F6400542CBC /* UIFont+OWS.swift */,
|
||||
76E54D68290B4E7800D03BA8 /* UIFont+TextStyle.swift */,
|
||||
@@ -11812,6 +11821,8 @@
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
05412B422C29C0F0007AC9C7 /* SignalUI.h in Headers */,
|
||||
05412B402C29C0A0007AC9C7 /* UIButton+DeprecationWorkaround.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -13023,6 +13034,7 @@
|
||||
50086B9E29DF606E00F9C072 /* TSGroupThread+ViewModel.swift in Sources */,
|
||||
8803C2F628B02FDB00183D2B /* TSOutgoingMessage+TSAttachmentMultisend.swift in Sources */,
|
||||
66290FED2BCDE5ED0062605F /* TSResourceMultisend.swift in Sources */,
|
||||
05412B3F2C29C0A0007AC9C7 /* UIButton+DeprecationWorkaround.m in Sources */,
|
||||
F963F816292D1B5B007DBBBD /* UIButton+SignalUI.swift in Sources */,
|
||||
7685DFFF29EA1F6400542CBC /* UIFont+OWS.swift in Sources */,
|
||||
76E54D69290B4E7800D03BA8 /* UIFont+TextStyle.swift in Sources */,
|
||||
|
||||
@@ -79,7 +79,7 @@ class CallControls: UIView {
|
||||
button.block = { [weak self, unowned button] in
|
||||
self?.viewModel.didPressJoin()
|
||||
}
|
||||
button.contentEdgeInsets = UIEdgeInsets(top: 17, leading: 17, bottom: 17, trailing: 17)
|
||||
button.ows_contentEdgeInsets = UIEdgeInsets(top: 17, leading: 17, bottom: 17, trailing: 17)
|
||||
button.addSubview(joinButtonActivityIndicator)
|
||||
joinButtonActivityIndicator.autoCenterInSuperview()
|
||||
|
||||
@@ -229,7 +229,7 @@ class CallControls: UIView {
|
||||
let joinButtonConfig = viewModel.joinButtonConfig
|
||||
joinButton.setTitle(joinButtonConfig.label, for: .normal)
|
||||
joinButton.setTitleColor(joinButtonConfig.color, for: .normal)
|
||||
joinButton.adjustsImageWhenHighlighted = joinButtonConfig.adjustsImageWhenHighlighted
|
||||
joinButton.ows_adjustsImageWhenHighlighted = joinButtonConfig.adjustsImageWhenHighlighted
|
||||
joinButton.isUserInteractionEnabled = joinButtonConfig.isUserInteractionEnabled
|
||||
if viewModel.shouldJoinButtonActivityIndicatorBeAnimating {
|
||||
joinButtonActivityIndicator.startAnimating()
|
||||
|
||||
@@ -66,7 +66,7 @@ class CallHeader: UIView {
|
||||
let backButton = UIButton()
|
||||
backButton.setTemplateImage(UIImage(imageLiteralResourceName: "NavBarBack"), tintColor: .ows_white)
|
||||
backButton.autoSetDimensions(to: CGSize(square: 40))
|
||||
backButton.imageEdgeInsets = UIEdgeInsets(top: -12, leading: -18, bottom: 0, trailing: 0)
|
||||
backButton.ows_imageEdgeInsets = UIEdgeInsets(top: -12, leading: -18, bottom: 0, trailing: 0)
|
||||
backButton.addTarget(delegate, action: #selector(CallHeaderDelegate.didTapBackButton), for: .touchUpInside)
|
||||
addShadow(to: backButton)
|
||||
|
||||
|
||||
@@ -1772,8 +1772,8 @@ private extension CallsListViewController {
|
||||
self?.detailsTapped()
|
||||
}
|
||||
// The info icon is the button's own image and should be `horizontalMargin` from the edge
|
||||
button.contentEdgeInsets.trailing = Self.horizontalMargin
|
||||
button.contentEdgeInsets.leading = 8
|
||||
button.ows_contentEdgeInsets.trailing = Self.horizontalMargin
|
||||
button.ows_contentEdgeInsets.leading = 8
|
||||
// The join button is a separate subview and should be `joinButtonMargin` from the edge
|
||||
button.layoutMargins.trailing = Self.joinButtonMargin
|
||||
return button
|
||||
@@ -1819,7 +1819,7 @@ private extension CallsListViewController {
|
||||
)
|
||||
button.setAttributedTitle(title, for: .normal)
|
||||
button.backgroundColor = .ows_accentGreen
|
||||
button.contentEdgeInsets = .init(hMargin: 12, vMargin: 4)
|
||||
button.ows_contentEdgeInsets = .init(hMargin: 12, vMargin: 4)
|
||||
button.setCompressionResistanceHigh()
|
||||
button.isUserInteractionEnabled = false
|
||||
return button
|
||||
|
||||
@@ -55,7 +55,7 @@ class GroupCallErrorView: UIView {
|
||||
let button = UIButton()
|
||||
button.backgroundColor = .ows_gray75
|
||||
|
||||
button.contentEdgeInsets = UIEdgeInsets(top: 3, leading: 12, bottom: 3, trailing: 12)
|
||||
button.ows_contentEdgeInsets = UIEdgeInsets(top: 3, leading: 12, bottom: 3, trailing: 12)
|
||||
button.layer.cornerRadius = 12
|
||||
button.clipsToBounds = true
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ class RaisedHandsToast: UIView {
|
||||
// far as the superview's margins, so if we had
|
||||
// isLayoutMarginsRelativeArrangement on outerHStack, the button wouldn't
|
||||
// slide all the way off, so instead set margins on the button itself.
|
||||
button.contentEdgeInsets = .init(top: 8, leading: 8, bottom: 8, trailing: 12)
|
||||
button.ows_contentEdgeInsets = .init(top: 8, leading: 8, bottom: 8, trailing: 12)
|
||||
button.titleLabel?.font = .dynamicTypeBody2.bold()
|
||||
}
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ public class CVComponentSystemMessage: CVComponentBase, CVRootComponent {
|
||||
default: break
|
||||
}
|
||||
}
|
||||
button.contentEdgeInsets = buttonContentEdgeInsets
|
||||
button.ows_contentEdgeInsets = buttonContentEdgeInsets
|
||||
button.layer.cornerRadius = actionButtonSize.height / 2
|
||||
button.isUserInteractionEnabled = false
|
||||
innerVStackViews.append(button)
|
||||
|
||||
@@ -217,7 +217,7 @@ public class CVComponentThreadDetails: CVComponentBase, CVRootComponent {
|
||||
let safetyButtonLabelConfig = safetyTipsConfig()
|
||||
safetyButtonLabelConfig.applyForRendering(button: showTipsButton)
|
||||
showTipsButton.backgroundColor = Theme.isDarkThemeEnabled ? .ows_gray60 : .ows_gray05
|
||||
showTipsButton.contentEdgeInsets = .init(hMargin: 12.0, vMargin: 8.0)
|
||||
showTipsButton.ows_contentEdgeInsets = .init(hMargin: 12.0, vMargin: 8.0)
|
||||
showTipsButton.dimsWhenHighlighted = true
|
||||
showTipsButton.block = { [weak self] in
|
||||
self?.didShowTips()
|
||||
|
||||
@@ -671,7 +671,7 @@ public class ConversationInputToolbar: UIView, LinkPreviewViewDraftDelegate, Quo
|
||||
lazy var sendButton: UIButton = {
|
||||
let button = UIButton(type: .system)
|
||||
button.accessibilityLabel = MessageStrings.sendButton
|
||||
button.adjustsImageWhenDisabled = true
|
||||
button.ows_adjustsImageWhenDisabled = true
|
||||
button.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "sendButton")
|
||||
button.setImage(UIImage(imageLiteralResourceName: "send-blue-28"), for: .normal)
|
||||
button.bounds.size = CGSize(width: 48, height: LayoutMetrics.minToolbarItemHeight)
|
||||
|
||||
@@ -438,7 +438,7 @@ private class NameCollisionBanner: UIView {
|
||||
button.dimsWhenHighlighted = true
|
||||
|
||||
button.translatesAutoresizingMaskIntoConstraints = false
|
||||
button.contentEdgeInsets = .init(hMargin: 12, vMargin: 6)
|
||||
button.ows_contentEdgeInsets = .init(hMargin: 12, vMargin: 6)
|
||||
button.setCompressionResistanceHigh()
|
||||
button.setContentHuggingLow()
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ class RegistrationPinAttemptsExhaustedAndMustCreateNewPinViewController: OWSView
|
||||
result.backgroundColor = .ows_accentBlue
|
||||
result.titleLabel?.font = UIFont.dynamicTypeBody.semibold()
|
||||
result.titleLabel?.numberOfLines = 0
|
||||
result.contentEdgeInsets = .init(margin: 14)
|
||||
result.ows_contentEdgeInsets = .init(margin: 14)
|
||||
result.autoSetDimension(.height, toSize: 48, relation: .greaterThanOrEqual)
|
||||
return result
|
||||
}()
|
||||
|
||||
@@ -138,7 +138,7 @@ class RegistrationReglockTimeoutViewController: OWSViewController {
|
||||
result.backgroundColor = .ows_accentBlue
|
||||
result.titleLabel?.font = UIFont.dynamicTypeBody.semibold()
|
||||
result.titleLabel?.numberOfLines = 0
|
||||
result.contentEdgeInsets = .init(margin: 14)
|
||||
result.ows_contentEdgeInsets = .init(margin: 14)
|
||||
result.autoSetDimension(.height, toSize: 48, relation: .greaterThanOrEqual)
|
||||
return result
|
||||
}()
|
||||
|
||||
@@ -211,7 +211,7 @@ private class TransferRelaunchSheet: InteractiveSheetViewController {
|
||||
let exitButton = UIButton()
|
||||
exitButton.backgroundColor = .ows_accentBlue
|
||||
exitButton.layer.cornerRadius = 8
|
||||
exitButton.titleEdgeInsets = UIEdgeInsets(hMargin: 0, vMargin: 18)
|
||||
exitButton.ows_titleEdgeInsets = UIEdgeInsets(hMargin: 0, vMargin: 18)
|
||||
exitButton.setTitleColor(.ows_white, for: .normal)
|
||||
exitButton.setTitle(
|
||||
OWSLocalizedString(
|
||||
|
||||
@@ -165,7 +165,7 @@ class UsernameLinkPresentQRCodeViewController: OWSTableViewController2 {
|
||||
)
|
||||
|
||||
button.imageView!.autoSetDimensions(to: .square(24))
|
||||
button.titleEdgeInsets = UIEdgeInsets(top: 0, leading: 6, bottom: 0, trailing: 0)
|
||||
button.ows_titleEdgeInsets = UIEdgeInsets(top: 0, leading: 6, bottom: 0, trailing: 0)
|
||||
button.configureForMultilineTitle()
|
||||
|
||||
button.dimsWhenHighlighted = true
|
||||
@@ -421,7 +421,7 @@ class UsernameLinkPresentQRCodeViewController: OWSTableViewController2 {
|
||||
|
||||
button.setTitle(resetButtonString, for: .normal)
|
||||
|
||||
button.contentEdgeInsets = UIEdgeInsets(hMargin: 16, vMargin: 6)
|
||||
button.ows_contentEdgeInsets = UIEdgeInsets(hMargin: 16, vMargin: 6)
|
||||
button.backgroundColor = Theme.isDarkThemeEnabled ? .ows_gray80 : .ows_whiteAlpha70
|
||||
button.titleLabel!.font = .dynamicTypeBody2.bold()
|
||||
button.setTitleColor(Theme.primaryTextColor, for: .normal)
|
||||
|
||||
@@ -241,7 +241,7 @@ private extension UsernameLinkQRCodeColorPickerViewController {
|
||||
|
||||
setImage(selected: selected)
|
||||
|
||||
adjustsImageWhenHighlighted = false
|
||||
ows_adjustsImageWhenHighlighted = false
|
||||
autoPinToSquareAspectRatio()
|
||||
autoSetDimension(.width, toSize: size)
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ class UsernameLinkScanQRCodeViewController: OWSViewController, OWSNavigationChil
|
||||
self?.didTapUploadPhotoButton()
|
||||
}
|
||||
|
||||
button.contentEdgeInsets = UIEdgeInsets(margin: 14)
|
||||
button.ows_contentEdgeInsets = UIEdgeInsets(margin: 14)
|
||||
|
||||
// Always use dark theming since it sits over the scan mask.
|
||||
button.setTemplateImageName(
|
||||
|
||||
@@ -246,7 +246,7 @@ public class BadgeGiftingChooseBadgeViewController: OWSTableViewController2 {
|
||||
retryButton.setTitleColor(.ows_gray90, for: .normal)
|
||||
retryButton.setBackgroundImage(UIImage.image(color: .ows_gray05), for: .normal)
|
||||
}
|
||||
retryButton.contentEdgeInsets = UIEdgeInsets(hMargin: 16, vMargin: 6)
|
||||
retryButton.ows_contentEdgeInsets = UIEdgeInsets(hMargin: 16, vMargin: 6)
|
||||
retryButton.autoPinWidthToSuperviewMargins(relation: .lessThanOrEqual)
|
||||
retryButton.autoHCenterInSuperview()
|
||||
retryButton.setContentHuggingHigh()
|
||||
|
||||
@@ -22,7 +22,7 @@ class DonationReceiptViewController: OWSTableViewController2 {
|
||||
button.titleLabel?.font = .dynamicTypeBodyClamped.semibold()
|
||||
button.clipsToBounds = true
|
||||
button.layer.cornerRadius = 8
|
||||
button.contentEdgeInsets = UIEdgeInsets(top: 13, leading: 13, bottom: 13, trailing: 13)
|
||||
button.ows_contentEdgeInsets = UIEdgeInsets(top: 13, leading: 13, bottom: 13, trailing: 13)
|
||||
button.dimsWhenHighlighted = true
|
||||
button.backgroundColor = .ows_accentBlue
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ class PaypalButton: UIButton {
|
||||
|
||||
private func configureStyling() {
|
||||
setImage(UIImage(named: "paypal-logo"), for: .normal)
|
||||
adjustsImageWhenDisabled = false
|
||||
adjustsImageWhenHighlighted = false
|
||||
ows_adjustsImageWhenDisabled = false
|
||||
ows_adjustsImageWhenHighlighted = false
|
||||
layer.cornerRadius = 12
|
||||
layer.borderWidth = 0
|
||||
|
||||
|
||||
@@ -810,7 +810,7 @@ class ProfileSettingsViewController: OWSTableViewController2 {
|
||||
|
||||
changeButton.setTitle(OWSLocalizedString("CHANGE_AVATAR_BUTTON_LABEL", comment: "Button label to allow user to change avatar"), for: .normal)
|
||||
changeButton.titleLabel?.font = .dynamicTypeBody2.semibold()
|
||||
changeButton.contentEdgeInsets = UIEdgeInsets(hMargin: 16, vMargin: 6)
|
||||
changeButton.ows_contentEdgeInsets = UIEdgeInsets(hMargin: 16, vMargin: 6)
|
||||
changeButton.layer.cornerRadius = 16
|
||||
|
||||
changeButton.setTitleColor(Theme.isDarkThemeEnabled ? .ows_gray05 : .ows_gray95, for: .normal)
|
||||
|
||||
@@ -266,7 +266,7 @@ class RecentPhotosCollectionView: UICollectionView {
|
||||
let highlightedBgColor = Theme.isDarkThemeEnabled ? UIColor(white: 1, alpha: 0.26) : UIColor(white: 0, alpha: 0.18)
|
||||
button.setBackgroundImage(UIImage.image(color: highlightedBgColor), for: .highlighted)
|
||||
|
||||
button.contentEdgeInsets = UIEdgeInsets(top: 7, leading: 16, bottom: 7, trailing: 16)
|
||||
button.ows_contentEdgeInsets = UIEdgeInsets(top: 7, leading: 16, bottom: 7, trailing: 16)
|
||||
button.heightAnchor.constraint(greaterThanOrEqualToConstant: 32).isActive = true
|
||||
button.layer.masksToBounds = true
|
||||
button.layer.cornerRadius = 16
|
||||
|
||||
@@ -177,7 +177,7 @@ class StoryContextOnboardingOverlayView: UIView, Dependencies {
|
||||
confirmButton.titleLabel?.font = .dynamicTypeSubheadlineClamped.semibold()
|
||||
confirmButton.backgroundColor = .ows_white
|
||||
confirmButton.setTitleColor(.ows_black, for: .normal)
|
||||
confirmButton.contentEdgeInsets = UIEdgeInsets(hMargin: 23, vMargin: 8)
|
||||
confirmButton.ows_contentEdgeInsets = UIEdgeInsets(hMargin: 23, vMargin: 8)
|
||||
confirmButton.block = { [weak self] in
|
||||
self?.dismiss()
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ class StoryContextViewController: OWSViewController {
|
||||
self?.dismiss(animated: true)
|
||||
}
|
||||
closeButton.setShadow()
|
||||
closeButton.imageEdgeInsets = UIEdgeInsets(hMargin: 16, vMargin: 16)
|
||||
closeButton.ows_imageEdgeInsets = UIEdgeInsets(hMargin: 16, vMargin: 16)
|
||||
view.addSubview(closeButton)
|
||||
closeButton.autoSetDimensions(to: CGSize(square: 56))
|
||||
closeButton.autoPinEdge(toSuperviewSafeArea: .top)
|
||||
@@ -562,11 +562,11 @@ class StoryContextViewController: OWSViewController {
|
||||
|
||||
if let leadingIcon = leadingIcon {
|
||||
repliesAndViewsButton.setImage(leadingIcon.asTintedImage(color: Theme.darkThemePrimaryColor), for: .normal)
|
||||
repliesAndViewsButton.imageEdgeInsets = UIEdgeInsets(top: 2, leading: 0, bottom: 0, trailing: 16)
|
||||
repliesAndViewsButton.ows_imageEdgeInsets = UIEdgeInsets(top: 2, leading: 0, bottom: 0, trailing: 16)
|
||||
} else if let trailingIcon = trailingIcon {
|
||||
repliesAndViewsButton.setImage(trailingIcon.asTintedImage(color: Theme.darkThemePrimaryColor), for: .normal)
|
||||
repliesAndViewsButton.semanticContentAttribute = CurrentAppContext().isRTL ? .forceLeftToRight : .forceRightToLeft
|
||||
repliesAndViewsButton.imageEdgeInsets = UIEdgeInsets(top: 3, leading: 0, bottom: 0, trailing: 0)
|
||||
repliesAndViewsButton.ows_imageEdgeInsets = UIEdgeInsets(top: 3, leading: 0, bottom: 0, trailing: 0)
|
||||
} else {
|
||||
repliesAndViewsButton.setImage(nil, for: .normal)
|
||||
repliesAndViewsButton.contentHorizontalAlignment = .center
|
||||
|
||||
@@ -167,7 +167,7 @@ class StoryGroupRepliesAndViewsSheet: InteractiveSheetViewController, StoryGroup
|
||||
button.layer.cornerRadius = 14
|
||||
button.clipsToBounds = true
|
||||
button.titleLabel?.font = UIFont.semiboldFont(ofSize: 15)
|
||||
button.contentEdgeInsets = UIEdgeInsets(hMargin: 12, vMargin: 4)
|
||||
button.ows_contentEdgeInsets = UIEdgeInsets(hMargin: 12, vMargin: 4)
|
||||
button.setTitle(title, for: .normal)
|
||||
button.setTitleColor(Theme.darkThemePrimaryColor, for: .normal)
|
||||
button.setBackgroundImage(UIImage.image(color: .ows_gray65), for: .selected)
|
||||
|
||||
@@ -142,7 +142,7 @@ class StoryViewsViewController: OWSViewController {
|
||||
settingsButton.setTitle(CommonStrings.goToSettingsButton, for: .normal)
|
||||
settingsButton.titleLabel?.font = UIFont.dynamicTypeCaption1.semibold()
|
||||
settingsButton.setTitleColor(.ows_gray25, for: .normal)
|
||||
settingsButton.contentEdgeInsets = UIEdgeInsets(hMargin: 14, vMargin: 6)
|
||||
settingsButton.ows_contentEdgeInsets = UIEdgeInsets(hMargin: 14, vMargin: 6)
|
||||
settingsButton.layer.borderWidth = 1.5
|
||||
settingsButton.layer.borderColor = UIColor.ows_gray25.cgColor
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class LinkPreviewAttachmentViewController: InteractiveSheetViewController {
|
||||
private let doneButton: UIButton = {
|
||||
let button = RoundMediaButton(image: Theme.iconImage(.checkmark), backgroundStyle: .solid(.ows_accentBlue))
|
||||
button.layoutMargins = .zero
|
||||
button.contentEdgeInsets = UIEdgeInsets(margin: 10)
|
||||
button.ows_contentEdgeInsets = UIEdgeInsets(margin: 10)
|
||||
button.layoutMargins = UIEdgeInsets(margin: 4)
|
||||
button.setContentHuggingHigh()
|
||||
return button
|
||||
|
||||
@@ -69,7 +69,7 @@ public class LocationPicker: UIViewController {
|
||||
|
||||
// This icon doesn't look right when it's actually centered due to its odd shape.
|
||||
currentLocationButton.setTemplateImageName("location", tintColor: .white)
|
||||
currentLocationButton.contentEdgeInsets = UIEdgeInsets(top: 2, left: 0, bottom: 0, right: 2)
|
||||
currentLocationButton.ows_contentEdgeInsets = UIEdgeInsets(top: 2, left: 0, bottom: 0, right: 2)
|
||||
|
||||
view.addSubview(currentLocationButton)
|
||||
currentLocationButton.autoSetDimensions(to: CGSize(square: 48))
|
||||
|
||||
@@ -88,7 +88,7 @@ class MediaControlPanelView: UIView {
|
||||
button.addTarget(self, action: #selector(didPressForward), for: .touchUpInside)
|
||||
button.contentVerticalAlignment = .center
|
||||
button.contentHorizontalAlignment = .center
|
||||
button.contentEdgeInsets = UIEdgeInsets(margin: 8)
|
||||
button.ows_contentEdgeInsets = UIEdgeInsets(margin: 8)
|
||||
button.autoPin(toAspectRatio: 1)
|
||||
return button
|
||||
}()
|
||||
@@ -99,7 +99,7 @@ class MediaControlPanelView: UIView {
|
||||
button.addTarget(self, action: #selector(didPressShare), for: .touchUpInside)
|
||||
button.contentVerticalAlignment = .center
|
||||
button.contentHorizontalAlignment = .center
|
||||
button.contentEdgeInsets = UIEdgeInsets(margin: 8)
|
||||
button.ows_contentEdgeInsets = UIEdgeInsets(margin: 8)
|
||||
button.autoPin(toAspectRatio: 1)
|
||||
return button
|
||||
}()
|
||||
|
||||
@@ -1472,7 +1472,7 @@ private class MediaGalleryEmptyContentView: UICollectionReusableView {
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
contentEdgeInsets = UIEdgeInsets(hMargin: 22, vMargin: 12)
|
||||
ows_contentEdgeInsets = UIEdgeInsets(hMargin: 22, vMargin: 12)
|
||||
addSubview(backgroundPillView)
|
||||
sendSubviewToBack(backgroundPillView)
|
||||
backgroundPillView.autoPinEdgesToSuperviewEdges(with: UIEdgeInsets(margin: 8))
|
||||
|
||||
@@ -83,7 +83,7 @@ class VideoPlaybackControlView: UIView {
|
||||
let buttons = [ buttonRewind, buttonPlay, buttonPause, buttonFastForward ]
|
||||
buttons.forEach { button in
|
||||
button.translatesAutoresizingMaskIntoConstraints = false
|
||||
button.contentEdgeInsets = UIEdgeInsets(margin: 8)
|
||||
button.ows_contentEdgeInsets = UIEdgeInsets(margin: 8)
|
||||
addSubview(button)
|
||||
}
|
||||
|
||||
|
||||
@@ -1216,7 +1216,7 @@ class MediaPickerThumbnailButton: UIButton {
|
||||
private static let contentMargin: CGFloat = 8
|
||||
|
||||
func configure() {
|
||||
contentEdgeInsets = UIEdgeInsets(margin: MediaPickerThumbnailButton.contentMargin)
|
||||
ows_contentEdgeInsets = UIEdgeInsets(margin: MediaPickerThumbnailButton.contentMargin)
|
||||
|
||||
let placeholderView = UIVisualEffectView(effect: UIBlurEffect(style: .light))
|
||||
placeholderView.layer.cornerRadius = 10
|
||||
@@ -1225,7 +1225,7 @@ class MediaPickerThumbnailButton: UIButton {
|
||||
placeholderView.clipsToBounds = true
|
||||
placeholderView.isUserInteractionEnabled = false
|
||||
insertSubview(placeholderView, at: 0)
|
||||
placeholderView.autoPinEdgesToSuperviewEdges(with: contentEdgeInsets)
|
||||
placeholderView.autoPinEdgesToSuperviewEdges(with: ows_contentEdgeInsets)
|
||||
|
||||
var authorizationStatus: PHAuthorizationStatus
|
||||
authorizationStatus = PHPhotoLibrary.authorizationStatus(for: .readWrite)
|
||||
@@ -1260,8 +1260,10 @@ class MediaPickerThumbnailButton: UIButton {
|
||||
}
|
||||
|
||||
override var intrinsicContentSize: CGSize {
|
||||
return CGSize(width: contentEdgeInsets.leading + Self.visibleSize + contentEdgeInsets.trailing,
|
||||
height: contentEdgeInsets.top + Self.visibleSize + contentEdgeInsets.bottom)
|
||||
return CGSize(
|
||||
width: ows_contentEdgeInsets.leading + Self.visibleSize + ows_contentEdgeInsets.trailing,
|
||||
height: ows_contentEdgeInsets.top + Self.visibleSize + ows_contentEdgeInsets.bottom
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1406,7 +1408,7 @@ class CameraBottomBar: UIView {
|
||||
let proceedButton: UIButton = {
|
||||
let button = UIButton(type: .system)
|
||||
button.setImage(UIImage(imageLiteralResourceName: "chevron-right-colored-42"), for: .normal)
|
||||
button.contentEdgeInsets = UIEdgeInsets(margin: 8)
|
||||
button.ows_contentEdgeInsets = UIEdgeInsets(margin: 8)
|
||||
button.sizeToFit()
|
||||
return button
|
||||
}()
|
||||
|
||||
@@ -401,7 +401,7 @@ class PhotoCaptureViewController: OWSViewController, OWSNavigationChildControlle
|
||||
private lazy var textBackgroundSelectionButton = RoundGradientButton()
|
||||
private lazy var textViewAttachLinkButton: UIButton = {
|
||||
let button = RoundMediaButton(image: UIImage(imageLiteralResourceName: "link"), backgroundStyle: .blur)
|
||||
button.contentEdgeInsets = UIEdgeInsets(margin: 3)
|
||||
button.ows_contentEdgeInsets = UIEdgeInsets(margin: 3)
|
||||
button.layoutMargins = .zero
|
||||
return button
|
||||
}()
|
||||
@@ -936,7 +936,7 @@ extension PhotoCaptureViewController {
|
||||
|
||||
super.init(image: nil, backgroundStyle: .blur, customView: gradientCircleView)
|
||||
|
||||
contentEdgeInsets = .zero
|
||||
ows_contentEdgeInsets = .zero
|
||||
layoutMargins = .zero
|
||||
}
|
||||
|
||||
@@ -1883,7 +1883,7 @@ private class TextStoryComposerView: TextAttachmentView, UITextViewDelegate {
|
||||
private lazy var deleteLinkPreviewButton: UIButton = {
|
||||
let button = RoundMediaButton(image: Theme.iconImage(.buttonX), backgroundStyle: .blurLight)
|
||||
button.tintColor = Theme.lightThemePrimaryColor
|
||||
button.contentEdgeInsets = UIEdgeInsets(margin: 8)
|
||||
button.ows_contentEdgeInsets = UIEdgeInsets(margin: 8)
|
||||
button.layoutMargins = UIEdgeInsets(margin: 2)
|
||||
button.translatesAutoresizingMaskIntoConstraints = false
|
||||
button.addTarget(self, action: #selector(didTapDeleteLinkPreviewButton), for: .touchUpInside)
|
||||
|
||||
@@ -73,7 +73,7 @@ public class StickerPackViewController: OWSViewController {
|
||||
|
||||
dismissButton.setTemplateImage(Theme.iconImage(.buttonX), tintColor: Theme.darkThemePrimaryColor)
|
||||
dismissButton.addTarget(self, action: #selector(dismissButtonPressed(sender:)), for: .touchUpInside)
|
||||
dismissButton.contentEdgeInsets = UIEdgeInsets(top: 20, leading: hMargin, bottom: 20, trailing: hMargin)
|
||||
dismissButton.ows_contentEdgeInsets = UIEdgeInsets(top: 20, leading: hMargin, bottom: 20, trailing: hMargin)
|
||||
dismissButton.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "dismissButton")
|
||||
|
||||
coverView.autoSetDimensions(to: CGSize(square: 64))
|
||||
|
||||
@@ -92,7 +92,7 @@ class ViewOnceMessageViewController: OWSViewController {
|
||||
dismissButton.layer.shadowOpacity = 0.7
|
||||
dismissButton.layer.shadowRadius = 3.0
|
||||
|
||||
dismissButton.contentEdgeInsets = UIEdgeInsets(top: vMargin, leading: hMargin, bottom: vMargin, trailing: hMargin)
|
||||
dismissButton.ows_contentEdgeInsets = UIEdgeInsets(top: vMargin, leading: hMargin, bottom: vMargin, trailing: hMargin)
|
||||
view.addSubview(dismissButton)
|
||||
dismissButton.autoPinEdge(.leading, to: .leading, of: mediaView)
|
||||
dismissButton.autoPinEdge(.top, to: .top, of: mediaView)
|
||||
|
||||
@@ -438,7 +438,7 @@ private class MediaToolbar: UIView {
|
||||
UIImage(imageLiteralResourceName: AttachmentApprovalToolbar.Configuration.DoneButtonIcon.send.rawValue),
|
||||
for: .normal
|
||||
)
|
||||
button.contentEdgeInsets = UIEdgeInsets(margin: UIDevice.current.isNarrowerThanIPhone6 ? 4 : 8)
|
||||
button.ows_contentEdgeInsets = UIEdgeInsets(margin: UIDevice.current.isNarrowerThanIPhone6 ? 4 : 8)
|
||||
button.accessibilityLabel = MessageStrings.sendButton
|
||||
button.sizeToFit()
|
||||
return button
|
||||
|
||||
@@ -1333,7 +1333,7 @@ extension AddMoreRailItem: GalleryRailItem {
|
||||
)
|
||||
button.isUserInteractionEnabled = false
|
||||
button.layoutMargins = .zero
|
||||
button.contentEdgeInsets = .zero
|
||||
button.ows_contentEdgeInsets = .zero
|
||||
return button
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ class AttachmentTextToolbar: UIView {
|
||||
}
|
||||
let visibleButtonSize = kMinTextViewHeight
|
||||
doneButton.layoutMargins = UIEdgeInsets(top: 0, leading: 8, bottom: 0, trailing: 0)
|
||||
doneButton.contentEdgeInsets = doneButton.layoutMargins
|
||||
doneButton.ows_contentEdgeInsets = doneButton.layoutMargins
|
||||
doneButton.accessibilityLabel = CommonStrings.doneButton
|
||||
let blueCircle = CircleView(diameter: visibleButtonSize)
|
||||
blueCircle.backgroundColor = .ows_accentBlue
|
||||
|
||||
@@ -63,8 +63,8 @@ open class CVButton: OWSButton, CVView {
|
||||
self.block = {}
|
||||
self.dimsWhenDisabled = false
|
||||
self.dimsWhenHighlighted = false
|
||||
self.contentEdgeInsets = .zero
|
||||
self.titleEdgeInsets = .zero
|
||||
self.ows_contentEdgeInsets = .zero
|
||||
self.ows_titleEdgeInsets = .zero
|
||||
[
|
||||
UIControl.State.normal,
|
||||
.highlighted,
|
||||
|
||||
@@ -91,7 +91,7 @@ class ImageEditorCropViewController: OWSViewController {
|
||||
let button = RoundMediaButton(image: nil, backgroundStyle: .blur)
|
||||
let buttonTitle = OWSLocalizedString("MEDIA_EDITOR_RESET", comment: "Title for the button that resets photo to its initial state.")
|
||||
button.setTitle(buttonTitle, for: .normal)
|
||||
button.contentEdgeInsets = UIEdgeInsets(hMargin: 26, vMargin: 15) // Make button 36pts tall at default text size.
|
||||
button.ows_contentEdgeInsets = UIEdgeInsets(hMargin: 26, vMargin: 15) // Make button 36pts tall at default text size.
|
||||
button.addTarget(self, action: #selector(didTapReset), for: .touchUpInside)
|
||||
return button
|
||||
}()
|
||||
|
||||
@@ -29,7 +29,7 @@ class ImageEditorTopBar: MediaTopBar {
|
||||
OWSLocalizedString("MEDIA_EDITOR_CLEAR_ALL",
|
||||
comment: "Title for the button that discards all edits in media editor.")
|
||||
clearAllButton.setTitle(clearAllButtonTitle, for: .normal)
|
||||
clearAllButton.contentEdgeInsets = UIEdgeInsets(hMargin: 26, vMargin: 15)
|
||||
clearAllButton.ows_contentEdgeInsets = UIEdgeInsets(hMargin: 26, vMargin: 15)
|
||||
|
||||
let stackView = UIStackView(arrangedSubviews: [ undoButton, UIView.hStretchingSpacer(), clearAllButton ])
|
||||
for button in stackView.arrangedSubviews {
|
||||
|
||||
@@ -51,7 +51,7 @@ class ContactReminderTableViewCell: UITableViewCell {
|
||||
button.setTitleColor(textColor, for: .normal)
|
||||
button.titleLabel!.font = .dynamicTypeBody2.semibold()
|
||||
button.addTarget(self, action: #selector(didTapLearnMore), for: .touchUpInside)
|
||||
button.contentEdgeInsets = UIEdgeInsets(top: 6, left: 0, bottom: 3, right: 0)
|
||||
button.ows_contentEdgeInsets = UIEdgeInsets(top: 6, left: 0, bottom: 3, right: 0)
|
||||
button.setCompressionResistanceHigh()
|
||||
return button
|
||||
}()
|
||||
|
||||
@@ -185,10 +185,12 @@ private class NewMemberCell: UICollectionViewCell {
|
||||
let removeButton = UIButton(type: .custom)
|
||||
removeButton.setTemplateImage(Theme.iconImage(.buttonX), tintColor: Theme.primaryTextColor)
|
||||
// Extend the hot area of the remove button.
|
||||
removeButton.imageEdgeInsets = UIEdgeInsets(top: Self.removeButtonInset,
|
||||
left: Self.removeButtonInset,
|
||||
bottom: Self.removeButtonInset,
|
||||
right: Self.removeButtonInset)
|
||||
removeButton.ows_imageEdgeInsets = UIEdgeInsets(
|
||||
top: Self.removeButtonInset,
|
||||
left: Self.removeButtonInset,
|
||||
bottom: Self.removeButtonInset,
|
||||
right: Self.removeButtonInset
|
||||
)
|
||||
removeButton.addTarget(self, action: #selector(removeButtonWasPressed), for: .touchUpInside)
|
||||
let buttonSize = Self.removeButtonXSize + 2 * Self.removeButtonInset
|
||||
removeButton.autoSetDimensions(to: CGSize(square: buttonSize))
|
||||
|
||||
8
SignalUI/SignalUI.h
Normal file
8
SignalUI/SignalUI.h
Normal file
@@ -0,0 +1,8 @@
|
||||
//
|
||||
// Copyright 2024 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <SignalUI/UIButton+DeprecationWorkaround.h>
|
||||
21
SignalUI/UIKitExtensions/UIButton+DeprecationWorkaround.h
Normal file
21
SignalUI/UIKitExtensions/UIButton+DeprecationWorkaround.h
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// Copyright 2024 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface UIButton (DeprecationWorkaround)
|
||||
|
||||
@property (nonatomic, setter=ows_setAdjustsImageWhenDisabled:) BOOL ows_adjustsImageWhenDisabled;
|
||||
@property (nonatomic, setter=ows_setAdjustsImageWhenHighlighted:) BOOL ows_adjustsImageWhenHighlighted;
|
||||
|
||||
@property (nonatomic, setter=ows_setContentEdgeInsets:) UIEdgeInsets ows_contentEdgeInsets;
|
||||
@property (nonatomic, setter=ows_setImageEdgeInsets:) UIEdgeInsets ows_imageEdgeInsets;
|
||||
@property (nonatomic, setter=ows_setTitleEdgeInsets:) UIEdgeInsets ows_titleEdgeInsets;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
65
SignalUI/UIKitExtensions/UIButton+DeprecationWorkaround.m
Normal file
65
SignalUI/UIKitExtensions/UIButton+DeprecationWorkaround.m
Normal file
@@ -0,0 +1,65 @@
|
||||
//
|
||||
// Copyright 2024 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
//
|
||||
|
||||
#import "UIButton+DeprecationWorkaround.h"
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
@implementation UIButton (DeprecationWorkaround)
|
||||
|
||||
- (BOOL)ows_adjustsImageWhenDisabled
|
||||
{
|
||||
return self.adjustsImageWhenDisabled;
|
||||
}
|
||||
|
||||
- (void)ows_setAdjustsImageWhenDisabled:(BOOL)adjustsImageWhenDisabled
|
||||
{
|
||||
self.adjustsImageWhenDisabled = adjustsImageWhenDisabled;
|
||||
}
|
||||
|
||||
- (BOOL)ows_adjustsImageWhenHighlighted
|
||||
{
|
||||
return self.adjustsImageWhenHighlighted;
|
||||
}
|
||||
|
||||
- (void)ows_setAdjustsImageWhenHighlighted:(BOOL)adjustsImageWhenHighlighted
|
||||
{
|
||||
self.adjustsImageWhenHighlighted = adjustsImageWhenHighlighted;
|
||||
}
|
||||
|
||||
- (UIEdgeInsets)ows_contentEdgeInsets
|
||||
{
|
||||
return self.contentEdgeInsets;
|
||||
}
|
||||
|
||||
- (void)ows_setContentEdgeInsets:(UIEdgeInsets)contentEdgeInsets
|
||||
{
|
||||
self.contentEdgeInsets = contentEdgeInsets;
|
||||
}
|
||||
|
||||
- (UIEdgeInsets)ows_imageEdgeInsets
|
||||
{
|
||||
return self.imageEdgeInsets;
|
||||
}
|
||||
|
||||
- (void)ows_setImageEdgeInsets:(UIEdgeInsets)imageEdgeInsets
|
||||
{
|
||||
self.imageEdgeInsets = imageEdgeInsets;
|
||||
}
|
||||
|
||||
- (UIEdgeInsets)ows_titleEdgeInsets
|
||||
{
|
||||
return self.titleEdgeInsets;
|
||||
}
|
||||
|
||||
- (void)ows_setTitleEdgeInsets:(UIEdgeInsets)titleEdgeInsets
|
||||
{
|
||||
self.titleEdgeInsets = titleEdgeInsets;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
@@ -15,29 +15,29 @@ public extension UIButton {
|
||||
/// [0]: https://github.com/noahsark769/NGUIButtonInsetsExample
|
||||
func setPaddingBetweenImageAndText(to padding: CGFloat, isRightToLeft: Bool) {
|
||||
if isRightToLeft {
|
||||
contentEdgeInsets = .init(
|
||||
top: contentEdgeInsets.top,
|
||||
ows_contentEdgeInsets = .init(
|
||||
top: ows_contentEdgeInsets.top,
|
||||
left: padding,
|
||||
bottom: contentEdgeInsets.bottom,
|
||||
right: contentEdgeInsets.right
|
||||
bottom: ows_contentEdgeInsets.bottom,
|
||||
right: ows_contentEdgeInsets.right
|
||||
)
|
||||
titleEdgeInsets = .init(
|
||||
top: titleEdgeInsets.top,
|
||||
ows_titleEdgeInsets = .init(
|
||||
top: ows_titleEdgeInsets.top,
|
||||
left: -padding,
|
||||
bottom: titleEdgeInsets.bottom,
|
||||
bottom: ows_titleEdgeInsets.bottom,
|
||||
right: padding
|
||||
)
|
||||
} else {
|
||||
contentEdgeInsets = .init(
|
||||
top: contentEdgeInsets.top,
|
||||
left: contentEdgeInsets.left,
|
||||
bottom: contentEdgeInsets.bottom,
|
||||
ows_contentEdgeInsets = .init(
|
||||
top: ows_contentEdgeInsets.top,
|
||||
left: ows_contentEdgeInsets.left,
|
||||
bottom: ows_contentEdgeInsets.bottom,
|
||||
right: padding
|
||||
)
|
||||
titleEdgeInsets = .init(
|
||||
top: titleEdgeInsets.top,
|
||||
ows_titleEdgeInsets = .init(
|
||||
top: ows_titleEdgeInsets.top,
|
||||
left: padding,
|
||||
bottom: titleEdgeInsets.bottom,
|
||||
bottom: ows_titleEdgeInsets.bottom,
|
||||
right: -padding
|
||||
)
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class FindByUsernameViewController: OWSTableViewController2 {
|
||||
button.setAttributedTitle(title, for: .normal)
|
||||
button.backgroundColor = Theme.tableCell2PresentedBackgroundColor
|
||||
button.dimsWhenHighlighted = true
|
||||
button.contentEdgeInsets = .init(hMargin: 16, vMargin: 6)
|
||||
button.ows_contentEdgeInsets = .init(hMargin: 16, vMargin: 6)
|
||||
cell.addSubview(button)
|
||||
button.autoPinEdge(toSuperviewMargin: .top)
|
||||
button.autoPinEdge(toSuperviewMargin: .bottom)
|
||||
|
||||
@@ -38,9 +38,9 @@ class VideoEditorView: UIView {
|
||||
playButton.accessibilityLabel = OWSLocalizedString("PLAY_BUTTON_ACCESSABILITY_LABEL",
|
||||
comment: "Accessibility label for button to start media playback")
|
||||
// this makes the blur circle 72 pts in diameter
|
||||
playButton.contentEdgeInsets = UIEdgeInsets(margin: 26)
|
||||
playButton.ows_contentEdgeInsets = UIEdgeInsets(margin: 26)
|
||||
// play button must be slightly off-center to appear centered
|
||||
playButton.imageEdgeInsets = UIEdgeInsets(top: 0, leading: 3, bottom: 0, trailing: -3)
|
||||
playButton.ows_imageEdgeInsets = UIEdgeInsets(top: 0, leading: 3, bottom: 0, trailing: -3)
|
||||
playButton.addTarget(self, action: #selector(playButtonTapped), for: .touchUpInside)
|
||||
return playButton
|
||||
}()
|
||||
|
||||
@@ -564,9 +564,9 @@ public class ActionSheetAction: NSObject {
|
||||
|
||||
private func updateEdgeInsets() {
|
||||
if !leadingIconView.isHidden || !trailingIconView.isHidden || contentAlignment != .center {
|
||||
contentEdgeInsets = UIEdgeInsets(top: 16, leading: 56, bottom: 16, trailing: 56)
|
||||
ows_contentEdgeInsets = UIEdgeInsets(top: 16, leading: 56, bottom: 16, trailing: 56)
|
||||
} else {
|
||||
contentEdgeInsets = UIEdgeInsets(top: 16, leading: 16, bottom: 16, trailing: 16)
|
||||
ows_contentEdgeInsets = UIEdgeInsets(top: 16, leading: 16, bottom: 16, trailing: 16)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -131,9 +131,9 @@ open class OWSButton: UIButton {
|
||||
/// Does so by modifying `contentEdgeInsets` and `titleEdgeInsets`,
|
||||
/// so call this after setting those.
|
||||
public func addImageTitleSpacing(_ spacing: CGFloat) {
|
||||
contentEdgeInsets.trailing += spacing
|
||||
titleEdgeInsets.leading += spacing
|
||||
titleEdgeInsets.trailing -= spacing
|
||||
ows_contentEdgeInsets.trailing += spacing
|
||||
ows_titleEdgeInsets.leading += spacing
|
||||
ows_titleEdgeInsets.trailing -= spacing
|
||||
}
|
||||
|
||||
// MARK: - Common Style Reuse
|
||||
|
||||
@@ -42,19 +42,19 @@ public class OWSFlatButton: UIView {
|
||||
|
||||
public var titleEdgeInsets: UIEdgeInsets {
|
||||
get {
|
||||
return button.titleEdgeInsets
|
||||
return button.ows_titleEdgeInsets
|
||||
}
|
||||
set {
|
||||
button.titleEdgeInsets = newValue
|
||||
button.ows_titleEdgeInsets = newValue
|
||||
}
|
||||
}
|
||||
|
||||
public var contentEdgeInsets: UIEdgeInsets {
|
||||
get {
|
||||
return button.contentEdgeInsets
|
||||
return button.ows_contentEdgeInsets
|
||||
}
|
||||
set {
|
||||
button.contentEdgeInsets = newValue
|
||||
button.ows_contentEdgeInsets = newValue
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ open class RoundMediaButton: UIButton {
|
||||
|
||||
super.init(frame: CGRect(origin: .zero, size: .square(Self.visibleButtonSize + 2*Self.defaultInset)))
|
||||
|
||||
contentEdgeInsets = UIEdgeInsets(margin: Self.defaultContentInset)
|
||||
ows_contentEdgeInsets = UIEdgeInsets(margin: Self.defaultContentInset)
|
||||
layoutMargins = UIEdgeInsets(margin: Self.defaultInset)
|
||||
tintColor = Theme.darkThemePrimaryColor
|
||||
insetsLayoutMarginsFromSafeArea = false
|
||||
|
||||
Reference in New Issue
Block a user