mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
[ios] Removing conditionals for unsupported iOS versions
Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
This commit is contained in:
@@ -7,9 +7,7 @@ final class RangeFirstCell: Cell {
|
|||||||
contentView.addSubview(rangeBgView)
|
contentView.addSubview(rangeBgView)
|
||||||
rangeBgView.alignToSuperview(UIEdgeInsets(top: 4, left: 4, bottom: -4, right: 0))
|
rangeBgView.alignToSuperview(UIEdgeInsets(top: 4, left: 4, bottom: -4, right: 0))
|
||||||
rangeBgView.layer.cornerRadius = 8
|
rangeBgView.layer.cornerRadius = 8
|
||||||
if #available(iOS 13.0, *) {
|
rangeBgView.layer.cornerCurve = .continuous
|
||||||
rangeBgView.layer.cornerCurve = .continuous
|
|
||||||
}
|
|
||||||
rangeBgView.layer.maskedCorners = [.layerMinXMinYCorner, .layerMinXMaxYCorner]
|
rangeBgView.layer.maskedCorners = [.layerMinXMinYCorner, .layerMinXMaxYCorner]
|
||||||
super.addSubviews()
|
super.addSubviews()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ final class RangeLastCell: Cell {
|
|||||||
contentView.addSubview(rangeBgView)
|
contentView.addSubview(rangeBgView)
|
||||||
rangeBgView.alignToSuperview(UIEdgeInsets(top: 4, left: 0, bottom: -4, right: -4))
|
rangeBgView.alignToSuperview(UIEdgeInsets(top: 4, left: 0, bottom: -4, right: -4))
|
||||||
rangeBgView.layer.cornerRadius = 8
|
rangeBgView.layer.cornerRadius = 8
|
||||||
if #available(iOS 13.0, *) {
|
rangeBgView.layer.cornerCurve = .continuous
|
||||||
rangeBgView.layer.cornerCurve = .continuous
|
|
||||||
}
|
|
||||||
rangeBgView.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMaxXMaxYCorner]
|
rangeBgView.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMaxXMaxYCorner]
|
||||||
super.addSubviews()
|
super.addSubviews()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ final class RangeSingleCell: Cell {
|
|||||||
contentView.addSubview(rangeBgView)
|
contentView.addSubview(rangeBgView)
|
||||||
rangeBgView.alignToSuperview(UIEdgeInsets(top: 4, left: 4, bottom: -4, right: -4))
|
rangeBgView.alignToSuperview(UIEdgeInsets(top: 4, left: 4, bottom: -4, right: -4))
|
||||||
rangeBgView.layer.cornerRadius = 8
|
rangeBgView.layer.cornerRadius = 8
|
||||||
if #available(iOS 13.0, *) {
|
rangeBgView.layer.cornerCurve = .continuous
|
||||||
rangeBgView.layer.cornerCurve = .continuous
|
|
||||||
}
|
|
||||||
super.addSubviews()
|
super.addSubviews()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ class SelectedSingleCell: Cell {
|
|||||||
contentView.addSubview(selectedBgView)
|
contentView.addSubview(selectedBgView)
|
||||||
selectedBgView.alignToSuperview(UIEdgeInsets(top: 4, left: 4, bottom: -4, right: -4))
|
selectedBgView.alignToSuperview(UIEdgeInsets(top: 4, left: 4, bottom: -4, right: -4))
|
||||||
selectedBgView.layer.cornerRadius = 8
|
selectedBgView.layer.cornerRadius = 8
|
||||||
if #available(iOS 13.0, *) {
|
selectedBgView.layer.cornerCurve = .continuous
|
||||||
selectedBgView.layer.cornerCurve = .continuous
|
|
||||||
}
|
|
||||||
super.addSubviews()
|
super.addSubviews()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ extension CALayer {
|
|||||||
if let maskedCorners {
|
if let maskedCorners {
|
||||||
self.maskedCorners = maskedCorners
|
self.maskedCorners = maskedCorners
|
||||||
}
|
}
|
||||||
if #available(iOS 13.0, *) {
|
cornerCurve = .continuous
|
||||||
cornerCurve = .continuous
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,9 +54,7 @@ final class CarPlayService: NSObject {
|
|||||||
applyBaseRootTemplate()
|
applyBaseRootTemplate()
|
||||||
router.restoreTripPreviewOnCarplay(beforeRootTemplateDidAppear: true)
|
router.restoreTripPreviewOnCarplay(beforeRootTemplateDidAppear: true)
|
||||||
}
|
}
|
||||||
if #available(iOS 13.0, *) {
|
updateContentStyle(configuration.contentStyle)
|
||||||
updateContentStyle(configuration.contentStyle)
|
|
||||||
}
|
|
||||||
FrameworkHelper.updatePositionArrowOffset(false, offset: 5)
|
FrameworkHelper.updatePositionArrowOffset(false, offset: 5)
|
||||||
|
|
||||||
CarPlayWindowScaleAdjuster.updateAppearance(
|
CarPlayWindowScaleAdjuster.updateAppearance(
|
||||||
|
|||||||
@@ -96,14 +96,12 @@ final class ListTemplateBuilder {
|
|||||||
bookmarkId: bookmark.bookmarkId))
|
bookmarkId: bookmark.bookmarkId))
|
||||||
return item
|
return item
|
||||||
})
|
})
|
||||||
if #available(iOS 15.0, *) {
|
let maxItemCount = CPListTemplate.maximumItemCount - 1
|
||||||
let maxItemCount = CPListTemplate.maximumItemCount - 1
|
if items.count >= maxItemCount {
|
||||||
if items.count >= maxItemCount {
|
items = Array(items.prefix(maxItemCount))
|
||||||
items = Array(items.prefix(maxItemCount))
|
let cropWarning = CPListItem(text: L("not_all_shown_bookmarks_carplay"), detailText: L("switch_to_phone_bookmarks_carplay"))
|
||||||
let cropWarning = CPListItem(text: L("not_all_shown_bookmarks_carplay"), detailText: L("switch_to_phone_bookmarks_carplay"))
|
cropWarning.isEnabled = false
|
||||||
cropWarning.isEnabled = false
|
items.append(cropWarning)
|
||||||
items.append(cropWarning)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let section = CPListSection(items: items)
|
let section = CPListSection(items: items)
|
||||||
template.updateSections([section])
|
template.updateSections([section])
|
||||||
|
|||||||
@@ -29,12 +29,7 @@ class CopyableLabel: UILabel {
|
|||||||
var rect = bounds
|
var rect = bounds
|
||||||
rect.origin = locationOfTouchInLabel
|
rect.origin = locationOfTouchInLabel
|
||||||
rect.size = CGSize(width: 1, height: 1)
|
rect.size = CGSize(width: 1, height: 1)
|
||||||
if #available(iOS 13, *) {
|
menu.showMenu(from: self, rect: rect)
|
||||||
menu.showMenu(from: self, rect: rect)
|
|
||||||
} else {
|
|
||||||
menu.setTargetRect(rect, in: self)
|
|
||||||
menu.setMenuVisible(true, animated: false)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
final class LoadingOverlayViewController: UIViewController {
|
final class LoadingOverlayViewController: UIViewController {
|
||||||
private var activityIndicator: UIActivityIndicatorView = {
|
private var activityIndicator: UIActivityIndicatorView = {
|
||||||
let indicator: UIActivityIndicatorView
|
let indicator: UIActivityIndicatorView
|
||||||
if #available(iOS 13.0, *) {
|
indicator = UIActivityIndicatorView(style: .large)
|
||||||
indicator = UIActivityIndicatorView(style: .large)
|
|
||||||
} else {
|
|
||||||
indicator = UIActivityIndicatorView(style: .whiteLarge)
|
|
||||||
}
|
|
||||||
indicator.color = .white
|
indicator.color = .white
|
||||||
indicator.startAnimating()
|
indicator.startAnimating()
|
||||||
indicator.translatesAutoresizingMaskIntoConstraints = false
|
indicator.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
var isiPad: Bool {
|
var isiPad: Bool {
|
||||||
if #available(iOS 14.0, *), ProcessInfo.processInfo.isiOSAppOnMac {
|
if ProcessInfo.processInfo.isiOSAppOnMac {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return UIDevice.current.userInterfaceIdiom == .pad
|
return UIDevice.current.userInterfaceIdiom == .pad
|
||||||
|
|||||||
@@ -45,10 +45,6 @@
|
|||||||
listener.applyTheme()
|
listener.applyTheme()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if #available(iOS 13, *) {} else {
|
|
||||||
UISearchBarRenderer.setAppearance()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func updateView(_ view: UIView?) {
|
private func updateView(_ view: UIView?) {
|
||||||
|
|||||||
@@ -10,9 +10,7 @@ final class ThemeManager: NSObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func update(theme: MWMTheme) {
|
private func update(theme: MWMTheme) {
|
||||||
if #available(iOS 13.0, *) {
|
updateSystemUserInterfaceStyle(theme)
|
||||||
updateSystemUserInterfaceStyle(theme)
|
|
||||||
}
|
|
||||||
|
|
||||||
let actualTheme: MWMTheme = { theme in
|
let actualTheme: MWMTheme = { theme in
|
||||||
let isVehicleRouting = MWMRouter.isRoutingActive() && (MWMRouter.type() == .vehicle)
|
let isVehicleRouting = MWMRouter.isRoutingActive() && (MWMRouter.type() == .vehicle)
|
||||||
@@ -22,19 +20,9 @@ final class ThemeManager: NSObject {
|
|||||||
case .night: fallthrough
|
case .night: fallthrough
|
||||||
case .vehicleNight: return isVehicleRouting ? .vehicleNight : .night
|
case .vehicleNight: return isVehicleRouting ? .vehicleNight : .night
|
||||||
case .auto:
|
case .auto:
|
||||||
if #available(iOS 13.0, *) {
|
let isDarkModeEnabled = UIScreen.main.traitCollection.userInterfaceStyle == .dark
|
||||||
let isDarkModeEnabled = UIScreen.main.traitCollection.userInterfaceStyle == .dark
|
guard isVehicleRouting else { return isDarkModeEnabled ? .night : .day }
|
||||||
guard isVehicleRouting else { return isDarkModeEnabled ? .night : .day }
|
return isDarkModeEnabled ? .vehicleNight : .vehicleDay
|
||||||
return isDarkModeEnabled ? .vehicleNight : .vehicleDay
|
|
||||||
} else {
|
|
||||||
guard isVehicleRouting else { return .day }
|
|
||||||
switch FrameworkHelper.daytime(at: LocationManager.lastLocation()) {
|
|
||||||
case .day: return .vehicleDay
|
|
||||||
case .night: return .vehicleNight
|
|
||||||
@unknown default:
|
|
||||||
fatalError()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@unknown default:
|
@unknown default:
|
||||||
fatalError()
|
fatalError()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,23 +15,15 @@ class UINavigationBarRenderer: UIViewRenderer {
|
|||||||
class func render(_ control: UINavigationBar, style: Style) {
|
class func render(_ control: UINavigationBar, style: Style) {
|
||||||
super.render(control, style: style)
|
super.render(control, style: style)
|
||||||
if let barTintColor = style.barTintColor {
|
if let barTintColor = style.barTintColor {
|
||||||
if #available(iOS 13.0, *) {
|
let appearance = UINavigationBarAppearance()
|
||||||
let appearance = UINavigationBarAppearance()
|
appearance.configureWithOpaqueBackground()
|
||||||
appearance.configureWithOpaqueBackground()
|
appearance.backgroundColor = barTintColor
|
||||||
appearance.backgroundColor = barTintColor
|
control.standardAppearance = appearance
|
||||||
control.standardAppearance = appearance
|
control.scrollEdgeAppearance = appearance
|
||||||
control.scrollEdgeAppearance = appearance
|
|
||||||
} else {
|
|
||||||
control.barTintColor = barTintColor
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if let shadowImage = style.shadowImage {
|
if let shadowImage = style.shadowImage {
|
||||||
if #available(iOS 13.0, *) {
|
control.standardAppearance.shadowImage = shadowImage
|
||||||
control.standardAppearance.shadowImage = shadowImage
|
control.scrollEdgeAppearance!.shadowImage = shadowImage
|
||||||
control.scrollEdgeAppearance!.shadowImage = shadowImage
|
|
||||||
} else {
|
|
||||||
control.shadowImage = shadowImage
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var attributes = [NSAttributedString.Key: Any]()
|
var attributes = [NSAttributedString.Key: Any]()
|
||||||
@@ -41,11 +33,7 @@ class UINavigationBarRenderer: UIViewRenderer {
|
|||||||
if let fontColor = style.fontColor {
|
if let fontColor = style.fontColor {
|
||||||
attributes[NSAttributedString.Key.foregroundColor] = fontColor
|
attributes[NSAttributedString.Key.foregroundColor] = fontColor
|
||||||
}
|
}
|
||||||
if #available(iOS 13.0, *) {
|
control.standardAppearance.titleTextAttributes = attributes
|
||||||
control.standardAppearance.titleTextAttributes = attributes
|
control.scrollEdgeAppearance!.titleTextAttributes = attributes
|
||||||
control.scrollEdgeAppearance!.titleTextAttributes = attributes
|
|
||||||
} else {
|
|
||||||
control.titleTextAttributes = attributes
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,43 +24,34 @@ extension UISearchBar {
|
|||||||
class UISearchBarRenderer: UIViewRenderer {
|
class UISearchBarRenderer: UIViewRenderer {
|
||||||
class func render(_ control: UISearchBar, style: Style) {
|
class func render(_ control: UISearchBar, style: Style) {
|
||||||
super.render(control, style: style)
|
super.render(control, style: style)
|
||||||
if #available(iOS 13, *) {
|
|
||||||
let searchTextField = control.searchTextField
|
let searchTextField = control.searchTextField
|
||||||
// Default search bar implementation adds the grey transparent image for background. This code removes it and updates the corner radius. This is not working on iPad designed for mac.
|
// Default search bar implementation adds the grey transparent image for background. This code removes it and updates the corner radius. This is not working on iPad designed for mac.
|
||||||
if #available(iOS 14.0, *), ProcessInfo.processInfo.isiOSAppOnMac {
|
if !ProcessInfo.processInfo.isiOSAppOnMac {
|
||||||
} else {
|
control.setSearchFieldBackgroundImage(UIImage(), for: .normal)
|
||||||
control.setSearchFieldBackgroundImage(UIImage(), for: .normal)
|
}
|
||||||
}
|
searchTextField.layer.setCornerRadius(.buttonDefault)
|
||||||
searchTextField.layer.setCornerRadius(.buttonDefault)
|
searchTextField.layer.masksToBounds = true
|
||||||
searchTextField.layer.masksToBounds = true
|
// Placeholder color
|
||||||
// Placeholder color
|
if let placeholder = searchTextField.placeholder {
|
||||||
if let placeholder = searchTextField.placeholder {
|
searchTextField.attributedPlaceholder = NSAttributedString(string: placeholder, attributes: [.foregroundColor: UIColor.gray])
|
||||||
searchTextField.attributedPlaceholder = NSAttributedString(string: placeholder, attributes: [.foregroundColor: UIColor.gray])
|
}
|
||||||
}
|
if let backgroundColor = style.backgroundColor {
|
||||||
if let backgroundColor = style.backgroundColor {
|
searchTextField.backgroundColor = backgroundColor
|
||||||
searchTextField.backgroundColor = backgroundColor
|
}
|
||||||
}
|
if let font = style.font {
|
||||||
if let font = style.font {
|
searchTextField.font = font
|
||||||
searchTextField.font = font
|
}
|
||||||
}
|
if let fontColor = style.fontColor {
|
||||||
if let fontColor = style.fontColor {
|
searchTextField.textColor = fontColor
|
||||||
searchTextField.textColor = fontColor
|
}
|
||||||
}
|
if let tintColor = style.tintColor {
|
||||||
if let tintColor = style.tintColor {
|
searchTextField.leftView?.tintColor = tintColor
|
||||||
searchTextField.leftView?.tintColor = tintColor
|
// Placeholder indicator color
|
||||||
// Placeholder indicator color
|
searchTextField.tintColor = tintColor
|
||||||
searchTextField.tintColor = tintColor
|
// Clear button image
|
||||||
// Clear button image
|
let clearButtonImage = UIImage(named: "ic_clear")?.withRenderingMode(.alwaysTemplate).withTintColor(tintColor)
|
||||||
let clearButtonImage = UIImage(named: "ic_clear")?.withRenderingMode(.alwaysTemplate).withTintColor(tintColor)
|
control.setImage(clearButtonImage, for: .clear, state: .normal)
|
||||||
control.setImage(clearButtonImage, for: .clear, state: .normal)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Default search bar implementation for iOS12 adds the dark grey transparent image for background. This code removes it and replace with the custom image accordingly to the documentation - see 'setSearchFieldBackgroundImage'.
|
|
||||||
if let backgroundColor = style.backgroundColor {
|
|
||||||
let image = getSearchBarBackgroundImage(color: backgroundColor)
|
|
||||||
control.setSearchFieldBackgroundImage(image, for: .normal)
|
|
||||||
control.searchTextPositionAdjustment = UIOffset(horizontal: 6.0, vertical: 0.0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if let barTintColor = style.barTintColor {
|
if let barTintColor = style.barTintColor {
|
||||||
let position = control.delegate?.position?(for: control) ?? control.barPosition
|
let position = control.delegate?.position?(for: control) ?? control.barPosition
|
||||||
|
|||||||
@@ -57,8 +57,6 @@ class UIViewRenderer {
|
|||||||
if let round = style.round, round == true {
|
if let round = style.round, round == true {
|
||||||
control.layer.cornerRadius = control.size.height / 2
|
control.layer.cornerRadius = control.size.height / 2
|
||||||
}
|
}
|
||||||
if #available(iOS 13.0, *) {
|
control.layer.cornerCurve = .continuous
|
||||||
control.layer.cornerCurve = .continuous
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ final class ColorPicker: NSObject {
|
|||||||
|
|
||||||
switch pickerType {
|
switch pickerType {
|
||||||
case .defaultColorPicker(let color):
|
case .defaultColorPicker(let color):
|
||||||
if #available(iOS 14.0, *), !ProcessInfo.processInfo.isiOSAppOnMac {
|
if !ProcessInfo.processInfo.isiOSAppOnMac {
|
||||||
colorPickerViewController = defaultColorPickerViewController(with: color)
|
colorPickerViewController = defaultColorPickerViewController(with: color)
|
||||||
} else {
|
} else {
|
||||||
colorPickerViewController = bookmarksColorPickerViewController(with: BookmarkColor.bookmarkColor(from: color) ?? .none)
|
colorPickerViewController = bookmarksColorPickerViewController(with: BookmarkColor.bookmarkColor(from: color) ?? .none)
|
||||||
|
|||||||
@@ -9,11 +9,7 @@ final class DocumentPicker: NSObject {
|
|||||||
completionHandler: @escaping URLsCompletionHandler) {
|
completionHandler: @escaping URLsCompletionHandler) {
|
||||||
self.completionHandler = completionHandler
|
self.completionHandler = completionHandler
|
||||||
let documentPickerViewController: UIDocumentPickerViewController
|
let documentPickerViewController: UIDocumentPickerViewController
|
||||||
if #available(iOS 14.0, *) {
|
documentPickerViewController = UIDocumentPickerViewController(forOpeningContentTypes: fileTypes.map(\.utType), asCopy: true)
|
||||||
documentPickerViewController = UIDocumentPickerViewController(forOpeningContentTypes: fileTypes.map(\.utType), asCopy: true)
|
|
||||||
} else {
|
|
||||||
documentPickerViewController = UIDocumentPickerViewController(documentTypes: fileTypes.map(\.typeIdentifier), in: .import)
|
|
||||||
}
|
|
||||||
documentPickerViewController.delegate = self
|
documentPickerViewController.delegate = self
|
||||||
// TODO: Enable multiple selection when the multiple files parsing support will be added to the bookmark_manager.
|
// TODO: Enable multiple selection when the multiple files parsing support will be added to the bookmark_manager.
|
||||||
documentPickerViewController.allowsMultipleSelection = false
|
documentPickerViewController.allowsMultipleSelection = false
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ final class PlacePageEditBookmarkOrTrackViewController: UIViewController {
|
|||||||
|
|
||||||
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
||||||
super.traitCollectionDidChange(previousTraitCollection)
|
super.traitCollectionDidChange(previousTraitCollection)
|
||||||
if #available(iOS 13.0, *), traitCollection.hasDifferentColorAppearance(comparedTo: previousTraitCollection) {
|
if traitCollection.hasDifferentColorAppearance(comparedTo: previousTraitCollection) {
|
||||||
applyTheme()
|
applyTheme()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ final class CircleImageButton: UIButton {
|
|||||||
|
|
||||||
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
||||||
super.traitCollectionDidChange(previousTraitCollection)
|
super.traitCollectionDidChange(previousTraitCollection)
|
||||||
if #available(iOS 13.0, *), traitCollection.hasDifferentColorAppearance(comparedTo: previousTraitCollection) {
|
if traitCollection.hasDifferentColorAppearance(comparedTo: previousTraitCollection) {
|
||||||
circleImageView.applyTheme()
|
circleImageView.applyTheme()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,38 +111,21 @@ extension PlacePageHeaderViewController: PlacePageHeaderViewProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func showShareTrackMenu() {
|
func showShareTrackMenu() {
|
||||||
if #available(iOS 14.0, *) {
|
|
||||||
// The menu will be shown by the shareButton itself
|
// The menu will be shown by the shareButton itself
|
||||||
} else {
|
|
||||||
let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
|
|
||||||
let kmlAction = UIAlertAction(title: L("export_file"), style: .default) { [weak self] _ in
|
|
||||||
guard let self else { return }
|
|
||||||
self.presenter?.onExportTrackButtonPress(.text, from: self.shareButton)
|
|
||||||
}
|
|
||||||
let gpxAction = UIAlertAction(title: L("export_file_gpx"), style: .default) { [weak self] _ in
|
|
||||||
guard let self else { return }
|
|
||||||
self.presenter?.onExportTrackButtonPress(.gpx, from: self.shareButton)
|
|
||||||
}
|
|
||||||
alert.addAction(kmlAction)
|
|
||||||
alert.addAction(gpxAction)
|
|
||||||
present(alert, animated: true, completion: nil)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func configureTrackSharingMenu() {
|
private func configureTrackSharingMenu() {
|
||||||
if #available(iOS 14.0, *) {
|
let menu = UIMenu(title: "", image: nil, children: [
|
||||||
let menu = UIMenu(title: "", image: nil, children: [
|
UIAction(title: L("export_file"), image: nil, handler: { [weak self] _ in
|
||||||
UIAction(title: L("export_file"), image: nil, handler: { [weak self] _ in
|
guard let self else { return }
|
||||||
guard let self else { return }
|
self.presenter?.onExportTrackButtonPress(.text, from: self.shareButton)
|
||||||
self.presenter?.onExportTrackButtonPress(.text, from: self.shareButton)
|
}),
|
||||||
}),
|
UIAction(title: L("export_file_gpx"), image: nil, handler: { [weak self] _ in
|
||||||
UIAction(title: L("export_file_gpx"), image: nil, handler: { [weak self] _ in
|
guard let self else { return }
|
||||||
guard let self else { return }
|
self.presenter?.onExportTrackButtonPress(.gpx, from: self.shareButton)
|
||||||
self.presenter?.onExportTrackButtonPress(.gpx, from: self.shareButton)
|
}),
|
||||||
}),
|
])
|
||||||
])
|
shareButton.menu = menu
|
||||||
shareButton.menu = menu
|
shareButton.showsMenuAsPrimaryAction = true
|
||||||
shareButton.showsMenuAsPrimaryAction = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -488,16 +488,15 @@ class PlacePageInfoViewController: UIViewController {
|
|||||||
longPressHandler: { [weak self] in
|
longPressHandler: { [weak self] in
|
||||||
self?.copyCoordinatesToPasteboard()
|
self?.copyCoordinatesToPasteboard()
|
||||||
})
|
})
|
||||||
if #available(iOS 14.0, *) {
|
|
||||||
let menu = UIMenu(children: coordFormats.enumerated().map { (index, format) in
|
let menu = UIMenu(children: coordFormats.enumerated().map { (index, format) in
|
||||||
UIAction(title: format, handler: { [weak self] _ in
|
UIAction(title: format, handler: { [weak self] _ in
|
||||||
self?.setCoordinatesSelected(formatId: index)
|
self?.setCoordinatesSelected(formatId: index)
|
||||||
self?.copyCoordinatesToPasteboard()
|
self?.copyCoordinatesToPasteboard()
|
||||||
})
|
|
||||||
})
|
})
|
||||||
coordinatesView?.accessoryButton.menu = menu
|
})
|
||||||
coordinatesView?.accessoryButton.showsMenuAsPrimaryAction = true
|
coordinatesView?.accessoryButton.menu = menu
|
||||||
}
|
coordinatesView?.accessoryButton.showsMenuAsPrimaryAction = true
|
||||||
}
|
}
|
||||||
|
|
||||||
private func setCoordinatesSelected(formatId: Int) {
|
private func setCoordinatesSelected(formatId: Int) {
|
||||||
|
|||||||
@@ -58,13 +58,6 @@ final class PlacePageScrollView: UIScrollView {
|
|||||||
|
|
||||||
override func viewDidLayoutSubviews() {
|
override func viewDidLayoutSubviews() {
|
||||||
super.viewDidLayoutSubviews()
|
super.viewDidLayoutSubviews()
|
||||||
if #available(iOS 13.0, *) {
|
|
||||||
// See https://github.com/organicmaps/organicmaps/issues/6917 for the details.
|
|
||||||
} else if previousTraitCollection == nil {
|
|
||||||
scrollView.contentInset = alternativeSizeClass(iPhone: UIEdgeInsets(top: scrollView.height, left: 0, bottom: 0, right: 0),
|
|
||||||
iPad: UIEdgeInsets.zero)
|
|
||||||
updateSteps()
|
|
||||||
}
|
|
||||||
panGesture.isEnabled = alternativeSizeClass(iPhone: false, iPad: true)
|
panGesture.isEnabled = alternativeSizeClass(iPhone: false, iPad: true)
|
||||||
previousTraitCollection = traitCollection
|
previousTraitCollection = traitCollection
|
||||||
}
|
}
|
||||||
@@ -170,8 +163,7 @@ final class PlacePageScrollView: UIScrollView {
|
|||||||
actionBarContainerView.layer.setCornerRadius(.modalSheet, maskedCorners: cornersToMask)
|
actionBarContainerView.layer.setCornerRadius(.modalSheet, maskedCorners: cornersToMask)
|
||||||
actionBarContainerView.layer.masksToBounds = true
|
actionBarContainerView.layer.masksToBounds = true
|
||||||
|
|
||||||
// See https://github.com/organicmaps/organicmaps/issues/6917 for the details.
|
if previousTraitCollection == nil {
|
||||||
if #available(iOS 13.0, *), previousTraitCollection == nil {
|
|
||||||
scrollView.contentInset = alternativeSizeClass(iPhone: UIEdgeInsets(top: view.height, left: 0, bottom: 0, right: 0),
|
scrollView.contentInset = alternativeSizeClass(iPhone: UIEdgeInsets(top: view.height, left: 0, bottom: 0, right: 0),
|
||||||
iPad: UIEdgeInsets.zero)
|
iPad: UIEdgeInsets.zero)
|
||||||
scrollView.layoutIfNeeded()
|
scrollView.layoutIfNeeded()
|
||||||
|
|||||||
@@ -61,11 +61,7 @@ final class PlaceholderView: UIView {
|
|||||||
if let activityIndicator = activityIndicator {
|
if let activityIndicator = activityIndicator {
|
||||||
activityIndicator.hidesWhenStopped = true
|
activityIndicator.hidesWhenStopped = true
|
||||||
activityIndicator.startAnimating()
|
activityIndicator.startAnimating()
|
||||||
if #available(iOS 13.0, *) {
|
activityIndicator.style = .medium
|
||||||
activityIndicator.style = .medium
|
|
||||||
} else {
|
|
||||||
activityIndicator.style = .gray
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
titleLabel.text = title
|
titleLabel.text = title
|
||||||
|
|||||||
@@ -65,11 +65,9 @@ final class SearchOnMapHeaderView: UIView {
|
|||||||
searchBar.setStyle(.defaultSearchBar)
|
searchBar.setStyle(.defaultSearchBar)
|
||||||
searchBar.placeholder = L("search")
|
searchBar.placeholder = L("search")
|
||||||
searchBar.showsCancelButton = false
|
searchBar.showsCancelButton = false
|
||||||
if #available(iOS 13.0, *) {
|
searchBar.searchTextField.clearButtonMode = .always
|
||||||
searchBar.searchTextField.clearButtonMode = .always
|
searchBar.returnKeyType = .search
|
||||||
searchBar.returnKeyType = .search
|
searchBar.searchTextField.enablesReturnKeyAutomatically = true
|
||||||
searchBar.searchTextField.enablesReturnKeyAutomatically = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func setupCancelButton() {
|
private func setupCancelButton() {
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ final class SearchOnMapViewController: UIViewController {
|
|||||||
|
|
||||||
override func viewWillTransition(to size: CGSize, with coordinator: any UIViewControllerTransitionCoordinator) {
|
override func viewWillTransition(to size: CGSize, with coordinator: any UIViewControllerTransitionCoordinator) {
|
||||||
super.viewWillTransition(to: size, with: coordinator)
|
super.viewWillTransition(to: size, with: coordinator)
|
||||||
if #available(iOS 14.0, *), ProcessInfo.processInfo.isiOSAppOnMac {
|
if ProcessInfo.processInfo.isiOSAppOnMac {
|
||||||
updateFrameOfPresentedViewInContainerView()
|
updateFrameOfPresentedViewInContainerView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user