mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-08-14 23:20:25 +02:00
chore: trim redundant comments
This commit is contained in:
@@ -21,11 +21,8 @@ import Gobackend // Import Go framework
|
||||
/// Currently accessed security-scoped URL for library folder
|
||||
private var activeSecurityScopedURL: URL?
|
||||
|
||||
/// Whether a download queue is currently active. When true, the app begins a
|
||||
/// fresh background task each time it enters the background so an in-flight
|
||||
/// download keeps running for the limited window iOS allows. iOS has no
|
||||
/// foreground-service equivalent, so this is best-effort. Only touched on the
|
||||
/// main thread.
|
||||
/// Whether a download queue is active; while true a background task is
|
||||
/// started on each background entry to extend execution time. Main-thread only.
|
||||
private var downloadsActive = false
|
||||
private var downloadBackgroundTask: UIBackgroundTaskIdentifier = .invalid
|
||||
|
||||
@@ -241,17 +238,12 @@ import Gobackend // Import Go framework
|
||||
}
|
||||
|
||||
private func handleMethodCall(call: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
// Background-task management must run on the main thread and does not
|
||||
// touch the Go backend, so handle it directly without dispatching.
|
||||
switch call.method {
|
||||
case "beginBackgroundDownloadTask":
|
||||
// Queue started: remember it so we extend background time whenever
|
||||
// the app is backgrounded while downloads run.
|
||||
downloadsActive = true
|
||||
result(nil)
|
||||
return
|
||||
case "endBackgroundDownloadTask":
|
||||
// Queue finished/paused: stop extending background time.
|
||||
downloadsActive = false
|
||||
endBackgroundDownloadTask()
|
||||
result(nil)
|
||||
@@ -283,14 +275,9 @@ import Gobackend // Import Go framework
|
||||
|
||||
override func applicationWillEnterForeground(_ application: UIApplication) {
|
||||
super.applicationWillEnterForeground(application)
|
||||
// No background-time countdown while in the foreground.
|
||||
endBackgroundDownloadTask()
|
||||
}
|
||||
|
||||
/// Begins a background task (if one is not already active) so an in-flight
|
||||
/// download keeps running for the limited window iOS allows after the app is
|
||||
/// backgrounded. The expiration handler ends the task to avoid the app being
|
||||
/// force-terminated by the watchdog. Must run on the main thread.
|
||||
private func beginBackgroundDownloadTask() {
|
||||
if downloadBackgroundTask != .invalid { return }
|
||||
downloadBackgroundTask = UIApplication.shared.beginBackgroundTask(
|
||||
|
||||
Reference in New Issue
Block a user