File tree Expand file tree Collapse file tree
app/src/main/java/com/nextcloud/client/jobs Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,6 +77,8 @@ class AutoUploadWorker(
7777 @Suppress(" ReturnCount" )
7878 override suspend fun doWork (): Result {
7979 return try {
80+ trySetForeground()
81+
8082 val syncFolderId = inputData.getLong(SYNCED_FOLDER_ID , - 1 )
8183 syncedFolder = syncedFolderProvider.getSyncedFolderByID(syncFolderId)
8284 ?.takeIf { it.isEnabled } ? : return Result .failure()
@@ -242,7 +244,6 @@ class AutoUploadWorker(
242244 val client = OwnCloudClientManagerFactory .getDefaultSingleton()
243245 .getClientFor(ocAccount, context)
244246
245- trySetForeground()
246247 updateNotification()
247248
248249 var lastId = 0
Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ class FileDownloadWorker(
117117
118118 return try {
119119 setUser()
120- val remotePath = inputData.keyValueMap[FILE_REMOTE_PATH ] as String? ? : return Result .failure()
120+ val remotePath = inputData.keyValueMap[FILE_REMOTE_PATH ] as ? String? ? : return Result .failure()
121121 val ocFile = fileDataStorageManager?.getFileByEncryptedRemotePath(remotePath) ? : return Result .failure()
122122 val requestDownloads = getRequestDownloads(ocFile)
123123 addAccountUpdateListener()
Original file line number Diff line number Diff line change @@ -121,12 +121,12 @@ class FileUploadWorker(
121121 private val fileUploadBroadcastManager = FileUploadBroadcastManager (localBroadcastManager)
122122
123123 override suspend fun doWork (): Result = try {
124+ trySetForeground()
125+
124126 Log_OC .d(TAG , " FileUploadWorker started" )
125127 val workerName = BackgroundJobManagerImpl .formatClassTag(this ::class )
126128 backgroundJobManager.logStartOfWorker(workerName)
127129
128- trySetForeground()
129-
130130 val result = uploadFiles()
131131 backgroundJobManager.logEndOfWorker(workerName, result)
132132 notificationManager.dismissNotification()
You can’t perform that action at this time.
0 commit comments