Set Deployment Target to iOS 16 (#1125)
Co-authored-by: Marcus Kida <marcus.kida@bearologics.com>
This commit is contained in:
parent
b48a66c018
commit
132af03bb2
|
@ -7,6 +7,6 @@ set -eo pipefail
|
||||||
|
|
||||||
xcodebuild -workspace Mastodon.xcworkspace \
|
xcodebuild -workspace Mastodon.xcworkspace \
|
||||||
-scheme Mastodon \
|
-scheme Mastodon \
|
||||||
-destination "platform=iOS Simulator,name=iPhone SE (2nd generation)" \
|
-destination "platform=iOS Simulator,name=iPhone SE (3rd generation)" \
|
||||||
clean \
|
clean \
|
||||||
build | xcpretty
|
build | xcpretty
|
||||||
|
|
|
@ -10,7 +10,7 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: macOS-12
|
runs-on: macOS-13
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
|
@ -18,7 +18,7 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: CI build
|
name: CI build
|
||||||
runs-on: macos-12
|
runs-on: macos-13
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
|
@ -4279,7 +4279,6 @@
|
||||||
INFOPLIST_FILE = OpenInActionExtension/Info.plist;
|
INFOPLIST_FILE = OpenInActionExtension/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = "Open using Mastodon";
|
INFOPLIST_KEY_CFBundleDisplayName = "Open using Mastodon";
|
||||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
|
@ -4309,7 +4308,6 @@
|
||||||
INFOPLIST_FILE = OpenInActionExtension/Info.plist;
|
INFOPLIST_FILE = OpenInActionExtension/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = "Open using Mastodon";
|
INFOPLIST_KEY_CFBundleDisplayName = "Open using Mastodon";
|
||||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
|
@ -4339,7 +4337,6 @@
|
||||||
INFOPLIST_FILE = OpenInActionExtension/Info.plist;
|
INFOPLIST_FILE = OpenInActionExtension/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = "Open using Mastodon";
|
INFOPLIST_KEY_CFBundleDisplayName = "Open using Mastodon";
|
||||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
|
@ -4369,7 +4366,6 @@
|
||||||
INFOPLIST_FILE = OpenInActionExtension/Info.plist;
|
INFOPLIST_FILE = OpenInActionExtension/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = "Open using Mastodon";
|
INFOPLIST_KEY_CFBundleDisplayName = "Open using Mastodon";
|
||||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
|
@ -4401,7 +4397,6 @@
|
||||||
INFOPLIST_FILE = WidgetExtension/Info.plist;
|
INFOPLIST_FILE = WidgetExtension/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = WidgetExtension;
|
INFOPLIST_KEY_CFBundleDisplayName = WidgetExtension;
|
||||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
|
@ -4432,7 +4427,6 @@
|
||||||
INFOPLIST_FILE = WidgetExtension/Info.plist;
|
INFOPLIST_FILE = WidgetExtension/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = WidgetExtension;
|
INFOPLIST_KEY_CFBundleDisplayName = WidgetExtension;
|
||||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
|
@ -4463,7 +4457,6 @@
|
||||||
INFOPLIST_FILE = WidgetExtension/Info.plist;
|
INFOPLIST_FILE = WidgetExtension/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = WidgetExtension;
|
INFOPLIST_KEY_CFBundleDisplayName = WidgetExtension;
|
||||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
|
@ -4494,7 +4487,6 @@
|
||||||
INFOPLIST_FILE = WidgetExtension/Info.plist;
|
INFOPLIST_FILE = WidgetExtension/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = WidgetExtension;
|
INFOPLIST_KEY_CFBundleDisplayName = WidgetExtension;
|
||||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
|
@ -4564,7 +4556,7 @@
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
INTENTS_CODEGEN_LANGUAGE = Swift;
|
INTENTS_CODEGEN_LANGUAGE = Swift;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
|
@ -4622,7 +4614,7 @@
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
INTENTS_CODEGEN_LANGUAGE = Swift;
|
INTENTS_CODEGEN_LANGUAGE = Swift;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
|
@ -4841,7 +4833,7 @@
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
INTENTS_CODEGEN_LANGUAGE = Swift;
|
INTENTS_CODEGEN_LANGUAGE = Swift;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
|
@ -5131,7 +5123,7 @@
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
INTENTS_CODEGEN_LANGUAGE = Swift;
|
INTENTS_CODEGEN_LANGUAGE = Swift;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
|
|
|
@ -9,15 +9,7 @@ import SwiftUI
|
||||||
|
|
||||||
class AltTextViewController: UIViewController {
|
class AltTextViewController: UIViewController {
|
||||||
let textView = {
|
let textView = {
|
||||||
let textView: UITextView
|
let textView = UITextView(usingTextLayoutManager: false)
|
||||||
|
|
||||||
if #available(iOS 16, *) {
|
|
||||||
// TODO: update code below to use TextKit 2 when dropping iOS 15 support
|
|
||||||
textView = UITextView(usingTextLayoutManager: false)
|
|
||||||
} else {
|
|
||||||
textView = UITextView()
|
|
||||||
}
|
|
||||||
|
|
||||||
textView.textContainer.maximumNumberOfLines = 0
|
textView.textContainer.maximumNumberOfLines = 0
|
||||||
textView.textContainer.lineBreakMode = .byWordWrapping
|
textView.textContainer.lineBreakMode = .byWordWrapping
|
||||||
textView.font = .preferredFont(forTextStyle: .callout)
|
textView.font = .preferredFont(forTextStyle: .callout)
|
||||||
|
|
|
@ -31,17 +31,7 @@ final class MediaPreviewImageView: UIScrollView {
|
||||||
|
|
||||||
private var containerFrame: CGRect?
|
private var containerFrame: CGRect?
|
||||||
|
|
||||||
private var _interaction: UIInteraction? = {
|
let liveTextInteraction = ImageAnalysisInteraction()
|
||||||
if #available(iOS 16.0, *) {
|
|
||||||
return ImageAnalysisInteraction()
|
|
||||||
} else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
@available(iOS 16.0, *)
|
|
||||||
var liveTextInteraction: ImageAnalysisInteraction {
|
|
||||||
_interaction as! ImageAnalysisInteraction
|
|
||||||
}
|
|
||||||
|
|
||||||
override init(frame: CGRect) {
|
override init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
|
@ -72,9 +62,7 @@ extension MediaPreviewImageView {
|
||||||
doubleTapGestureRecognizer.delegate = self
|
doubleTapGestureRecognizer.delegate = self
|
||||||
|
|
||||||
imageView.addGestureRecognizer(doubleTapGestureRecognizer)
|
imageView.addGestureRecognizer(doubleTapGestureRecognizer)
|
||||||
if #available(iOS 16.0, *) {
|
imageView.addInteraction(liveTextInteraction)
|
||||||
imageView.addInteraction(liveTextInteraction)
|
|
||||||
}
|
|
||||||
|
|
||||||
delegate = self
|
delegate = self
|
||||||
}
|
}
|
||||||
|
@ -119,8 +107,7 @@ extension MediaPreviewImageView: UIGestureRecognizerDelegate {
|
||||||
// but only if the Live Text button is toggled off
|
// but only if the Live Text button is toggled off
|
||||||
if let gr = otherGestureRecognizer as? UITapGestureRecognizer,
|
if let gr = otherGestureRecognizer as? UITapGestureRecognizer,
|
||||||
gr.numberOfTapsRequired == 2,
|
gr.numberOfTapsRequired == 2,
|
||||||
#available(iOS 16, *),
|
liveTextInteraction.selectableItemsHighlighted == false {
|
||||||
!liveTextInteraction.selectableItemsHighlighted {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
@ -151,18 +138,16 @@ extension MediaPreviewImageView {
|
||||||
|
|
||||||
centerScrollViewContents()
|
centerScrollViewContents()
|
||||||
|
|
||||||
if #available(iOS 16.0, *) {
|
Task.detached(priority: .userInitiated) {
|
||||||
Task.detached(priority: .userInitiated) {
|
do {
|
||||||
do {
|
let analysis = try await ImageAnalyzer.shared.analyze(image, configuration: ImageAnalyzer.Configuration([.text, .machineReadableCode]))
|
||||||
let analysis = try await ImageAnalyzer.shared.analyze(image, configuration: ImageAnalyzer.Configuration([.text, .machineReadableCode]))
|
await MainActor.run {
|
||||||
await MainActor.run {
|
self.liveTextInteraction.analysis = analysis
|
||||||
self.liveTextInteraction.analysis = analysis
|
self.liveTextInteraction.preferredInteractionTypes = .automatic
|
||||||
self.liveTextInteraction.preferredInteractionTypes = .automatic
|
}
|
||||||
}
|
} catch {
|
||||||
} catch {
|
await MainActor.run {
|
||||||
await MainActor.run {
|
self.liveTextInteraction.preferredInteractionTypes = []
|
||||||
self.liveTextInteraction.preferredInteractionTypes = []
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,7 @@ extension MediaPreviewImageViewController {
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
||||||
if #available(iOS 16.0, *) {
|
previewImageView.liveTextInteraction.delegate = self
|
||||||
previewImageView.liveTextInteraction.delegate = self
|
|
||||||
}
|
|
||||||
previewImageView.translatesAutoresizingMaskIntoConstraints = false
|
previewImageView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
view.addSubview(previewImageView)
|
view.addSubview(previewImageView)
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
|
@ -90,16 +88,13 @@ extension MediaPreviewImageViewController {
|
||||||
|
|
||||||
extension MediaPreviewImageViewController: MediaPreviewPage {
|
extension MediaPreviewImageViewController: MediaPreviewPage {
|
||||||
func setShowingChrome(_ showingChrome: Bool) {
|
func setShowingChrome(_ showingChrome: Bool) {
|
||||||
if #available(iOS 16.0, *) {
|
UIView.animate(withDuration: 0.3) {
|
||||||
UIView.animate(withDuration: 0.3) {
|
self.previewImageView.liveTextInteraction.setSupplementaryInterfaceHidden(!showingChrome, animated: true)
|
||||||
self.previewImageView.liveTextInteraction.setSupplementaryInterfaceHidden(!showingChrome, animated: true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - ImageAnalysisInteractionDelegate
|
// MARK: - ImageAnalysisInteractionDelegate
|
||||||
@available(iOS 16.0, *)
|
|
||||||
extension MediaPreviewImageViewController: ImageAnalysisInteractionDelegate {
|
extension MediaPreviewImageViewController: ImageAnalysisInteractionDelegate {
|
||||||
func presentingViewController(for interaction: ImageAnalysisInteraction) -> UIViewController? {
|
func presentingViewController(for interaction: ImageAnalysisInteraction) -> UIViewController? {
|
||||||
self
|
self
|
||||||
|
@ -109,18 +104,14 @@ extension MediaPreviewImageViewController: ImageAnalysisInteractionDelegate {
|
||||||
// MARK: - UIGestureRecognizerDelegate
|
// MARK: - UIGestureRecognizerDelegate
|
||||||
extension MediaPreviewImageViewController: UIGestureRecognizerDelegate {
|
extension MediaPreviewImageViewController: UIGestureRecognizerDelegate {
|
||||||
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
|
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
|
||||||
if #available(iOS 16.0, *) {
|
let location = touch.location(in: previewImageView.imageView)
|
||||||
let location = touch.location(in: previewImageView.imageView)
|
// for tap gestures, only items that can be tapped are relevant
|
||||||
// for tap gestures, only items that can be tapped are relevant
|
if gestureRecognizer is UITapGestureRecognizer {
|
||||||
if gestureRecognizer is UITapGestureRecognizer {
|
return !previewImageView.liveTextInteraction.hasSupplementaryInterface(at: location)
|
||||||
return !previewImageView.liveTextInteraction.hasSupplementaryInterface(at: location)
|
&& !previewImageView.liveTextInteraction.hasDataDetector(at: location)
|
||||||
&& !previewImageView.liveTextInteraction.hasDataDetector(at: location)
|
|
||||||
} else {
|
|
||||||
// for long press, block out everything
|
|
||||||
return !previewImageView.liveTextInteraction.hasInteractiveItem(at: location)
|
|
||||||
}
|
|
||||||
} else {
|
} 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 {
|
extension MediaPreviewImageViewController: UIContextMenuInteractionDelegate {
|
||||||
func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? {
|
func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? {
|
||||||
|
|
||||||
if #available(iOS 16.0, *) {
|
if previewImageView.liveTextInteraction.hasInteractiveItem(at: previewImageView.imageView.convert(location, from: previewImageView)) {
|
||||||
if previewImageView.liveTextInteraction.hasInteractiveItem(at: previewImageView.imageView.convert(location, from: previewImageView)) {
|
return nil
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,12 +28,7 @@ final class ProfileFieldCollectionViewCell: UICollectionViewCell {
|
||||||
let checkmark = UIImageView(image: Asset.Editing.checkmark.image.withRenderingMode(.alwaysTemplate))
|
let checkmark = UIImageView(image: Asset.Editing.checkmark.image.withRenderingMode(.alwaysTemplate))
|
||||||
var checkmarkPopoverString: String? = nil;
|
var checkmarkPopoverString: String? = nil;
|
||||||
let tapGesture = UITapGestureRecognizer();
|
let tapGesture = UITapGestureRecognizer();
|
||||||
private var _editMenuInteraction: Any? = nil
|
var editMenuInteraction: UIEditMenuInteraction!
|
||||||
@available(iOS 16, *)
|
|
||||||
fileprivate var editMenuInteraction: UIEditMenuInteraction {
|
|
||||||
_editMenuInteraction = _editMenuInteraction ?? UIEditMenuInteraction(delegate: self)
|
|
||||||
return _editMenuInteraction as! UIEditMenuInteraction
|
|
||||||
}
|
|
||||||
|
|
||||||
override func prepareForReuse() {
|
override func prepareForReuse() {
|
||||||
super.prepareForReuse()
|
super.prepareForReuse()
|
||||||
|
@ -56,6 +51,9 @@ final class ProfileFieldCollectionViewCell: UICollectionViewCell {
|
||||||
extension ProfileFieldCollectionViewCell {
|
extension ProfileFieldCollectionViewCell {
|
||||||
|
|
||||||
private func _init() {
|
private func _init() {
|
||||||
|
|
||||||
|
editMenuInteraction = UIEditMenuInteraction(delegate: self)
|
||||||
|
|
||||||
// Setup colors
|
// Setup colors
|
||||||
checkmark.tintColor = Asset.Scene.Profile.About.bioAboutFieldVerifiedText.color;
|
checkmark.tintColor = Asset.Scene.Profile.About.bioAboutFieldVerifiedText.color;
|
||||||
|
|
||||||
|
@ -63,9 +61,7 @@ extension ProfileFieldCollectionViewCell {
|
||||||
tapGesture.addTarget(self, action: #selector(ProfileFieldCollectionViewCell.didTapCheckmark(_:)))
|
tapGesture.addTarget(self, action: #selector(ProfileFieldCollectionViewCell.didTapCheckmark(_:)))
|
||||||
checkmark.addGestureRecognizer(tapGesture)
|
checkmark.addGestureRecognizer(tapGesture)
|
||||||
checkmark.isUserInteractionEnabled = true
|
checkmark.isUserInteractionEnabled = true
|
||||||
if #available(iOS 16, *) {
|
checkmark.addInteraction(editMenuInteraction)
|
||||||
checkmark.addInteraction(editMenuInteraction)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup Accessibility
|
// Setup Accessibility
|
||||||
checkmark.isAccessibilityElement = true
|
checkmark.isAccessibilityElement = true
|
||||||
|
@ -111,22 +107,7 @@ extension ProfileFieldCollectionViewCell {
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc public func didTapCheckmark(_ recognizer: UITapGestureRecognizer) {
|
@objc public func didTapCheckmark(_ recognizer: UITapGestureRecognizer) {
|
||||||
if #available(iOS 16, *) {
|
editMenuInteraction?.presentEditMenu(with: UIEditMenuConfiguration(identifier: nil, sourcePoint: recognizer.location(in: checkmark)))
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private var valueMetas: [(title: String, Meta)] {
|
private var valueMetas: [(title: String, Meta)] {
|
||||||
|
@ -190,7 +171,6 @@ extension ProfileFieldCollectionViewCell: MetaLabelDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: UIEditMenuInteractionDelegate
|
// MARK: UIEditMenuInteractionDelegate
|
||||||
@available(iOS 16.0, *)
|
|
||||||
extension ProfileFieldCollectionViewCell: UIEditMenuInteractionDelegate {
|
extension ProfileFieldCollectionViewCell: UIEditMenuInteractionDelegate {
|
||||||
func editMenuInteraction(_ interaction: UIEditMenuInteraction, menuFor configuration: UIEditMenuConfiguration, suggestedActions: [UIMenuElement]) -> UIMenu? {
|
func editMenuInteraction(_ interaction: UIEditMenuInteraction, menuFor configuration: UIEditMenuConfiguration, suggestedActions: [UIMenuElement]) -> UIMenu? {
|
||||||
guard let editMenuLabel = checkmarkPopoverString else { return UIMenu(children: []) }
|
guard let editMenuLabel = checkmarkPopoverString else { return UIMenu(children: []) }
|
||||||
|
|
|
@ -62,11 +62,7 @@ final class RootSplitViewController: UISplitViewController, NeedsDependency {
|
||||||
// disable edge swipe gesture
|
// disable edge swipe gesture
|
||||||
presentsWithGesture = false
|
presentsWithGesture = false
|
||||||
|
|
||||||
if #available(iOS 14.5, *) {
|
displayModeButtonVisibility = .never
|
||||||
displayModeButtonVisibility = .never
|
|
||||||
} else {
|
|
||||||
// Fallback on earlier versions
|
|
||||||
}
|
|
||||||
|
|
||||||
setViewController(searchViewController, for: .primary)
|
setViewController(searchViewController, for: .primary)
|
||||||
setViewController(contentSplitViewController, for: .secondary)
|
setViewController(contentSplitViewController, for: .secondary)
|
||||||
|
|
|
@ -170,14 +170,8 @@ extension SettingsCoordinator: NotificationSettingsViewControllerDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
func showNotificationSettings(_ viewController: UIViewController) {
|
func showNotificationSettings(_ viewController: UIViewController) {
|
||||||
if #available(iOS 16.0, *) {
|
if let url = URL(string: UIApplication.openNotificationSettingsURLString) {
|
||||||
if let url = URL(string: UIApplication.openNotificationSettingsURLString) {
|
UIApplication.shared.open(url)
|
||||||
UIApplication.shared.open(url)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if let url = URL(string: UIApplication.openSettingsURLString) {
|
|
||||||
UIApplication.shared.open(url)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ let package = Package(
|
||||||
name: "MastodonSDK",
|
name: "MastodonSDK",
|
||||||
defaultLocalization: "en",
|
defaultLocalization: "en",
|
||||||
platforms: [
|
platforms: [
|
||||||
.iOS(.v15),
|
.iOS(.v16),
|
||||||
],
|
],
|
||||||
products: [
|
products: [
|
||||||
// Static Library
|
// Static Library
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
import VisionKit
|
import VisionKit
|
||||||
|
|
||||||
@available(iOS 16.0, *)
|
|
||||||
extension ImageAnalyzer {
|
extension ImageAnalyzer {
|
||||||
public static let shared = ImageAnalyzer()
|
public static let shared = ImageAnalyzer()
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,45 +44,15 @@ public struct PollOptionRow: View {
|
||||||
viewModel.textField?.becomeFirstResponder()
|
viewModel.textField?.becomeFirstResponder()
|
||||||
}
|
}
|
||||||
|
|
||||||
if #available(iOS 16.0, *) {
|
field.accessibilityActions {
|
||||||
field.accessibilityActions {
|
if let moveUp {
|
||||||
if let moveUp {
|
Button(L10n.Scene.Compose.Poll.moveUp, action: 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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
if let moveDown {
|
||||||
switch (moveUp, moveDown, removeOption) {
|
Button(L10n.Scene.Compose.Poll.moveDown, action: moveDown)
|
||||||
case let (.some(up), .some(down), .some(remove)):
|
}
|
||||||
field
|
if let removeOption {
|
||||||
.accessibilityAction(named: L10n.Scene.Compose.Poll.moveUp, up)
|
Button(L10n.Scene.Compose.Poll.removeOption, action: removeOption)
|
||||||
.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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,13 +113,7 @@ struct ComposeContentToolbarView: View {
|
||||||
showingLanguagePicker = true
|
showingLanguagePicker = true
|
||||||
}
|
}
|
||||||
} label: {
|
} label: {
|
||||||
let font: SwiftUI.Font = {
|
let font = SwiftUI.Font.system(size: 11, weight: .semibold).width(viewModel.language.count == 3 ? .compressed : .standard)
|
||||||
if #available(iOS 16, *) {
|
|
||||||
return .system(size: 11, weight: .semibold).width(viewModel.language.count == 3 ? .compressed : .standard)
|
|
||||||
} else {
|
|
||||||
return .system(size: 11, weight: .semibold)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
Text(viewModel.language)
|
Text(viewModel.language)
|
||||||
.font(font)
|
.font(font)
|
||||||
|
|
|
@ -37,15 +37,9 @@ struct LanguagePicker: View {
|
||||||
return Text("")
|
return Text("")
|
||||||
}()
|
}()
|
||||||
Button(action: { onSelect(lang.id) }) {
|
Button(action: { onSelect(lang.id) }) {
|
||||||
if #available(iOS 16.0, *) {
|
ViewThatFits(in: .horizontal) {
|
||||||
ViewThatFits(in: .horizontal) {
|
HStack(spacing: 0) { endonym; Text(" "); exonym }
|
||||||
HStack(spacing: 0) { endonym; Text(" "); exonym }
|
VStack(alignment: .leading) { endonym; 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)")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.tint(.primary)
|
.tint(.primary)
|
||||||
|
|
|
@ -328,13 +328,8 @@ extension StatusView.ViewModel {
|
||||||
|
|
||||||
let paragraphStyle = statusView.contentMetaText.paragraphStyle
|
let paragraphStyle = statusView.contentMetaText.paragraphStyle
|
||||||
if let language = language {
|
if let language = language {
|
||||||
if #available(iOS 16, *) {
|
let direction = Locale.Language(identifier: language).characterDirection
|
||||||
let direction = Locale.Language(identifier: language).characterDirection
|
paragraphStyle.alignment = direction == .rightToLeft ? .right : .left
|
||||||
paragraphStyle.alignment = direction == .rightToLeft ? .right : .left
|
|
||||||
} else {
|
|
||||||
let direction = Locale.characterDirection(forLanguage: language)
|
|
||||||
paragraphStyle.alignment = direction == .rightToLeft ? .right : .left
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
paragraphStyle.alignment = .natural
|
paragraphStyle.alignment = .natural
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,10 +54,7 @@ struct FollowersCountEntry: TimelineEntry {
|
||||||
|
|
||||||
struct FollowersCountWidget: Widget {
|
struct FollowersCountWidget: Widget {
|
||||||
private var availableFamilies: [WidgetFamily] {
|
private var availableFamilies: [WidgetFamily] {
|
||||||
if #available(iOS 16, *) {
|
return [.systemSmall, .accessoryRectangular, .accessoryCircular]
|
||||||
return [.systemSmall, .accessoryRectangular, .accessoryCircular]
|
|
||||||
}
|
|
||||||
return [.systemSmall]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var body: some WidgetConfiguration {
|
var body: some WidgetConfiguration {
|
||||||
|
|
|
@ -148,9 +148,7 @@ struct FollowersCountWidgetView: View {
|
||||||
|
|
||||||
private func viewForAccessoryCircular(_ account :FollowersEntryAccountable) -> some View {
|
private func viewForAccessoryCircular(_ account :FollowersEntryAccountable) -> some View {
|
||||||
ZStack {
|
ZStack {
|
||||||
if #available(iOS 16, *) {
|
AccessoryWidgetBackground()
|
||||||
AccessoryWidgetBackground()
|
|
||||||
}
|
|
||||||
VStack {
|
VStack {
|
||||||
Image("BrandIcon")
|
Image("BrandIcon")
|
||||||
|
|
||||||
|
|
|
@ -146,11 +146,7 @@ struct HashtagWidgetTimelineEntry: TimelineEntry {
|
||||||
struct HashtagWidget: Widget {
|
struct HashtagWidget: Widget {
|
||||||
|
|
||||||
private var availableFamilies: [WidgetFamily] {
|
private var availableFamilies: [WidgetFamily] {
|
||||||
if #available(iOS 16, *) {
|
return [.systemMedium, .systemLarge, .accessoryRectangular]
|
||||||
return [.systemMedium, .systemLarge, .accessoryRectangular]
|
|
||||||
} else {
|
|
||||||
return [.systemMedium, .systemLarge]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var body: some WidgetConfiguration {
|
var body: some WidgetConfiguration {
|
||||||
|
|
Loading…
Reference in New Issue