Remove iOS 26 SDK checks

This commit is contained in:
Max Radermacher 2026-01-08 14:30:28 -06:00 committed by GitHub
parent 3c0d3b2e42
commit fdcb84d5e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
48 changed files with 52 additions and 221 deletions

View File

@ -116,7 +116,7 @@ class CallsListViewController: OWSViewController, HomeTabViewController, CallSer
updateBarButtonItems()
OWSTableViewController2.removeBackButtonText(viewController: self)
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
toolbarDeleteButton.image = UIImage(resource: .trash)
self.toolbarItems = [.flexibleSpace(), toolbarDeleteButton]
}
@ -239,7 +239,7 @@ class CallsListViewController: OWSViewController, HomeTabViewController, CallSer
)
private func showToolbar() {
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
navigationController?.setToolbarHidden(false, animated: true)
(tabBarController as? HomeTabBarController)?.setTabBarHidden(true)
return
@ -357,7 +357,7 @@ class CallsListViewController: OWSViewController, HomeTabViewController, CallSer
}
private func hideToolbar() {
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
self.navigationController?.setToolbarHidden(true, animated: true)
(self.tabBarController as? HomeTabBarController)?.setTabBarHidden(false)
return
@ -2336,10 +2336,8 @@ private extension CallsListViewController {
private func makeJoinButton(viewModel: CallViewModel) -> UIButton {
var config = UIButton.Configuration.borderedProminent()
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
#if compiler(>=6.2)
if #available(iOS 26, *) {
config = UIButton.Configuration.prominentGlass()
#endif
} else {
config.cornerStyle = .capsule
}

View File

@ -308,16 +308,12 @@ public class CVComponentDateHeader: CVComponentBase, CVRootComponent {
if let visualEffectContentView {
return visualEffectContentView
}
#if compiler(>=6.2)
let visualEffectContentView: VisualEffectContentView
if #available(iOS 26.0, *) {
visualEffectContentView = ContentViewWithGlassEffect()
} else {
visualEffectContentView = ContentViewWithBlurEffect()
}
#else
let visualEffectContentView = ContentViewWithBlurEffect()
#endif
self.visualEffectContentView = visualEffectContentView
return visualEffectContentView
}
@ -408,7 +404,6 @@ private class ContentViewWithBlurEffect: VisualEffectContentView {
// MARK: -
#if compiler(>=6.2)
@available(iOS 26.0, *)
private class ContentViewWithGlassEffect: VisualEffectContentView {
private let titleLabel = CVLabel()
@ -445,7 +440,6 @@ private class ContentViewWithGlassEffect: VisualEffectContentView {
titleLabel.text = nil
}
}
#endif
// MARK: -
@ -461,12 +455,10 @@ private class ContentViewNoVisualEffect {
return wallpaperBlurView
}
let wallpaperBlurView = CVWallpaperBlurView()
#if compiler(>=6.2)
if #available(iOS 26.0, *) {
// Will override `cornerRadius` set in `configure...`.
wallpaperBlurView.cornerConfiguration = .capsule()
}
#endif
self.wallpaperBlurView = wallpaperBlurView
return wallpaperBlurView
}

View File

@ -396,11 +396,9 @@ private class QuotedMessageSnippetView: UIView {
let stripeView = UIView()
stripeView.backgroundColor = .Signal.quaternaryLabel
horizonalStack.addArrangedSubview(stripeView)
#if compiler(>=6.2)
if #available(iOS 26, *) {
stripeView.cornerConfiguration = .capsule()
}
#endif
let textStack = UIStackView(arrangedSubviews: [quotedAuthorLabel, quotedTextLabel])
textStack.axis = .vertical

View File

@ -439,7 +439,6 @@ public class ConversationInputToolbar: UIView, QuotedReplyPreviewDelegate {
}()
private lazy var leadingEdgeControl: UIView = {
#if compiler(>=6.2)
guard #unavailable(iOS 26.0) else {
return Buttons.addAttachmentButton(
primaryAction: UIAction { [weak self] _ in
@ -448,7 +447,6 @@ public class ConversationInputToolbar: UIView, QuotedReplyPreviewDelegate {
accessibilityIdentifier: UIView.accessibilityIdentifier(in: self, name: "attachmentButton"),
)
}
#endif
let button = AttachmentButtonLegacy()
button.accessibilityLabel = OWSLocalizedString(
@ -497,7 +495,6 @@ public class ConversationInputToolbar: UIView, QuotedReplyPreviewDelegate {
}()
private lazy var trailingEdgeControl: UIView = {
#if compiler(>=6.2)
if #available(iOS 26, *) {
let button = Buttons.sendButton(
primaryAction: UIAction { [weak self] _ in
@ -508,7 +505,6 @@ public class ConversationInputToolbar: UIView, QuotedReplyPreviewDelegate {
button.tintColor = conversationStyle.bubbleChatColorOutgoing.asSendButtonTintColor()
return button
}
#endif
let view = RightEdgeControlsView(
sendButtonAction: UIAction { [weak self] _ in
@ -2494,7 +2490,6 @@ public class ConversationInputToolbar: UIView, QuotedReplyPreviewDelegate {
}()
private lazy var voiceMemoDeleteButton: UIButton = {
#if compiler(>=6.2)
guard #unavailable(iOS 26.0) else {
return Buttons.deleteVoiceMemoDraftButton(
primaryAction: UIAction { [weak self] _ in
@ -2503,7 +2498,6 @@ public class ConversationInputToolbar: UIView, QuotedReplyPreviewDelegate {
accessibilityIdentifier: UIView.accessibilityIdentifier(in: self, name: "stickerButton"),
)
}
#endif
let button = UIButton(
configuration: .plain(),

View File

@ -23,14 +23,12 @@ public class ConversationScrollButton: UIButton {
super.init(frame: .zero)
var configuration: UIButton.Configuration?
#if compiler(>=6.2)
if #available(iOS 26, *) {
configuration = .glass()
configuration?.imageColorTransformer = UIConfigurationColorTransformer { _ in
return .Signal.label
}
}
#endif
if configuration == nil {
configuration = .gray()
configuration?.imageColorTransformer = UIConfigurationColorTransformer { _ in

View File

@ -86,7 +86,6 @@ extension ConversationViewController: UIGestureRecognizerDelegate {
}
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
#if compiler(>=6.2)
if
#available(iOS 26, *),
otherGestureRecognizer == navigationController?.interactiveContentPopGestureRecognizer,
@ -96,7 +95,6 @@ extension ConversationViewController: UIGestureRecognizerDelegate {
// Allow content pop gesture if there is no pan handler
return true
}
#endif
// Support standard long press recognizing for body text cases, and context menu long press recognizing for everything else
let currentIsLongPressOrTap = (gestureRecognizer == collectionViewLongPressGestureRecognizer || gestureRecognizer == collectionViewContextMenuGestureRecognizer || gestureRecognizer == collectionViewTapGestureRecognizer)

View File

@ -270,7 +270,6 @@ public final class ConversationViewController: OWSViewController {
selectionToolbar = self.buildSelectionToolbar()
#if compiler(>=6.2)
// Obscures content underneath bottom bar to improve legibility.
if #available(iOS 26, *) {
let scrollInteraction = UIScrollEdgeElementContainerInteraction()
@ -281,7 +280,6 @@ public final class ConversationViewController: OWSViewController {
}
searchController.resultsBar.addInteraction(scrollInteraction)
}
#endif
// This should kick off the first load.
owsAssertDebug(!self.hasRenderState)

View File

@ -98,7 +98,7 @@ class EmojiPickerSectionToolbar: UIView, UICollectionViewDelegate {
}
backgroundView.isHidden = !configuration.displayBackgroundView
imageView.image = Theme.iconImage(configuration.emojiSectionIcon)
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
imageView.tintColor = UIColor.Signal.label
} else {
imageView.tintColor = UIColor.Signal.secondaryLabel
@ -141,7 +141,6 @@ class EmojiPickerSectionToolbar: UIView, UICollectionViewDelegate {
// Prepare background.
var backgroundConfigured = false
#if compiler(>=6.2)
if #available(iOS 26, *) {
// Floating glass panel that encapsulates emoji category strip.
// Insets are carefully configured for best on-screen appearance.
@ -166,7 +165,6 @@ class EmojiPickerSectionToolbar: UIView, UICollectionViewDelegate {
])
backgroundConfigured = true
}
#endif
if !backgroundConfigured {
// Background stretches 500 dp below bottom edge of the screen so that there's no gap where bottom safe area is.
if UIAccessibility.isReduceTransparencyEnabled {

View File

@ -62,7 +62,7 @@ class EmojiPickerSheet: OWSViewController {
override func viewDidLoad() {
super.viewDidLoad()
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
view.backgroundColor = nil
} else {
view.backgroundColor = .tertiarySystemBackground
@ -106,7 +106,6 @@ class EmojiPickerSheet: OWSViewController {
sectionToolbar.bottomAnchor.constraint(equalTo: keyboardLayoutGuide.topAnchor, constant: -8),
])
#if compiler(>=6.2)
// Obscures content underneath the emoji section toolbar to improve legibility.
if #available(iOS 26, *) {
let scrollInteraction = UIScrollEdgeElementContainerInteraction()
@ -114,7 +113,6 @@ class EmojiPickerSheet: OWSViewController {
scrollInteraction.edge = .bottom
sectionToolbar.addInteraction(scrollInteraction)
}
#endif
}
override func viewDidLayoutSubviews() {

View File

@ -28,11 +28,9 @@ public class RegistrationNavigationController: OWSNavigationController {
override public func viewDidLoad() {
super.viewDidLoad()
interactivePopGestureRecognizer?.isEnabled = false
#if compiler(>=6.2)
if #available(iOS 26.0, *) {
interactiveContentPopGestureRecognizer?.isEnabled = false
}
#endif
}
override public func viewWillAppear(_ animated: Bool) {

View File

@ -28,15 +28,11 @@ class RegistrationPhoneNumberInputView: UIView {
// Background
let backgroundView = UIView()
#if compiler(>=6.2)
if #available(iOS 26, *) {
backgroundView.cornerConfiguration = .capsule()
} else {
backgroundView.layer.cornerRadius = 10
}
#else
backgroundView.layer.cornerRadius = 10
#endif
backgroundView.backgroundColor = .Signal.secondaryBackground
addSubview(backgroundView)
backgroundView.translatesAutoresizingMaskIntoConstraints = false

View File

@ -254,16 +254,11 @@ class RegistrationPinViewController: OWSViewController {
result.defaultTextAttributes.updateValue(5, forKey: .kern)
result.accessibilityIdentifier = "registration.pin.pinTextField"
result.delegate = self
#if compiler(>=6.2)
if #available(iOS 26, *) {
result.cornerConfiguration = .capsule()
} else {
result.layer.cornerRadius = 10
}
#else
result.layer.cornerRadius = 10
#endif
return result
}()

View File

@ -116,11 +116,9 @@ class RegistrationProfileViewController: OWSViewController {
let buttonSize: CGFloat = 28
var buttonConfiguration: UIButton.Configuration?
#if compiler(>=6.2)
if #available(iOS 26, *) {
buttonConfiguration = .prominentClearGlass()
}
#endif
if buttonConfiguration == nil {
buttonConfiguration = .filled()
buttonConfiguration?.baseBackgroundColor = .Signal.background
@ -229,14 +227,7 @@ class RegistrationProfileViewController: OWSViewController {
// Stack view has a background so horizontal margins are necessary.
stackView.directionalLayoutMargins = .init(top: 0, leading: 16, bottom: 0, trailing: 8)
stackView.isLayoutMarginsRelativeArrangement = true
#if compiler(>=6.2)
stackView.cornerConfiguration = .uniformCorners(radius: 26)
#else
stackView.layer.cornerRadius = 26
stackView.layer.masksToBounds = true
#endif
} else {
firstTextField.addBottomStroke(color: .Signal.opaqueSeparator, strokeWidth: .hairlineWidth)
secondTextField.addBottomStroke(color: .Signal.opaqueSeparator, strokeWidth: .hairlineWidth)

View File

@ -12,27 +12,19 @@ extension Registration {
enum UI {
private static func primaryButtonStyle() -> some PrimitiveButtonStyle {
#if compiler(>=6.2)
if #available(iOS 26, *) {
return GlassProminentButtonStyle.glassProminent
} else {
return BorderedProminentButtonStyle.borderedProminent
}
#else
return BorderedProminentButtonStyle.borderedProminent
#endif
}
private static func secondaryButtonStyle() -> some PrimitiveButtonStyle {
#if compiler(>=6.2)
if #available(iOS 26, *) {
return GlassProminentButtonStyle.glassProminent
} else {
return PlainButtonStyle.plain
}
#else
return PlainButtonStyle.plain
#endif
}
private static var largeButtonContentPadding: EdgeInsets {

View File

@ -37,7 +37,7 @@ enum ContextualActionBuilder {
// We want to always show a title with the icon. iOS 26 does this by
// default, but previous iOS versions only does when the cell's
// height > 91, so we generate an image with the text below it.
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
let action = UIContextualAction(
style: style,
title: title,

View File

@ -29,12 +29,10 @@ class ApplePayButton: UIButton {
addSubview(applePayButton)
#if compiler(>=6.2)
if #available(iOS 26.0, *) {
tintColor = .Signal.label
configuration = .prominentGlass()
}
#endif
}
required init?(coder: NSCoder) {

View File

@ -30,11 +30,9 @@ class PaypalButton: UIButton {
setImage(UIImage(named: "paypal-logo"), for: .normal)
ows_adjustsImageWhenDisabled = false
ows_adjustsImageWhenHighlighted = false
if #available(iOS 26.0, *), BuildFlags.iOS26SDKIsAvailable {
#if compiler(>=6.2)
if #available(iOS 26.0, *) {
configuration = .prominentGlass()
tintColor = UIColor(rgbHex: 0xF6C757)
#endif
} else {
layer.cornerRadius = 12
backgroundColor = UIColor(rgbHex: 0xF6C757)

View File

@ -251,12 +251,8 @@ class AttachmentFormatPickerView: UIView {
let button: UIButton = {
let button: UIButton
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
#if compiler(>=6.2)
if #available(iOS 26, *) {
button = UIButton(configuration: .glass())
#else
button = UIButton(configuration: .plain())
#endif
} else {
button = ShrinkingOnTapButton(configuration: .gray())
button.configuration?.background.backgroundColorTransformer = UIConfigurationColorTransformer { [weak button] _ in
@ -289,7 +285,7 @@ class AttachmentFormatPickerView: UIView {
private let textLabel: UILabel = {
let label = UILabel()
label.font = .dynamicTypeFootnoteClamped.medium()
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
label.textColor = .Signal.label
} else {
label.textColor = .Signal.secondaryLabel

View File

@ -187,7 +187,7 @@ private class ContextMenuActionsView: UIView, UIGestureRecognizerDelegate, UIScr
}
var maxWidth: CGFloat = 250
let margin: CGFloat = if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
let margin: CGFloat = if #available(iOS 26, *) {
24
} else {
16
@ -195,7 +195,7 @@ private class ContextMenuActionsView: UIView, UIGestureRecognizerDelegate, UIScr
let iconSpacing: CGFloat = 12
let verticalPadding: CGFloat = 23
let iconSize: CGFloat = if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
let iconSize: CGFloat = if #available(iOS 26, *) {
24
} else {
20
@ -299,7 +299,7 @@ private class ContextMenuActionsView: UIView, UIGestureRecognizerDelegate, UIScr
}
titleFrame.width = titleWidth
let iconIsToTheRightOfText = if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
let iconIsToTheRightOfText = if #available(iOS 26, *) {
isRTL
} else {
!isRTL
@ -352,13 +352,13 @@ private class ContextMenuActionsView: UIView, UIGestureRecognizerDelegate, UIScr
}
}
let cornerRadius: CGFloat = if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
let cornerRadius: CGFloat = if #available(iOS 26, *) {
33
} else {
12
}
let vMargin: CGFloat = if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
let vMargin: CGFloat = if #available(iOS 26, *) {
10
} else {
0
@ -409,8 +409,7 @@ private class ContextMenuActionsView: UIView, UIGestureRecognizerDelegate, UIScr
addGestureRecognizer(highlightHoverGestureRecognizer)
self.highlightHoverGestureRecognizer = highlightHoverGestureRecognizer
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
} else {
if #unavailable(iOS 26) {
layer.cornerRadius = cornerRadius
layer.shadowRadius = 64
layer.shadowOffset = CGSize(width: 0, height: 32)

View File

@ -369,7 +369,7 @@ class ContextMenuController: OWSViewController, ContextMenuViewDelegate, UIGestu
private var previewShadowVisible = false {
didSet {
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
return
}
self.previewView?.layer.shadowOpacity = previewShadowVisible ? 0.3 : 0

View File

@ -13,15 +13,11 @@ extension DonateViewController {
result.backgroundColor = DonationViewsUtil.bubbleBackgroundColor
result.layer.borderWidth = DonationViewsUtil.bubbleBorderWidth
result.layer.borderColor = result.backgroundColor?.cgColor
#if compiler(>=6.2)
if #available(iOS 26, *) {
result.cornerConfiguration = .uniformCorners(radius: 26)
} else {
result.layer.cornerRadius = DonateViewController.cornerRadius
}
#else
result.layer.cornerRadius = DonateViewController.cornerRadius
#endif
return result
}()

View File

@ -1096,15 +1096,11 @@ class DonateViewController: OWSViewController, OWSNavigationChildController {
)
field.layer.borderWidth = DonationViewsUtil.bubbleBorderWidth
#if compiler(>=6.2)
if #available(iOS 26, *) {
field.cornerConfiguration = .capsule()
} else {
field.layer.cornerRadius = Self.cornerRadius
}
#else
field.layer.cornerRadius = Self.cornerRadius
#endif
let tap = UITapGestureRecognizer(
target: self,
@ -1183,15 +1179,11 @@ class DonateViewController: OWSViewController, OWSNavigationChildController {
button.enableMultilineLabel()
button.clipsToBounds = true
button.layer.borderWidth = DonationViewsUtil.bubbleBorderWidth
#if compiler(>=6.2)
if #available(iOS 26, *) {
button.cornerConfiguration = .capsule()
} else {
button.layer.cornerRadius = Self.cornerRadius
}
#else
button.layer.cornerRadius = Self.cornerRadius
#endif
row.addArrangedSubview(button)

View File

@ -36,7 +36,7 @@ class ForwardMessageViewController: OWSNavigationController {
),
)
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
self.pickerVC.backgroundStyle = .none
}

View File

@ -151,7 +151,7 @@ public extension ChatListViewController {
func applyArchiveBackButton() {
AssertIsOnMainThread()
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable { return }
if #available(iOS 26, *) { return }
navigationItem.backBarButtonItem = UIBarButtonItem(
title: CommonStrings.backButton,

View File

@ -69,7 +69,7 @@ extension ChatListViewController {
func showToolbar() {
AssertIsOnMainThread()
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
self.updateCaptions()
self.navigationController?.setToolbarHidden(false, animated: true)
(self.tabBarController as? HomeTabBarController)?.setTabBarHidden(true)
@ -152,7 +152,7 @@ extension ChatListViewController {
target: self,
action: #selector(performArchive),
)
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
archiveBtn.image = UIImage(resource: .archive)
}
archiveBtn.isEnabled = hasSelectedEntries
@ -189,7 +189,7 @@ extension ChatListViewController {
}
let deleteBtn = UIBarButtonItem(title: CommonStrings.deleteButton, style: .plain, target: self, action: #selector(performDelete))
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
deleteBtn.image = UIImage(resource: .trash)
}
deleteBtn.isEnabled = hasSelectedEntries
@ -207,7 +207,7 @@ extension ChatListViewController {
private func hideToolbar() {
AssertIsOnMainThread()
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
(self.tabBarController as? HomeTabBarController)?.setTabBarHidden(false)
self.navigationController?.setToolbarHidden(true, animated: true)
return
@ -248,7 +248,7 @@ extension ChatListViewController {
title = String.localizedStringWithFormat(format, count)
}
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
toolbarItems = makeToolbarButtons()
} else {
viewState.multiSelectState.toolbar?.toolbar.setItems(

View File

@ -118,7 +118,7 @@ public class ChatListViewController: OWSViewController, HomeTabViewController {
extendedLayoutIncludesOpaqueBars = true
}
guard #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable else {
guard #available(iOS 26, *) else {
self._viewWillAppear(animated)
return
}
@ -858,7 +858,7 @@ public class ChatListViewController: OWSViewController, HomeTabViewController {
private func applyDefaultBackButton() {
AssertIsOnMainThread()
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable { return }
if #available(iOS 26, *) { return }
// We don't show any text for the back button, so there's no need to localize it. But because we left align the
// conversation title view, we add a little tappable padding after the back button, by having a title of spaces.

View File

@ -417,7 +417,7 @@ public class OWSTabBar: UITabBar {
return
}
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
return
}

View File

@ -45,7 +45,7 @@ extension HomeTabViewController {
contextButton.accessibilityLabel = CommonStrings.openAppSettingsButton
let sizeClass: ConversationAvatarView.Configuration.SizeClass
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
sizeClass = isInFloatingSidebar ? .thirtyTwo : .forty
} else {
sizeClass = .twentyEight
@ -85,11 +85,9 @@ extension HomeTabViewController {
let barButtonItem = UIBarButtonItem(customView: barButtonView)
barButtonItem.accessibilityLabel = CommonStrings.openAppSettingsButton
#if compiler(>=6.2)
if #available(iOS 26.0, *) {
barButtonItem.hidesSharedBackground = true
}
#endif
return barButtonItem
}
}

View File

@ -19,7 +19,6 @@ public class PinConfirmationViewController: OWSViewController {
private lazy var backgroundView: UIView = {
let view = UIView()
view.backgroundColor = .Signal.groupedBackground
#if compiler(>=6.2)
if #available(iOS 26, *) {
view.cornerConfiguration = .corners(
topLeftRadius: .containerConcentric(minimum: 40),
@ -28,7 +27,6 @@ public class PinConfirmationViewController: OWSViewController {
bottomRightRadius: .none,
)
}
#endif
return view
}()
@ -45,15 +43,11 @@ public class PinConfirmationViewController: OWSViewController {
textField.defaultTextAttributes.updateValue(5, forKey: .kern)
textField.accessibilityIdentifier = "pinConfirmation.pinTextField"
textField.delegate = self
#if compiler(>=6.2)
if #available(iOS 26, *) {
textField.cornerConfiguration = .capsule()
} else {
textField.layer.cornerRadius = 10
}
#else
textField.layer.cornerRadius = 10
#endif
let currentPinType = context.db.read { tx in
context.svr.currentPinType(transaction: tx)
}

View File

@ -22,7 +22,6 @@ public class PinReminderViewController: OWSViewController {
private lazy var backgroundView: UIView = {
let view = UIView()
view.backgroundColor = .Signal.groupedBackground
#if compiler(>=6.2)
if #available(iOS 26, *) {
view.cornerConfiguration = .corners(
topLeftRadius: .containerConcentric(minimum: 40),
@ -31,7 +30,6 @@ public class PinReminderViewController: OWSViewController {
bottomRightRadius: .none,
)
}
#endif
return view
}()
@ -48,15 +46,11 @@ public class PinReminderViewController: OWSViewController {
textField.defaultTextAttributes.updateValue(5, forKey: .kern)
textField.accessibilityIdentifier = "pinReminder.pinTextField"
textField.delegate = self
#if compiler(>=6.2)
if #available(iOS 26, *) {
textField.cornerConfiguration = .capsule()
} else {
textField.layer.cornerRadius = 10
}
#else
textField.layer.cornerRadius = 10
#endif
let currentPinType = context.db.read { tx in
context.svr.currentPinType(transaction: tx)
}
@ -252,16 +246,12 @@ public class PinReminderViewController: OWSViewController {
return .ows_gray15
}
})
#if compiler(>=6.2)
if #available(iOS 26.0, *) {
buttonConfiguration = .prominentClearGlass()
buttonImageColor = .Signal.label
} else {
buttonConfiguration = .plain()
}
#else
buttonConfiguration = .plain()
#endif
let dismissButton = UIButton(
configuration: buttonConfiguration,
primaryAction: UIAction { [weak self] _ in

View File

@ -84,15 +84,11 @@ public class PinSetupViewController: OWSViewController, OWSNavigationChildContro
textField.isSecureTextEntry = true
textField.defaultTextAttributes.updateValue(5, forKey: .kern)
textField.accessibilityIdentifier = "pinCreation.pinTextField"
#if compiler(>=6.2)
if #available(iOS 26, *) {
textField.cornerConfiguration = .capsule()
} else {
textField.layer.cornerRadius = 10
}
#else
textField.layer.cornerRadius = 10
#endif
textField.delegate = self
return textField
}()

View File

@ -381,10 +381,8 @@ struct NewPollView: View {
}
.accessibilityLabel(MessageStrings.sendButton)
.tint(Color.Signal.ultramarine)
#if compiler(>=6.2)
.buttonStyle(.glassProminent)
#endif
.opacity(sendButtonEnabled ? 1 : 0.5)
.buttonStyle(.glassProminent)
.opacity(sendButtonEnabled ? 1 : 0.5)
} else {
Button(MessageStrings.sendButton, action: {
sendButtonPressed(sendButtonEnabled: sendButtonEnabled)

View File

@ -919,7 +919,7 @@ class ConversationSettingsViewController: OWSTableViewController2, BadgeCollecti
let imageView = UIImageView()
imageView.clipsToBounds = true
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
imageView.layer.cornerCurve = .continuous
imageView.layer.cornerRadius = 11
} else {

View File

@ -50,7 +50,7 @@ struct ProfileSheetSheetCoordinator {
class MemberActionSheet: OWSTableSheetViewController {
override var sheetBackgroundColor: UIColor {
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
.clear
} else {
super.sheetBackgroundColor

View File

@ -60,7 +60,7 @@ class JoinGroupCallPill: UIControl {
contentStack.isLayoutMarginsRelativeArrangement = true
contentStack.layoutMargins = .init(hMargin: 12, vMargin: 4)
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
addSubview(contentStack)
contentStack.autoPinEdgesToSuperviewEdges()
} else {
@ -99,8 +99,7 @@ class JoinGroupCallPill: UIControl {
callLabel.textColor = isEnabled ? enabledColor : .ows_whiteAlpha40
callImageView.tintColor = isEnabled ? enabledColor : .ows_whiteAlpha40
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
} else {
if #unavailable(iOS 26) {
// When we're highlighted, we should unhide the dimming view to darken the pill
dimmingView.isHidden = !isHighlighted
}

View File

@ -53,14 +53,6 @@ public enum BuildFlags {
public static let runTSAttachmentMigrationInMainAppBackground = true
public static let runTSAttachmentMigrationBlockingOnLaunch = true
/// We are still making Xcode 16 builds as of writing this, and some iOS 26
/// changes must only be applied if the SDK is also iOS 26.
#if compiler(>=6.2)
public static let iOS26SDKIsAvailable = true
#else
public static let iOS26SDKIsAvailable = false
#endif
public static let pollSend = true
public static let pollReceive = true

View File

@ -90,17 +90,13 @@ extension UIImage {
return newImage
}
#if compiler(>=6.2)
@concurrent
#endif
public func withGaussianBlurAsync(radius: CGFloat, resizeToMaxPixelDimension: CGFloat) async throws -> UIImage {
AssertNotOnMainThread()
return UIImage(cgImage: try _cgImageWithGaussianBlur(radius: radius, resizeToMaxPixelDimension: resizeToMaxPixelDimension))
}
#if compiler(>=6.2)
@concurrent
#endif
public func cgImageWithGaussianBlurAsync(radius: CGFloat, resizeToMaxPixelDimension: CGFloat) async throws -> CGImage {
AssertNotOnMainThread()
return try self._cgImageWithGaussianBlur(radius: radius, resizeToMaxPixelDimension: resizeToMaxPixelDimension)

View File

@ -186,10 +186,7 @@ open class ActionSheetController: OWSViewController {
scrollView.clipsToBounds = false
scrollView.showsVerticalScrollIndicator = false
let insetFromScreenEdge: CGFloat = if
#available(iOS 26, *),
BuildFlags.iOS26SDKIsAvailable
{
let insetFromScreenEdge: CGFloat = if #available(iOS 26, *) {
8
} else {
0
@ -246,7 +243,7 @@ open class ActionSheetController: OWSViewController {
// We can't mask the content view because the backdrop intentionally extends outside of the content
// view's bounds. But its two subviews are pinned at same top edge. We can just apply corner
// radii to each layer individually to get a similar effect.
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
// Background container sets corner radius itself
} else {
let cornerRadius: CGFloat = 24
@ -263,8 +260,7 @@ open class ActionSheetController: OWSViewController {
}
private func createBackgroundView() -> UIView {
#if compiler(>=6.2)
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
let glassEffect = UIGlassEffect(style: .regular)
glassEffect.tintColor = UIColor.Signal.background.withAlphaComponent(2 / 3)
let background = UIVisualEffectView(effect: glassEffect)
@ -272,25 +268,19 @@ open class ActionSheetController: OWSViewController {
} else {
return UIVisualEffectView(effect: UIBlurEffect(style: .prominent))
}
#else
return UIVisualEffectView(effect: UIBlurEffect(style: .prominent))
#endif
}
private func updateWidthConstraints() {
if view.width > maxPreferredWidth + maxWidthWiggleRoom {
pinWidthConstraints?.forEach { $0.isActive = false }
widthLimitConstraint?.isActive = true
#if compiler(>=6.2)
if #available(iOS 26.0, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26.0, *) {
backgroundView?.cornerConfiguration = .corners(radius: .fixed(24))
}
#endif
} else {
widthLimitConstraint?.isActive = false
pinWidthConstraints?.forEach { $0.isActive = true }
#if compiler(>=6.2)
if #available(iOS 26.0, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26.0, *) {
let topRadius: CGFloat = if UIDevice.current.hasIPhoneXNotch {
40
} else {
@ -301,7 +291,6 @@ open class ActionSheetController: OWSViewController {
bottomRadius: .containerConcentric(minimum: 20),
)
}
#endif
}
}

View File

@ -44,7 +44,7 @@ public struct ConversationStyle {
private let primaryTextColor: UIColor
public let contentMarginTop: CGFloat = 24
public let contentMarginBottom: CGFloat = if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable { 8 } else { 24 }
public let contentMarginBottom: CGFloat = if #available(iOS 26, *) { 8 } else { 24 }
public let gutterLeading: CGFloat
public let gutterTrailing: CGFloat

View File

@ -110,10 +110,6 @@ open class BaseMemberViewController: RecipientPickerContainerViewController {
recipientPicker.view.translatesAutoresizingMaskIntoConstraints = false
topStackView.autoPinEdges(toSuperviewSafeAreaExcludingEdge: .bottom)
// Remove this property and just `else` directly once all builds are on Xcode 26
var isLayedOut = false
#if compiler(>=6.2)
if #available(iOS 26, *) {
// topStackView overlaps the table with an edge effect
let interaction = UIScrollEdgeElementContainerInteraction()
@ -127,12 +123,7 @@ open class BaseMemberViewController: RecipientPickerContainerViewController {
recipientPicker.view.trailingAnchor.constraint(equalTo: view.trailingAnchor),
recipientPicker.view.bottomAnchor.constraint(equalTo: view.bottomAnchor),
])
isLayedOut = true
}
#endif
if !isLayedOut {
} else {
// topStackView is above the table
NSLayoutConstraint.activate([
recipientPicker.view.topAnchor.constraint(equalTo: topStackView.bottomAnchor),
@ -140,8 +131,6 @@ open class BaseMemberViewController: RecipientPickerContainerViewController {
recipientPicker.view.trailingAnchor.constraint(equalTo: view.trailingAnchor),
recipientPicker.view.bottomAnchor.constraint(equalTo: view.bottomAnchor),
])
isLayedOut = true
}
updateMemberCount()
@ -496,7 +485,7 @@ extension BaseMemberViewController {
extension BaseMemberViewController: NewMembersBarDelegate {
public func newMembersBarHeightDidChange(to height: CGFloat) {
guard #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable else { return }
guard #available(iOS 26, *) else { return }
let tableView = recipientPicker.tableView
UIView.animate(withDuration: 0.3) {
let change = tableView.contentInset.top - height

View File

@ -178,12 +178,10 @@ private class NewMemberCell: UICollectionViewCell {
self.layoutMargins = .zero
contentView.layoutMargins = .zero
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
#if compiler(>=6.2)
if #available(iOS 26, *) {
let glassView = UIVisualEffectView(effect: UIGlassEffect(style: .regular))
glassView.cornerConfiguration = .capsule()
backgroundView = glassView
#endif
} else {
contentView.backgroundColor = Theme.isDarkThemeEnabled ? .ows_gray65 : .ows_gray15
}

View File

@ -21,18 +21,13 @@ public struct ScrollableContentPinnedFooterView<
}
public var body: some View {
#if compiler(>=6.2)
if #available(iOS 26, *) {
iOS26Body
} else {
iOS18Body
}
#else
iOS18Body
#endif
}
#if compiler(>=6.2)
@available(iOS 26, *)
private var iOS26Body: some View {
ScrollView {
@ -47,7 +42,6 @@ public struct ScrollableContentPinnedFooterView<
}
.scrollBounceBehavior(.basedOnSize)
}
#endif
private var iOS18Body: some View {
VStack(spacing: 0) {

View File

@ -161,15 +161,11 @@ public extension UIButton.Configuration {
private static func basePrimary() -> Self {
var configuration: UIButton.Configuration
#if compiler(>=6.2)
if #available(iOS 26, *) {
configuration = .prominentGlass()
} else {
configuration = .borderedProminent()
}
#else
configuration = .borderedProminent()
#endif
configuration.titleAlignment = .center
configuration.titleTextAttributesTransformer = .defaultFont(.dynamicTypeHeadlineClamped)
configuration.baseBackgroundColor = .Signal.accent
@ -179,7 +175,6 @@ public extension UIButton.Configuration {
private static func baseSecondary() -> Self {
var configuration: UIButton.Configuration
#if compiler(>=6.2)
if #available(iOS 26, *) {
configuration = .prominentGlass()
configuration.baseForegroundColor = .Signal.label
@ -187,10 +182,6 @@ public extension UIButton.Configuration {
configuration = .plain()
configuration.baseForegroundColor = .Signal.accent
}
#else
configuration = .plain()
configuration.baseForegroundColor = .Signal.accent
#endif
configuration.titleAlignment = .center
configuration.titleTextAttributesTransformer = .defaultFont(.dynamicTypeHeadlineClamped)
configuration.baseBackgroundColor = .clear
@ -484,7 +475,7 @@ public extension UIBarButtonItem {
animated: Bool = true,
completion: (() -> Void)? = nil,
) -> UIBarButtonItem {
let systemItem: SystemItem = if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
let systemItem: SystemItem = if #available(iOS 26, *) {
.close
} else {
.done

View File

@ -74,7 +74,7 @@ open class InteractiveSheetViewController: OWSViewController {
/// but still be sure to set it for devices running iOS 18 and older.
open var placeOnGlassIfAvailable: Bool { false }
private var isOnGlass: Bool {
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
placeOnGlassIfAvailable
} else {
false
@ -213,7 +213,6 @@ open class InteractiveSheetViewController: OWSViewController {
setupInteractiveSizing()
if #available(iOS 26.0, *), isOnGlass {
#if compiler(>=6.2)
sheetContainerView.backgroundColor = .clear
let glassBackground = UIVisualEffectView(effect: UIGlassEffect(style: .regular))
sheetContainerView.insertSubview(glassBackground, at: 0)
@ -227,7 +226,6 @@ open class InteractiveSheetViewController: OWSViewController {
topRadius: .fixed(topRadius),
bottomRadius: .containerConcentric(minimum: 20),
)
#endif
} else {
sheetContainerView.backgroundColor = sheetBackgroundColor
}

View File

@ -75,7 +75,7 @@ open class OWSNavigationController: UINavigationController {
}
public init() {
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
super.init(nibName: nil, bundle: nil)
} else {
super.init(navigationBarClass: OWSNavigationBar.self, toolbarClass: nil)
@ -115,11 +115,9 @@ open class OWSNavigationController: UINavigationController {
super.viewDidLoad()
interactivePopGestureRecognizer?.delegate = self
#if compiler(>=6.2)
if #available(iOS 26.0, *) {
interactiveContentPopGestureRecognizer?.delegate = self
}
#endif
}
override open func viewWillAppear(_ animated: Bool) {
@ -227,15 +225,11 @@ extension OWSNavigationController: UIGestureRecognizerDelegate {
}
public func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
#if compiler(>=6.2)
if #available(iOS 26.0, *) {
owsAssertDebug(gestureRecognizer === self.interactivePopGestureRecognizer || gestureRecognizer === self.interactiveContentPopGestureRecognizer)
} else {
owsAssertDebug(gestureRecognizer === self.interactivePopGestureRecognizer)
}
#else
owsAssertDebug(gestureRecognizer === self.interactivePopGestureRecognizer)
#endif
guard viewControllers.count > 1 else {
return false
@ -258,11 +252,9 @@ extension OWSNavigationController: UINavigationBarDelegate {
// if a view has unsaved changes.
public func navigationBar(_ navigationBar: UINavigationBar, shouldPop item: UINavigationItem) -> Bool {
owsAssertDebug(interactivePopGestureRecognizer?.delegate === self)
#if compiler(>=6.2)
if #available(iOS 26.0, *) {
owsAssertDebug(interactiveContentPopGestureRecognizer?.delegate === self)
}
#endif
// wasBackButtonClicked is true if the back button was pressed but not
// if a back gesture was performed or if the view is popped programmatically.

View File

@ -566,7 +566,7 @@ extension OWSTableViewController2: UITableViewDataSource, UITableViewDelegate, O
/// Approximate cell corner rounding. Now that we use native inset grouped
/// tables, this is only an approximation and its use should be avoided.
public static let cellRounding: CGFloat = if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
public static let cellRounding: CGFloat = if #available(iOS 26, *) {
22
} else {
10
@ -1055,7 +1055,7 @@ extension OWSTableViewController2: UITableViewDataSource, UITableViewDelegate, O
}
public static func removeBackButtonText(viewController: UIViewController) {
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable { return }
if #available(iOS 26, *) { return }
// We never want to show titles on back buttons, so we replace it with
// blank spaces. We pad it out slightly so that it's more tappable.
viewController.navigationItem.backBarButtonItem = .init(title: " ", style: .plain, target: nil, action: nil)

View File

@ -195,8 +195,7 @@ public class ApprovalFooterView: UIView {
contentView = view
}()
#if compiler(>=6.2)
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
let glassEffect = UIGlassEffect(style: .regular)
glassEffect.isInteractive = true
let glassEffectView = UIVisualEffectView(effect: glassEffect)
@ -206,7 +205,6 @@ public class ApprovalFooterView: UIView {
containerView = glassEffectView
contentView = glassEffectView.contentView
}
#endif
// I am at a loss as to why the text field always shrinks to 0
// height, but this makes sure there's vertical space for it.

View File

@ -71,7 +71,7 @@ class MentionPicker: UIView {
case .default:
useVisualEffectViewBackground = true
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
useGlassBackground = true
} else {
useGlassBackground = false
@ -79,7 +79,6 @@ class MentionPicker: UIView {
}
if useVisualEffectViewBackground {
#if compiler(>=6.2)
// Glass background, rounded corners, horizontal insets.
if #available(iOS 26, *), useGlassBackground {
let glassEffectView = UIVisualEffectView(effect: backgroundViewVisualEffect())
@ -94,7 +93,6 @@ class MentionPicker: UIView {
directionalLayoutMargins = .init(hMargin: OWSTableViewController2.cellHInnerMargin, vMargin: 0)
}
#endif
// Blur background.
if backgroundView == nil {
@ -181,7 +179,6 @@ class MentionPicker: UIView {
private var backgroundView: UIVisualEffectView?
private func backgroundViewVisualEffect() -> UIVisualEffect? {
#if compiler(>=6.2)
if #available(iOS 26.1, *) {
let glassEffect = UIGlassEffect(style: .regular)
// Copy from ConversationInputToolbar.
@ -198,7 +195,6 @@ class MentionPicker: UIView {
if #available(iOS 26, *) {
return UIBlurEffect(style: .systemThinMaterial)
}
#endif
guard !UIAccessibility.isReduceTransparencyEnabled else { return nil }
@ -300,7 +296,7 @@ class MentionPicker: UIView {
// Make sure to match parementers in ConversationInputToolbar.StickerLayout.
private static var animationTransform: CGAffineTransform {
guard #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable else { return .identity }
guard #available(iOS 26, *) else { return .identity }
return .scale(0.9)
}
@ -582,7 +578,7 @@ private class MentionableUserCell: UITableViewCell {
var configuration = UIBackgroundConfiguration.clear()
if state.isSelected || state.isHighlighted {
configuration.backgroundColor = .Signal.primaryFill
if #available(iOS 26, *), BuildFlags.iOS26SDKIsAvailable {
if #available(iOS 26, *) {
configuration.backgroundInsets = .init(hMargin: 0.5 * Self.hMargin, vMargin: 0)
configuration.cornerRadius = 50
}