Skip to content

Commit

Permalink
Increase min OS target to iOS 15 (#627)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamede1945 authored Jan 20, 2024
1 parent ad95411 commit 5547188
Show file tree
Hide file tree
Showing 34 changed files with 63 additions and 522 deletions.
2 changes: 0 additions & 2 deletions Core/Preferences/Preference.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import Combine
import Foundation

@available(iOS 13.0, *)
@propertyWrapper
public final class Preference<T> {
// MARK: Lifecycle
Expand Down Expand Up @@ -43,7 +42,6 @@ public final class Preference<T> {
private let preferences: Preferences
}

@available(iOS 13.0, *)
@propertyWrapper
public final class TransformedPreference<Raw, T> {
// MARK: Lifecycle
Expand Down
2 changes: 1 addition & 1 deletion Core/QueuePlayer/PlayerItemInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public struct PlayerItemInfo {
public init(title: String, artist: String, image: UIImage?) {
self.title = title
self.artist = artist
if #available(iOS 10.0, *), let image {
if let image {
artwork = MPMediaItemArtwork(boundsSize: image.size) { _ in image }
} else {
artwork = nil
Expand Down
7 changes: 1 addition & 6 deletions Core/QueuePlayer/QueuePlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

import AVFoundation
import QueuePlayerObjc

public struct QueuePlayerActions: Sendable {
// MARK: Lifecycle
Expand All @@ -34,11 +33,7 @@ public class QueuePlayer {
// MARK: Lifecycle

public init() {
if #available(iOS 10.0, *) {
try? AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: [.defaultToSpeaker, .allowBluetooth])
} else {
try? AVAudioSession.sharedInstance().setCategoryiO9Compatible(.playback)
}
try? AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: [.defaultToSpeaker, .allowBluetooth])
}

// MARK: Open
Expand Down
16 changes: 0 additions & 16 deletions Core/QueuePlayerObjc/AVAudioSession+Category.m

This file was deleted.

19 changes: 0 additions & 19 deletions Core/QueuePlayerObjc/include/AVAudioSession+Category.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import CoreData
import VLogging

@available(iOS 13.0, *)
class CoreDataPersistentHistoryProcessor {
// MARK: Lifecycle

Expand Down
2 changes: 0 additions & 2 deletions Data/CoreDataPersistence/Sources/CoreDataStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ public class CoreDataStack {
private let lazyUniquifiers: () -> [CoreDataEntityUniquifier]
private lazy var uniquifiers: [CoreDataEntityUniquifier] = lazyUniquifiers()

@available(iOS 13.0, *)
private lazy var historyProcessor: CoreDataPersistentHistoryProcessor = CoreDataPersistentHistoryProcessor(name: name, uniquifiers: uniquifiers)

/// An operation queue for handling history processing tasks: watching changes, deduplicating entities, and triggering UI updates if needed.
Expand All @@ -108,7 +107,6 @@ public class CoreDataStack {

/// Handle remote store change notifications (.NSPersistentStoreRemoteChange).
@objc
@available(iOS 13.0, *)
private func storeRemoteChange(_ notification: Notification) {
logger.info("Merging changes from the other persistent store coordinator.")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import Foundation
import QuranKit

@available(iOS 13.0, *)
public struct PreferencesLastAyahFinder: LastAyahFinder {
// MARK: Lifecycle

Expand Down
14 changes: 5 additions & 9 deletions Features/QuranTranslationFeature/TranslationCellProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,11 @@ public class TranslationCellProvider<Section: Hashable & Sendable> {
guard let dataSource else {
return
}
if #available(iOS 15.0, *) {
var snapshot = dataSource.snapshot()
// reconfigure all items
snapshot.reconfigureItems(snapshot.itemIdentifiers)
// animate font size changes
dataSource.apply(snapshot, animatingDifferences: true)
} else {
collectionView?.reloadData()
}
var snapshot = dataSource.snapshot()
// reconfigure all items
snapshot.reconfigureItems(snapshot.itemIdentifiers)
// animate font size changes
dataSource.apply(snapshot, animatingDifferences: true)
}

private func configure(cell: QuranTranslationTextCollectionViewCell, translationId: TranslationId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class TranslationExpansionHandler<Section: Hashable & Sendable> {
let itemId: ItemId = .translation(translationId)

var snapshot = dataSource.snapshot()
snapshot.backwardCompatibleReconfigureItems([itemId])
snapshot.reconfigureItems([itemId])
dataSource.apply(snapshot, animatingDifferences: false)
}

Expand Down
8 changes: 3 additions & 5 deletions Features/QuranViewFeature/QuranViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,9 @@ class QuranViewController: BaseViewController, QuranViewDelegate,
}

func presentTranslatedVerse(_ viewController: UIViewController, didDismiss: @escaping () -> Void) {
if #available(iOS 15.0, *) {
if let sheet = viewController.sheetPresentationController {
sheet.detents = [.medium(), .large()]
sheet.prefersGrabberVisible = true
}
if let sheet = viewController.sheetPresentationController {
sheet.detents = [.medium(), .large()]
sheet.prefersGrabberVisible = true
}
if let navigationController = viewController as? UINavigationController {
navigationController.visibleViewController?.navigationItem.rightBarButtonItem = UIBarButtonItem(
Expand Down
2 changes: 1 addition & 1 deletion Features/TranslationsFeature/TranslationsListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private struct TranslationsListViewUI: View {
)
}
}
.refreshableIfAvailable(action: refresh)
.refreshable(action: refresh)
.task(start)
.errorAlert(error: $error)
.environment(\.editMode, $editMode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public final class WordPointerViewController: UIViewController {

private var container: UIView { view }

private var borderInsets: DirectionalEdgeInsets {
private var borderInsets: NSDirectionalEdgeInsets {
// TODO: Use the containing window
UIApplication.shared.windows.first?.directionalSafeAreaInsets ?? .zero
}
Expand Down
5 changes: 1 addition & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let package = Package(
name: "QuranEngine",
defaultLocalization: "en",
platforms: [
.iOS(.v14),
.iOS(.v15),
],
products: libraries(from: targets),
dependencies: [
Expand Down Expand Up @@ -121,11 +121,8 @@ private func coreTargets() -> [[Target]] {

target(type, name: "QueuePlayer", hasTests: false, dependencies: [
"Timing",
"QueuePlayerObjc",
]),

target(type, name: "QueuePlayerObjc", hasTests: false, dependencies: []),

target(type, name: "AsyncUtilitiesForTesting", hasTests: false, dependencies: [
.product(name: "AsyncAlgorithms", package: "swift-async-algorithms"),
]),
Expand Down
12 changes: 0 additions & 12 deletions UI/NoorUI/Components/List/NoorList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,3 @@ public struct NoorList<Content: View>: View {
}
}
}

extension NoorList {
public func refreshableIfAvailable(action: @escaping @Sendable () async -> Void) -> some View {
Group {
if #available(iOS 15.0, *) {
refreshable(action: action)
} else {
self
}
}
}
}
26 changes: 11 additions & 15 deletions UI/NoorUI/Components/MultipartText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,20 @@ private struct TextPartView: View {
@ScaledMetric private var versePadding = 5

private func highlighting(text: String, ranges: [HighlightingRange]) -> Text {
if #available(iOS 15, *) {
var attributedString = AttributedString(text)
for highlight in ranges {
if let start = AttributedString.Index(highlight.range.lowerBound, within: attributedString),
let end = AttributedString.Index(highlight.range.upperBound, within: attributedString)
{
if let foregroundColor = highlight.foregroundColor {
attributedString[start ..< end].foregroundColor = foregroundColor
}
if let fontWeight = highlight.fontWeight {
attributedString[start ..< end].font = size.plainFont.weight(fontWeight)
}
var attributedString = AttributedString(text)
for highlight in ranges {
if let start = AttributedString.Index(highlight.range.lowerBound, within: attributedString),
let end = AttributedString.Index(highlight.range.upperBound, within: attributedString)
{
if let foregroundColor = highlight.foregroundColor {
attributedString[start ..< end].foregroundColor = foregroundColor
}
if let fontWeight = highlight.fontWeight {
attributedString[start ..< end].font = size.plainFont.weight(fontWeight)
}
}
return Text(attributedString)
} else {
return Text(text)
}
return Text(attributedString)
}
}

Expand Down
1 change: 0 additions & 1 deletion UI/NoorUI/Font/FontName++.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ private let arabicTranslationTextFontSize: CGFloat = 24
private let englishTranslationTextFontSize: CGFloat = 20
private let amharicTranslationTextFontSize: CGFloat = 20

@available(iOS 13.0, *)
public extension Font {
static func quran(ofSize size: FontSize) -> Font {
custom(.quran, size: size.fontSize(forMediumSize: arabicQuranTextFontSize))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ final class CollectionViewDataSource<
for (itemId, newItem) in newItemsDictionary {
if newItem != oldItemsDictionary[itemId] {
hasDataSourceChanged = true
snapshot.backwardCompatibleReconfigureItems([itemId])
snapshot.reconfigureItems([itemId])
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import SwiftUI

@available(iOS 13.0, *)
public struct BackgroundHighlightingStyle: ButtonStyle {
// MARK: Lifecycle

Expand Down
64 changes: 0 additions & 64 deletions UI/UIx/SwiftUI/Miscellaneous/BackwardCompatibleTaskModifier.swift

This file was deleted.

20 changes: 0 additions & 20 deletions UI/UIx/SwiftUI/Miscellaneous/Previewing.swift

This file was deleted.

Loading

0 comments on commit 5547188

Please sign in to comment.