Bump deployment target to iOS 16, use URL.ParseStrategy
This commit is contained in:
parent
3990997e6e
commit
d859552575
|
@ -6,7 +6,7 @@ import PackageDescription
|
||||||
let package = Package(
|
let package = Package(
|
||||||
name: "Fervor",
|
name: "Fervor",
|
||||||
platforms: [
|
platforms: [
|
||||||
.iOS(.v15),
|
.iOS(.v16),
|
||||||
],
|
],
|
||||||
products: [
|
products: [
|
||||||
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
||||||
|
|
|
@ -8,6 +8,16 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct Item: Decodable, Sendable {
|
public struct Item: Decodable, Sendable {
|
||||||
|
private static let urlParseStrategy = URL.ParseStrategy()
|
||||||
|
.scheme(.defaultValue("https"))
|
||||||
|
.user(.optional)
|
||||||
|
.password(.optional)
|
||||||
|
.host(.required)
|
||||||
|
.port(.defaultValue(8080))
|
||||||
|
.path(.optional)
|
||||||
|
.query(.optional)
|
||||||
|
.fragment(.optional)
|
||||||
|
|
||||||
public let id: FervorID
|
public let id: FervorID
|
||||||
public let feedID: FervorID
|
public let feedID: FervorID
|
||||||
public let title: String?
|
public let title: String?
|
||||||
|
@ -31,7 +41,8 @@ public struct Item: Decodable, Sendable {
|
||||||
self.createdAt = try container.decodeIfPresent(Date.self, forKey: .createdAt)
|
self.createdAt = try container.decodeIfPresent(Date.self, forKey: .createdAt)
|
||||||
self.content = try container.decodeIfPresent(String.self, forKey: .content)
|
self.content = try container.decodeIfPresent(String.self, forKey: .content)
|
||||||
self.summary = try container.decodeIfPresent(String.self, forKey: .summary)
|
self.summary = try container.decodeIfPresent(String.self, forKey: .summary)
|
||||||
self.url = try container.decode(URL.self, forKey: .url)
|
let urlStr = try container.decode(String.self, forKey: .url)
|
||||||
|
self.url = try Self.urlParseStrategy.parse(urlStr)
|
||||||
self.serviceURL = try container.decodeIfPresent(URL.self, forKey: .serviceURL)
|
self.serviceURL = try container.decodeIfPresent(URL.self, forKey: .serviceURL)
|
||||||
self.read = try container.decodeIfPresent(Bool.self, forKey: .read)
|
self.read = try container.decodeIfPresent(Bool.self, forKey: .read)
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import PackageDescription
|
||||||
let package = Package(
|
let package = Package(
|
||||||
name: "Persistence",
|
name: "Persistence",
|
||||||
platforms: [
|
platforms: [
|
||||||
.iOS(.v15),
|
.iOS(.v16),
|
||||||
],
|
],
|
||||||
products: [
|
products: [
|
||||||
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
||||||
|
|
|
@ -904,7 +904,7 @@
|
||||||
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
|
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
|
@ -945,7 +945,7 @@
|
||||||
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
|
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
|
|
|
@ -24,8 +24,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||||
LocalData.migrateIfNecessary()
|
LocalData.migrateIfNecessary()
|
||||||
|
|
||||||
swizzleWKWebView()
|
|
||||||
|
|
||||||
Preferences.shared.objectWillChange
|
Preferences.shared.objectWillChange
|
||||||
.debounce(for: .milliseconds(250), scheduler: RunLoop.main)
|
.debounce(for: .milliseconds(250), scheduler: RunLoop.main)
|
||||||
.sink { _ in
|
.sink { _ in
|
||||||
|
@ -133,30 +131,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this workaround is no longer necessary (in fact, it causes a stack overflow) post-iOS 15.4 because of:
|
|
||||||
// https://github.com/WebKit/WebKit/commit/1dbd34cf01d8b5aedcb8820b13cb6553ed60e8ed
|
|
||||||
@available(iOS, obsoleted: 15.4)
|
|
||||||
private func swizzleWKWebView() {
|
|
||||||
if #available(iOS 15.4, *) {
|
|
||||||
} else {
|
|
||||||
let selector = Selector(("_updateScrollViewBackground"))
|
|
||||||
var originalIMP: IMP?
|
|
||||||
let imp = imp_implementationWithBlock({ (self: WKWebView) in
|
|
||||||
if let originalIMP = originalIMP {
|
|
||||||
let original = unsafeBitCast(originalIMP, to: (@convention(c) (WKWebView, Selector) -> Void).self)
|
|
||||||
original(self, selector)
|
|
||||||
}
|
|
||||||
|
|
||||||
self.scrollView.indicatorStyle = .default
|
|
||||||
|
|
||||||
} as (@convention(block) (WKWebView) -> Void))
|
|
||||||
originalIMP = class_replaceMethod(WKWebView.self, selector, imp, "v@:")
|
|
||||||
if originalIMP == nil {
|
|
||||||
os_log(.error, "Missing originalIMP for -[WKWebView _updateScrollViewBackground], did WebKit change?")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@objc private func showPreferences() {
|
@objc private func showPreferences() {
|
||||||
let existing = UIApplication.shared.connectedScenes.first {
|
let existing = UIApplication.shared.connectedScenes.first {
|
||||||
$0.session.configuration.name == "prefs"
|
$0.session.configuration.name == "prefs"
|
||||||
|
|
Loading…
Reference in New Issue