Set Deployment Target to iOS 16 (#1125)

Co-authored-by: Marcus Kida <marcus.kida@bearologics.com>
This commit is contained in:
Nathan Mattes 2023-09-29 19:31:22 +02:00 committed by GitHub
parent b48a66c018
commit 132af03bb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 63 additions and 192 deletions

View File

@ -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

View File

@ -10,7 +10,7 @@ on:
jobs:
build:
name: Build
runs-on: macOS-12
runs-on: macOS-13
steps:
- name: Checkout
uses: actions/checkout@v2

View File

@ -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

View File

@ -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;

View File

@ -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)

View File

@ -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 = []
}
}
}

View File

@ -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
}

View File

@ -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: []) }

View File

@ -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)

View File

@ -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)
}
}
}

View File

@ -18,7 +18,7 @@ let package = Package(
name: "MastodonSDK",
defaultLocalization: "en",
platforms: [
.iOS(.v15),
.iOS(.v16),
],
products: [
// Static Library

View File

@ -7,7 +7,6 @@
import VisionKit
@available(iOS 16.0, *)
extension ImageAnalyzer {
public static let shared = ImageAnalyzer()
}

View File

@ -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)
}
}
}

View File

@ -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)

View File

@ -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 youre 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)

View File

@ -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
}

View File

@ -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 {

View File

@ -148,9 +148,7 @@ struct FollowersCountWidgetView: View {
private func viewForAccessoryCircular(_ account :FollowersEntryAccountable) -> some View {
ZStack {
if #available(iOS 16, *) {
AccessoryWidgetBackground()
}
AccessoryWidgetBackground()
VStack {
Image("BrandIcon")

View File

@ -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 {