Fix build with xcode 16 beta
This commit is contained in:
@@ -9,21 +9,21 @@ import Library
|
||||
public class UIProfileUpdateTask: BGAppRefreshTask {
|
||||
private static let taskSchedulerPermittedIdentifier = "\(FilePath.packageName).update_profiles"
|
||||
|
||||
private actor Register {
|
||||
private var registered = false
|
||||
func configure() async throws {
|
||||
if !registered {
|
||||
let success = BGTaskScheduler.shared.register(forTaskWithIdentifier: taskSchedulerPermittedIdentifier, using: nil) { task in
|
||||
NSLog("profile update task started")
|
||||
Task {
|
||||
await UIProfileUpdateTask.getAndUpdateProfiles(task)
|
||||
}
|
||||
private static var registered = false
|
||||
public static func configure() throws {
|
||||
if !registered {
|
||||
let success = BGTaskScheduler.shared.register(forTaskWithIdentifier: taskSchedulerPermittedIdentifier, using: nil) { task in
|
||||
NSLog("profile update task started")
|
||||
Task {
|
||||
await UIProfileUpdateTask.getAndUpdateProfiles(task)
|
||||
}
|
||||
if !success {
|
||||
throw NSError(domain: "register failed", code: 0)
|
||||
}
|
||||
registered = true
|
||||
}
|
||||
if !success {
|
||||
throw NSError(domain: "register task failed", code: 0)
|
||||
}
|
||||
registered = true
|
||||
}
|
||||
Task {
|
||||
BGTaskScheduler.shared.cancelAllTaskRequests()
|
||||
let profiles = try await ProfileManager.listAutoUpdateEnabled()
|
||||
if profiles.isEmpty {
|
||||
@@ -31,13 +31,8 @@ import Library
|
||||
}
|
||||
try scheduleUpdate(ProfileUpdateTask.calculateEarliestBeginDate(profiles))
|
||||
}
|
||||
}
|
||||
|
||||
private static let register = Register()
|
||||
public static func configure() async throws {
|
||||
try await register.configure()
|
||||
if await UIApplication.shared.backgroundRefreshStatus != .available {
|
||||
Task {
|
||||
Task {
|
||||
if await UIApplication.shared.backgroundRefreshStatus != .available {
|
||||
await updateOnce()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,23 +11,23 @@ class ApplicationDelegate: NSObject, UIApplicationDelegate {
|
||||
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
|
||||
NSLog("Here I stand")
|
||||
LibboxSetup(FilePath.sharedDirectory.relativePath, FilePath.workingDirectory.relativePath, FilePath.cacheDirectory.relativePath, false)
|
||||
Task {
|
||||
await setup()
|
||||
}
|
||||
setup()
|
||||
return true
|
||||
}
|
||||
|
||||
private func setup() async {
|
||||
private func setup() {
|
||||
do {
|
||||
try await UIProfileUpdateTask.configure()
|
||||
try UIProfileUpdateTask.configure()
|
||||
NSLog("setup background task success")
|
||||
} catch {
|
||||
NSLog("setup background task error: \(error.localizedDescription)")
|
||||
}
|
||||
if UIDevice.current.userInterfaceIdiom == .phone {
|
||||
await requestNetworkPermission()
|
||||
Task {
|
||||
if UIDevice.current.userInterfaceIdiom == .phone {
|
||||
await requestNetworkPermission()
|
||||
}
|
||||
await setupBackground()
|
||||
}
|
||||
await setupBackground()
|
||||
}
|
||||
|
||||
private nonisolated func setupBackground() async {
|
||||
|
||||
@@ -8,15 +8,13 @@ class ApplicationDelegate: NSObject, UIApplicationDelegate {
|
||||
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
|
||||
NSLog("Here I stand")
|
||||
LibboxSetup(FilePath.sharedDirectory.relativePath, FilePath.workingDirectory.relativePath, FilePath.cacheDirectory.relativePath, true)
|
||||
Task {
|
||||
await setup()
|
||||
}
|
||||
setup()
|
||||
return true
|
||||
}
|
||||
|
||||
private func setup() async {
|
||||
private func setup() {
|
||||
do {
|
||||
try await UIProfileUpdateTask.configure()
|
||||
try UIProfileUpdateTask.configure()
|
||||
NSLog("setup background task success")
|
||||
} catch {
|
||||
NSLog("setup background task error: \(error.localizedDescription)")
|
||||
|
||||
@@ -70,7 +70,6 @@
|
||||
3A648D2D2A4EEAA600D95A12 /* Library.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A648D2C2A4EEAA600D95A12 /* Library.swift */; };
|
||||
3A648D542A4EF4C700D95A12 /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AF342B12A4AA520002B34AC /* NetworkExtension.framework */; };
|
||||
3A6CA4542BC19FDE0012B238 /* OnDemandRulesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A6CA4532BC19FDE0012B238 /* OnDemandRulesView.swift */; };
|
||||
3A6CA5A02A71317A0027933B /* MarkdownUI in Frameworks */ = {isa = PBXBuildFile; productRef = 3A6CA59F2A71317A0027933B /* MarkdownUI */; };
|
||||
3A6CA5A32A713A580027933B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3AEECC0A2A6DF9CA006A0E0C /* Assets.xcassets */; };
|
||||
3A6CA5A62A713AA10027933B /* AppIcon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 3A6CA5A52A713AA10027933B /* AppIcon.icns */; };
|
||||
3A6CA5A72A713ABA0027933B /* AppIcon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 3A6CA5A52A713AA10027933B /* AppIcon.icns */; };
|
||||
@@ -587,7 +586,6 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3A4EAD1B2A4FEB02005435B3 /* Library.framework in Frameworks */,
|
||||
3A6CA5A02A71317A0027933B /* MarkdownUI in Frameworks */,
|
||||
3A4A020D2B53E3DC004EFB87 /* QRCode in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -1088,7 +1086,6 @@
|
||||
);
|
||||
name = ApplicationLibrary;
|
||||
packageProductDependencies = (
|
||||
3A6CA59F2A71317A0027933B /* MarkdownUI */,
|
||||
3A4A020C2B53E3DC004EFB87 /* QRCode */,
|
||||
);
|
||||
productName = ApplicationLibrary;
|
||||
@@ -1356,7 +1353,6 @@
|
||||
3A7E90362A46778E00D53052 /* XCRemoteSwiftPackageReference "BinaryCodable" */,
|
||||
3A017F902A4AB2E4009149FA /* XCRemoteSwiftPackageReference "GRDB" */,
|
||||
3A57DF3A2A4D705000690BC5 /* XCRemoteSwiftPackageReference "MacControlCenterUI" */,
|
||||
3ADB2D832A71266E00A6517D /* XCRemoteSwiftPackageReference "swift-markdown-ui" */,
|
||||
3A4A020B2B53E3DC004EFB87 /* XCRemoteSwiftPackageReference "qrcode" */,
|
||||
);
|
||||
productRefGroup = 3AEC20C72A45991900A63465 /* Products */;
|
||||
@@ -2893,14 +2889,6 @@
|
||||
minimumVersion = 2.0.0;
|
||||
};
|
||||
};
|
||||
3ADB2D832A71266E00A6517D /* XCRemoteSwiftPackageReference "swift-markdown-ui" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/gonzalezreal/swift-markdown-ui";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 2.1.0;
|
||||
};
|
||||
};
|
||||
/* End XCRemoteSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
@@ -2914,11 +2902,6 @@
|
||||
package = 3A4A020B2B53E3DC004EFB87 /* XCRemoteSwiftPackageReference "qrcode" */;
|
||||
productName = QRCode;
|
||||
};
|
||||
3A6CA59F2A71317A0027933B /* MarkdownUI */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 3ADB2D832A71266E00A6517D /* XCRemoteSwiftPackageReference "swift-markdown-ui" */;
|
||||
productName = MarkdownUI;
|
||||
};
|
||||
3A7E90372A46778E00D53052 /* BinaryCodable */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 3A7E90362A46778E00D53052 /* XCRemoteSwiftPackageReference "BinaryCodable" */;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"originHash" : "82fb479ec8c73c3348b93e33a9102fc692bb5a0a0d6f14beb4c5f31445c36e81",
|
||||
"pins" : [
|
||||
{
|
||||
"identity" : "binarycodable",
|
||||
@@ -45,15 +46,6 @@
|
||||
"version" : "17.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "swift-markdown-ui",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/gonzalezreal/swift-markdown-ui",
|
||||
"state" : {
|
||||
"revision" : "12b351a75201a8124c2f2e1f9fc6ef5cd812c0b9",
|
||||
"version" : "2.1.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "swift-qrcode-generator",
|
||||
"kind" : "remoteSourceControl",
|
||||
@@ -73,5 +65,5 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"version" : 2
|
||||
"version" : 3
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user