Skip to content

Commit

Permalink
chore: Better use of DI
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-coye committed Jan 22, 2024
1 parent b0b5c71 commit 87f5e1d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kDriveCore/BackgroundTasksService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ public protocol BackgroundTasksServiceable {
}

struct BackgroundTasksService: BackgroundTasksServiceable {
@LazyInjectService var scheduler: BGTaskScheduler
@LazyInjectService private var scheduler: BGTaskScheduler
@LazyInjectService private var accountManager: AccountManageable
@LazyInjectService private var uploadQueue: UploadQueue

public init() {
// Sonar Cloud happy
// META: keep SonarCloud happy
}

public func registerBackgroundTasks() {
Expand All @@ -64,7 +66,6 @@ struct BackgroundTasksService: BackgroundTasksServiceable {
task.setTaskCompleted(success: true)
}

@InjectService var uploadQueue: UploadQueue
task.expirationHandler = {
Log.backgroundTaskScheduling("Task \(identifier) EXPIRED", level: .error)
uploadQueue.suspendAllOperations()
Expand All @@ -86,7 +87,6 @@ struct BackgroundTasksService: BackgroundTasksServiceable {
func handleBackgroundRefresh(completion: @escaping (Bool) -> Void) {
Log.backgroundTaskScheduling("handleBackgroundRefresh")
// User installed the app but never logged in
@InjectService var accountManager: AccountManageable
if accountManager.accounts.isEmpty {
completion(false)
return
Expand Down

0 comments on commit 87f5e1d

Please sign in to comment.