Files
Reflect/Shared/BGTask.swift
Trey t e5656f47fd Rename iFeels to Feels across entire codebase
- Bundle IDs: com.tt.ifeel* → com.tt.feels*
- App Groups: group.com.tt.ifeel* → group.com.tt.feels*
- iCloud containers: iCloud.com.tt.ifeel* → iCloud.com.tt.feels*
- IAP product IDs: com.tt.ifeel.IAP.* → com.tt.feels.IAP.*
- URLs: ifeels.app → feels.app
- Logger subsystems and dispatch queues
- Product names and display names

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 11:57:44 -06:00

46 lines
1.3 KiB
Swift

//
// BGTask.swift
// Feels (iOS)
//
// Created by Trey Tartt on 1/12/22.
//
import Foundation
import BackgroundTasks
class BGTask {
static let updateDBMissingID = "com.tt.feels.dbUpdateMissing"
@MainActor
class func runFillInMissingDatesTask(task: BGProcessingTask) {
BGTask.scheduleBackgroundProcessing()
task.expirationHandler = {
task.setTaskCompleted(success: false)
}
DataController.shared.fillInMissingDates()
// Catch up on any side effects from widget/watch votes
MoodLogger.shared.processPendingSideEffects()
task.setTaskCompleted(success: true)
}
class func scheduleBackgroundProcessing() {
let request = BGProcessingTaskRequest(identifier: BGTask.updateDBMissingID)
request.requiresNetworkConnectivity = false
request.requiresExternalPower = false
var runDate = Calendar.current.date(byAdding: .day, value: 1, to: Date())
runDate = Calendar.current.date(bySettingHour: 0, minute: 1, second: 0, of: runDate!)
request.earliestBeginDate = runDate
do {
try BGTaskScheduler.shared.submit(request)
} catch {
print("Could not schedule image fetch: (error)")
}
}
}