diff --git a/.github/scripts/build.sh b/.github/scripts/build.sh index d4fc4acc7..75ae2337d 100755 --- a/.github/scripts/build.sh +++ b/.github/scripts/build.sh @@ -7,6 +7,6 @@ set -eo pipefail xcodebuild -workspace Mastodon.xcworkspace \ -scheme Mastodon \ - -destination "platform=iOS Simulator,name=iPhone SE (2nd generation)" \ + -destination "platform=iOS Simulator,name=iPhone SE (3rd generation)" \ clean \ build | xcpretty diff --git a/.github/workflows/develop-build.yml b/.github/workflows/develop-build.yml index 7dd9ebaab..d0019c894 100644 --- a/.github/workflows/develop-build.yml +++ b/.github/workflows/develop-build.yml @@ -10,7 +10,7 @@ on: jobs: build: name: Build - runs-on: macOS-12 + runs-on: macOS-13 steps: - name: Checkout uses: actions/checkout@v2 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1c40b6556..5a7055792 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,7 +18,7 @@ on: jobs: build: name: CI build - runs-on: macos-12 + runs-on: macos-13 steps: - name: checkout uses: actions/checkout@v2 diff --git a/Mastodon.xcodeproj/project.pbxproj b/Mastodon.xcodeproj/project.pbxproj index 5223ba6fd..5de43a801 100644 --- a/Mastodon.xcodeproj/project.pbxproj +++ b/Mastodon.xcodeproj/project.pbxproj @@ -4279,7 +4279,6 @@ INFOPLIST_FILE = OpenInActionExtension/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "Open using Mastodon"; INFOPLIST_KEY_NSHumanReadableCopyright = ""; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -4309,7 +4308,6 @@ INFOPLIST_FILE = OpenInActionExtension/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "Open using Mastodon"; INFOPLIST_KEY_NSHumanReadableCopyright = ""; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -4339,7 +4337,6 @@ INFOPLIST_FILE = OpenInActionExtension/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "Open using Mastodon"; INFOPLIST_KEY_NSHumanReadableCopyright = ""; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -4369,7 +4366,6 @@ INFOPLIST_FILE = OpenInActionExtension/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "Open using Mastodon"; INFOPLIST_KEY_NSHumanReadableCopyright = ""; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -4401,7 +4397,6 @@ INFOPLIST_FILE = WidgetExtension/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = WidgetExtension; INFOPLIST_KEY_NSHumanReadableCopyright = ""; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -4432,7 +4427,6 @@ INFOPLIST_FILE = WidgetExtension/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = WidgetExtension; INFOPLIST_KEY_NSHumanReadableCopyright = ""; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -4463,7 +4457,6 @@ INFOPLIST_FILE = WidgetExtension/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = WidgetExtension; INFOPLIST_KEY_NSHumanReadableCopyright = ""; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -4494,7 +4487,6 @@ INFOPLIST_FILE = WidgetExtension/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = WidgetExtension; INFOPLIST_KEY_NSHumanReadableCopyright = ""; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -4564,7 +4556,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; INTENTS_CODEGEN_LANGUAGE = Swift; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -4622,7 +4614,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; INTENTS_CODEGEN_LANGUAGE = Swift; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; @@ -4841,7 +4833,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; INTENTS_CODEGEN_LANGUAGE = Swift; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -5131,7 +5123,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; INTENTS_CODEGEN_LANGUAGE = Swift; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; diff --git a/Mastodon/Scene/MediaPreview/AltTextViewController.swift b/Mastodon/Scene/MediaPreview/AltTextViewController.swift index 15f79b805..a40ad47d8 100644 --- a/Mastodon/Scene/MediaPreview/AltTextViewController.swift +++ b/Mastodon/Scene/MediaPreview/AltTextViewController.swift @@ -9,15 +9,7 @@ import SwiftUI class AltTextViewController: UIViewController { let textView = { - let textView: UITextView - - if #available(iOS 16, *) { - // TODO: update code below to use TextKit 2 when dropping iOS 15 support - textView = UITextView(usingTextLayoutManager: false) - } else { - textView = UITextView() - } - + let textView = UITextView(usingTextLayoutManager: false) textView.textContainer.maximumNumberOfLines = 0 textView.textContainer.lineBreakMode = .byWordWrapping textView.font = .preferredFont(forTextStyle: .callout) diff --git a/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageView.swift b/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageView.swift index 10840c35f..f750e5a26 100644 --- a/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageView.swift +++ b/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageView.swift @@ -31,17 +31,7 @@ final class MediaPreviewImageView: UIScrollView { private var containerFrame: CGRect? - private var _interaction: UIInteraction? = { - if #available(iOS 16.0, *) { - return ImageAnalysisInteraction() - } else { - return nil - } - }() - @available(iOS 16.0, *) - var liveTextInteraction: ImageAnalysisInteraction { - _interaction as! ImageAnalysisInteraction - } + let liveTextInteraction = ImageAnalysisInteraction() override init(frame: CGRect) { super.init(frame: frame) @@ -72,9 +62,7 @@ extension MediaPreviewImageView { doubleTapGestureRecognizer.delegate = self imageView.addGestureRecognizer(doubleTapGestureRecognizer) - if #available(iOS 16.0, *) { - imageView.addInteraction(liveTextInteraction) - } + imageView.addInteraction(liveTextInteraction) delegate = self } @@ -119,8 +107,7 @@ extension MediaPreviewImageView: UIGestureRecognizerDelegate { // but only if the Live Text button is toggled off if let gr = otherGestureRecognizer as? UITapGestureRecognizer, gr.numberOfTapsRequired == 2, - #available(iOS 16, *), - !liveTextInteraction.selectableItemsHighlighted { + liveTextInteraction.selectableItemsHighlighted == false { return true } return false @@ -151,18 +138,16 @@ extension MediaPreviewImageView { centerScrollViewContents() - if #available(iOS 16.0, *) { - Task.detached(priority: .userInitiated) { - do { - let analysis = try await ImageAnalyzer.shared.analyze(image, configuration: ImageAnalyzer.Configuration([.text, .machineReadableCode])) - await MainActor.run { - self.liveTextInteraction.analysis = analysis - self.liveTextInteraction.preferredInteractionTypes = .automatic - } - } catch { - await MainActor.run { - self.liveTextInteraction.preferredInteractionTypes = [] - } + Task.detached(priority: .userInitiated) { + do { + let analysis = try await ImageAnalyzer.shared.analyze(image, configuration: ImageAnalyzer.Configuration([.text, .machineReadableCode])) + await MainActor.run { + self.liveTextInteraction.analysis = analysis + self.liveTextInteraction.preferredInteractionTypes = .automatic + } + } catch { + await MainActor.run { + self.liveTextInteraction.preferredInteractionTypes = [] } } } diff --git a/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageViewController.swift b/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageViewController.swift index 2fd2231a1..6a50e1fc6 100644 --- a/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageViewController.swift +++ b/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageViewController.swift @@ -40,9 +40,7 @@ extension MediaPreviewImageViewController { override func viewDidLoad() { super.viewDidLoad() - if #available(iOS 16.0, *) { - previewImageView.liveTextInteraction.delegate = self - } + previewImageView.liveTextInteraction.delegate = self previewImageView.translatesAutoresizingMaskIntoConstraints = false view.addSubview(previewImageView) NSLayoutConstraint.activate([ @@ -90,16 +88,13 @@ extension MediaPreviewImageViewController { extension MediaPreviewImageViewController: MediaPreviewPage { func setShowingChrome(_ showingChrome: Bool) { - if #available(iOS 16.0, *) { - UIView.animate(withDuration: 0.3) { - self.previewImageView.liveTextInteraction.setSupplementaryInterfaceHidden(!showingChrome, animated: true) - } + UIView.animate(withDuration: 0.3) { + self.previewImageView.liveTextInteraction.setSupplementaryInterfaceHidden(!showingChrome, animated: true) } } } // MARK: - ImageAnalysisInteractionDelegate -@available(iOS 16.0, *) extension MediaPreviewImageViewController: ImageAnalysisInteractionDelegate { func presentingViewController(for interaction: ImageAnalysisInteraction) -> UIViewController? { self @@ -109,18 +104,14 @@ extension MediaPreviewImageViewController: ImageAnalysisInteractionDelegate { // MARK: - UIGestureRecognizerDelegate extension MediaPreviewImageViewController: UIGestureRecognizerDelegate { func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool { - if #available(iOS 16.0, *) { - let location = touch.location(in: previewImageView.imageView) - // for tap gestures, only items that can be tapped are relevant - if gestureRecognizer is UITapGestureRecognizer { - return !previewImageView.liveTextInteraction.hasSupplementaryInterface(at: location) - && !previewImageView.liveTextInteraction.hasDataDetector(at: location) - } else { - // for long press, block out everything - return !previewImageView.liveTextInteraction.hasInteractiveItem(at: location) - } + let location = touch.location(in: previewImageView.imageView) + // for tap gestures, only items that can be tapped are relevant + if gestureRecognizer is UITapGestureRecognizer { + return !previewImageView.liveTextInteraction.hasSupplementaryInterface(at: location) + && !previewImageView.liveTextInteraction.hasDataDetector(at: location) } else { - return true + // for long press, block out everything + return !previewImageView.liveTextInteraction.hasInteractiveItem(at: location) } } } @@ -129,10 +120,8 @@ extension MediaPreviewImageViewController: UIGestureRecognizerDelegate { extension MediaPreviewImageViewController: UIContextMenuInteractionDelegate { func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? { - if #available(iOS 16.0, *) { - if previewImageView.liveTextInteraction.hasInteractiveItem(at: previewImageView.imageView.convert(location, from: previewImageView)) { - return nil - } + if previewImageView.liveTextInteraction.hasInteractiveItem(at: previewImageView.imageView.convert(location, from: previewImageView)) { + return nil } diff --git a/Mastodon/Scene/Profile/About/Cell/ProfileFieldCollectionViewCell.swift b/Mastodon/Scene/Profile/About/Cell/ProfileFieldCollectionViewCell.swift index df0719ff1..099799c6e 100644 --- a/Mastodon/Scene/Profile/About/Cell/ProfileFieldCollectionViewCell.swift +++ b/Mastodon/Scene/Profile/About/Cell/ProfileFieldCollectionViewCell.swift @@ -28,13 +28,8 @@ final class ProfileFieldCollectionViewCell: UICollectionViewCell { let checkmark = UIImageView(image: Asset.Editing.checkmark.image.withRenderingMode(.alwaysTemplate)) var checkmarkPopoverString: String? = nil; let tapGesture = UITapGestureRecognizer(); - private var _editMenuInteraction: Any? = nil - @available(iOS 16, *) - fileprivate var editMenuInteraction: UIEditMenuInteraction { - _editMenuInteraction = _editMenuInteraction ?? UIEditMenuInteraction(delegate: self) - return _editMenuInteraction as! UIEditMenuInteraction - } - + var editMenuInteraction: UIEditMenuInteraction! + override func prepareForReuse() { super.prepareForReuse() @@ -56,6 +51,9 @@ final class ProfileFieldCollectionViewCell: UICollectionViewCell { extension ProfileFieldCollectionViewCell { private func _init() { + + editMenuInteraction = UIEditMenuInteraction(delegate: self) + // Setup colors checkmark.tintColor = Asset.Scene.Profile.About.bioAboutFieldVerifiedText.color; @@ -63,10 +61,8 @@ extension ProfileFieldCollectionViewCell { tapGesture.addTarget(self, action: #selector(ProfileFieldCollectionViewCell.didTapCheckmark(_:))) checkmark.addGestureRecognizer(tapGesture) checkmark.isUserInteractionEnabled = true - if #available(iOS 16, *) { - checkmark.addInteraction(editMenuInteraction) - } - + checkmark.addInteraction(editMenuInteraction) + // Setup Accessibility checkmark.isAccessibilityElement = true checkmark.accessibilityTraits = .none @@ -111,22 +107,7 @@ extension ProfileFieldCollectionViewCell { } @objc public func didTapCheckmark(_ recognizer: UITapGestureRecognizer) { - if #available(iOS 16, *) { - editMenuInteraction.presentEditMenu(with: UIEditMenuConfiguration(identifier: nil, sourcePoint: recognizer.location(in: checkmark))) - } else { - guard let editMenuLabel = checkmarkPopoverString else { return } - - self.isUserInteractionEnabled = true - self.becomeFirstResponder() - - UIMenuController.shared.menuItems = [ - UIMenuItem( - title: editMenuLabel, - action: #selector(dismissVerifiedMenu) - ) - ] - UIMenuController.shared.showMenu(from: checkmark, rect: checkmark.bounds) - } + editMenuInteraction?.presentEditMenu(with: UIEditMenuConfiguration(identifier: nil, sourcePoint: recognizer.location(in: checkmark))) } private var valueMetas: [(title: String, Meta)] { @@ -190,7 +171,6 @@ extension ProfileFieldCollectionViewCell: MetaLabelDelegate { } // MARK: UIEditMenuInteractionDelegate -@available(iOS 16.0, *) extension ProfileFieldCollectionViewCell: UIEditMenuInteractionDelegate { func editMenuInteraction(_ interaction: UIEditMenuInteraction, menuFor configuration: UIEditMenuConfiguration, suggestedActions: [UIMenuElement]) -> UIMenu? { guard let editMenuLabel = checkmarkPopoverString else { return UIMenu(children: []) } diff --git a/Mastodon/Scene/Root/RootSplitViewController.swift b/Mastodon/Scene/Root/RootSplitViewController.swift index 0ec7e9bb7..10ed4c441 100644 --- a/Mastodon/Scene/Root/RootSplitViewController.swift +++ b/Mastodon/Scene/Root/RootSplitViewController.swift @@ -62,11 +62,7 @@ final class RootSplitViewController: UISplitViewController, NeedsDependency { // disable edge swipe gesture presentsWithGesture = false - if #available(iOS 14.5, *) { - displayModeButtonVisibility = .never - } else { - // Fallback on earlier versions - } + displayModeButtonVisibility = .never setViewController(searchViewController, for: .primary) setViewController(contentSplitViewController, for: .secondary) diff --git a/Mastodon/Scene/Settings/SettingsCoordinator.swift b/Mastodon/Scene/Settings/SettingsCoordinator.swift index a8415303b..93059ed91 100644 --- a/Mastodon/Scene/Settings/SettingsCoordinator.swift +++ b/Mastodon/Scene/Settings/SettingsCoordinator.swift @@ -168,16 +168,10 @@ extension SettingsCoordinator: NotificationSettingsViewControllerDelegate { }) .store(in: &disposeBag) } - + func showNotificationSettings(_ viewController: UIViewController) { - if #available(iOS 16.0, *) { - if let url = URL(string: UIApplication.openNotificationSettingsURLString) { - UIApplication.shared.open(url) - } - } else { - if let url = URL(string: UIApplication.openSettingsURLString) { - UIApplication.shared.open(url) - } + if let url = URL(string: UIApplication.openNotificationSettingsURLString) { + UIApplication.shared.open(url) } } } diff --git a/MastodonSDK/Package.swift b/MastodonSDK/Package.swift index 7b44f806d..655349ce1 100644 --- a/MastodonSDK/Package.swift +++ b/MastodonSDK/Package.swift @@ -18,7 +18,7 @@ let package = Package( name: "MastodonSDK", defaultLocalization: "en", platforms: [ - .iOS(.v15), + .iOS(.v16), ], products: [ // Static Library diff --git a/MastodonSDK/Sources/MastodonExtension/ImageAnalyzer.swift b/MastodonSDK/Sources/MastodonExtension/ImageAnalyzer.swift index cf8a0f437..0ee05391b 100644 --- a/MastodonSDK/Sources/MastodonExtension/ImageAnalyzer.swift +++ b/MastodonSDK/Sources/MastodonExtension/ImageAnalyzer.swift @@ -7,7 +7,6 @@ import VisionKit -@available(iOS 16.0, *) extension ImageAnalyzer { public static let shared = ImageAnalyzer() } diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Poll/PollOptionRow.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Poll/PollOptionRow.swift index f10c094f4..4a033491e 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Poll/PollOptionRow.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Poll/PollOptionRow.swift @@ -44,45 +44,15 @@ public struct PollOptionRow: View { viewModel.textField?.becomeFirstResponder() } - if #available(iOS 16.0, *) { - field.accessibilityActions { - if let moveUp { - Button(L10n.Scene.Compose.Poll.moveUp, action: moveUp) - } - if let moveDown { - Button(L10n.Scene.Compose.Poll.moveDown, action: moveDown) - } - if let removeOption { - Button(L10n.Scene.Compose.Poll.removeOption, action: removeOption) - } + field.accessibilityActions { + if let moveUp { + Button(L10n.Scene.Compose.Poll.moveUp, action: moveUp) } - } else { - switch (moveUp, moveDown, removeOption) { - case let (.some(up), .some(down), .some(remove)): - field - .accessibilityAction(named: L10n.Scene.Compose.Poll.moveUp, up) - .accessibilityAction(named: L10n.Scene.Compose.Poll.moveDown, down) - .accessibilityAction(named: L10n.Scene.Compose.Poll.removeOption, remove) - case let (.some(up), .some(down), .none): - field - .accessibilityAction(named: L10n.Scene.Compose.Poll.moveUp, up) - .accessibilityAction(named: L10n.Scene.Compose.Poll.moveDown, down) - case let (.some(up), .none, .some(remove)): - field - .accessibilityAction(named: L10n.Scene.Compose.Poll.moveUp, up) - .accessibilityAction(named: L10n.Scene.Compose.Poll.removeOption, remove) - case let (.some(up), .none, .none): - field.accessibilityAction(named: L10n.Scene.Compose.Poll.moveUp, up) - case let (.none, .some(down), .some(remove)): - field - .accessibilityAction(named: L10n.Scene.Compose.Poll.moveDown, down) - .accessibilityAction(named: L10n.Scene.Compose.Poll.removeOption, remove) - case let (.none, .some(down), .none): - field.accessibilityAction(named: L10n.Scene.Compose.Poll.moveDown, down) - case let (.none, .none, .some(remove)): - field.accessibilityAction(named: L10n.Scene.Compose.Poll.removeOption, remove) - case (.none, .none, .none): - field + if let moveDown { + Button(L10n.Scene.Compose.Poll.moveDown, action: moveDown) + } + if let removeOption { + Button(L10n.Scene.Compose.Poll.removeOption, action: removeOption) } } } diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Toolbar/ComposeContentToolbarView.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Toolbar/ComposeContentToolbarView.swift index 70430f400..a5af2c10f 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Toolbar/ComposeContentToolbarView.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Toolbar/ComposeContentToolbarView.swift @@ -113,13 +113,7 @@ struct ComposeContentToolbarView: View { showingLanguagePicker = true } } label: { - let font: SwiftUI.Font = { - if #available(iOS 16, *) { - return .system(size: 11, weight: .semibold).width(viewModel.language.count == 3 ? .compressed : .standard) - } else { - return .system(size: 11, weight: .semibold) - } - }() + let font = SwiftUI.Font.system(size: 11, weight: .semibold).width(viewModel.language.count == 3 ? .compressed : .standard) Text(viewModel.language) .font(font) diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Toolbar/LanguagePicker.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Toolbar/LanguagePicker.swift index f51dd6732..10911c875 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Toolbar/LanguagePicker.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Toolbar/LanguagePicker.swift @@ -37,15 +37,9 @@ struct LanguagePicker: View { return Text("") }() Button(action: { onSelect(lang.id) }) { - if #available(iOS 16.0, *) { - ViewThatFits(in: .horizontal) { - HStack(spacing: 0) { endonym; Text(" "); exonym } - VStack(alignment: .leading) { endonym; exonym } - } - } else { - // less optimal because if you’re using an LTR language, RTL languages - // will read as “ ([exonym])[endonym]” (and vice versa in RTL locales) - Text("\(endonym)\(exonym)") + ViewThatFits(in: .horizontal) { + HStack(spacing: 0) { endonym; Text(" "); exonym } + VStack(alignment: .leading) { endonym; exonym } } } .tint(.primary) diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift index 73ef89bfc..680ef039c 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift @@ -328,13 +328,8 @@ extension StatusView.ViewModel { let paragraphStyle = statusView.contentMetaText.paragraphStyle if let language = language { - if #available(iOS 16, *) { - let direction = Locale.Language(identifier: language).characterDirection - paragraphStyle.alignment = direction == .rightToLeft ? .right : .left - } else { - let direction = Locale.characterDirection(forLanguage: language) - paragraphStyle.alignment = direction == .rightToLeft ? .right : .left - }; + let direction = Locale.Language(identifier: language).characterDirection + paragraphStyle.alignment = direction == .rightToLeft ? .right : .left } else { paragraphStyle.alignment = .natural } diff --git a/WidgetExtension/Variants/FollowersCount/FollowersCountWidget.swift b/WidgetExtension/Variants/FollowersCount/FollowersCountWidget.swift index c8e53fb1c..e311981f4 100644 --- a/WidgetExtension/Variants/FollowersCount/FollowersCountWidget.swift +++ b/WidgetExtension/Variants/FollowersCount/FollowersCountWidget.swift @@ -54,10 +54,7 @@ struct FollowersCountEntry: TimelineEntry { struct FollowersCountWidget: Widget { private var availableFamilies: [WidgetFamily] { - if #available(iOS 16, *) { - return [.systemSmall, .accessoryRectangular, .accessoryCircular] - } - return [.systemSmall] + return [.systemSmall, .accessoryRectangular, .accessoryCircular] } var body: some WidgetConfiguration { diff --git a/WidgetExtension/Variants/FollowersCount/FollowersCountWidgetView.swift b/WidgetExtension/Variants/FollowersCount/FollowersCountWidgetView.swift index 2ad348c71..2c781b36e 100644 --- a/WidgetExtension/Variants/FollowersCount/FollowersCountWidgetView.swift +++ b/WidgetExtension/Variants/FollowersCount/FollowersCountWidgetView.swift @@ -148,9 +148,7 @@ struct FollowersCountWidgetView: View { private func viewForAccessoryCircular(_ account :FollowersEntryAccountable) -> some View { ZStack { - if #available(iOS 16, *) { - AccessoryWidgetBackground() - } + AccessoryWidgetBackground() VStack { Image("BrandIcon") diff --git a/WidgetExtension/Variants/Hashtag/HashtagWidget.swift b/WidgetExtension/Variants/Hashtag/HashtagWidget.swift index 86e9f485c..41e21da83 100644 --- a/WidgetExtension/Variants/Hashtag/HashtagWidget.swift +++ b/WidgetExtension/Variants/Hashtag/HashtagWidget.swift @@ -146,11 +146,7 @@ struct HashtagWidgetTimelineEntry: TimelineEntry { struct HashtagWidget: Widget { private var availableFamilies: [WidgetFamily] { - if #available(iOS 16, *) { - return [.systemMedium, .systemLarge, .accessoryRectangular] - } else { - return [.systemMedium, .systemLarge] - } + return [.systemMedium, .systemLarge, .accessoryRectangular] } var body: some WidgetConfiguration {