Skip to content

Commit

Permalink
Support Xcode 15.4
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaysharm committed Nov 13, 2024
1 parent 17bb261 commit d7ead12
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions Lucid/Utils/BackgroundTaskManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ import Foundation
import UIKit

protocol CoreBackgroundTaskManaging: AnyObject {
func beginBackgroundTask(expirationHandler: (@MainActor @Sendable () -> Void)?) -> UIBackgroundTaskIdentifier
func startBackgroundTask(expirationHandler: (@MainActor @Sendable () -> Void)?) -> UIBackgroundTaskIdentifier
func endBackgroundTask(_ identifier: UIBackgroundTaskIdentifier)
}

extension UIApplication: CoreBackgroundTaskManaging {}
extension UIApplication: CoreBackgroundTaskManaging {
func startBackgroundTask(expirationHandler: (@MainActor () -> Void)?) -> UIBackgroundTaskIdentifier {
self.beginBackgroundTask(expirationHandler: expirationHandler)
}
}

/// In charge of keeping one background task alive as long as needed.
protocol BackgroundTaskManaging: AnyObject {
Expand Down Expand Up @@ -91,7 +95,7 @@ final class BackgroundTaskManager: BackgroundTaskManaging {
}
RunLoop.main.add(timer, forMode: .default)

_taskID = coreManager.beginBackgroundTask {
_taskID = coreManager.startBackgroundTask {
timer.invalidate()
self.asyncTaskQueue.async {
Logger.log(.warning, "\(BackgroundTaskManager.self): Background task timed out: \(self._taskID)")
Expand Down
2 changes: 1 addition & 1 deletion LucidTests/Doubles/BackgroundTaskManagerSpy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public final class CoreBackgroundTaskManagerSpy: CoreBackgroundTaskManaging {
// no-op
}

public func beginBackgroundTask(expirationHandler: (@MainActor @Sendable () -> Void)?) -> UIBackgroundTaskIdentifier {
public func startBackgroundTask(expirationHandler: (@MainActor @Sendable () -> Void)?) -> UIBackgroundTaskIdentifier {
let identifier = UIBackgroundTaskIdentifier(rawValue: backgroundTaskIDRawValueStub)
if let expirationHandler = expirationHandler {
expirationHandlerRecords[identifier] = expirationHandler
Expand Down

0 comments on commit d7ead12

Please sign in to comment.