chore: trim redundant comments

This commit is contained in:
zarzet
2026-06-13 15:37:00 +07:00
parent fb2dda1ed1
commit 49869792cf
13 changed files with 30 additions and 96 deletions
+2 -15
View File
@@ -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(