Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ class AutoUploadWorker(
@Suppress("ReturnCount")
override suspend fun doWork(): Result {
return try {
trySetForeground()

val syncFolderId = inputData.getLong(SYNCED_FOLDER_ID, -1)
syncedFolder = syncedFolderProvider.getSyncedFolderByID(syncFolderId)
?.takeIf { it.isEnabled } ?: return Result.failure()
Expand Down Expand Up @@ -274,7 +276,6 @@ class AutoUploadWorker(
val client = OwnCloudClientManagerFactory.getDefaultSingleton()
.getClientFor(ocAccount, context)

trySetForeground()
updateNotification()

var lastId = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class FileDownloadWorker(

return try {
setUser()
val remotePath = inputData.keyValueMap[FILE_REMOTE_PATH] as String? ?: return Result.failure()
val remotePath = inputData.keyValueMap[FILE_REMOTE_PATH] as? String? ?: return Result.failure()
val ocFile = fileDataStorageManager?.getFileByEncryptedRemotePath(remotePath) ?: return Result.failure()
val requestDownloads = getRequestDownloads(ocFile)
addAccountUpdateListener()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ class FileUploadWorker(
private val fileUploadBroadcastManager = FileUploadBroadcastManager(localBroadcastManager)

override suspend fun doWork(): Result = try {
trySetForeground()

Log_OC.d(TAG, "FileUploadWorker started")
val workerName = BackgroundJobManagerImpl.formatClassTag(this::class)
backgroundJobManager.logStartOfWorker(workerName)

trySetForeground()

val result = uploadFiles()
backgroundJobManager.logEndOfWorker(workerName, result)
notificationManager.dismissNotification()
Expand Down
Loading