Skip to content

Commit

Permalink
Fix Spotless
Browse files Browse the repository at this point in the history
Signed-off-by: Jonas Mayer <jonas.a.mayer@gmx.net>
  • Loading branch information
JonasMayerDev committed Mar 21, 2024
1 parent 33f7625 commit 3529d0a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class ContentObserverWork(
private fun checkAndStartFileSyncJob() {
val syncFolders = syncerFolderProvider.countEnabledSyncedFolders() > 0
if (!powerManagementService.isPowerSavingEnabled && syncFolders) {
val changedFiles = mutableListOf<String>();
for (uri in params.triggeredContentUris){
val changedFiles = mutableListOf<String>()
for (uri in params.triggeredContentUris) {
changedFiles.add(uri.toString())
}
backgroundJobManager.startImmediateFilesSyncJob(false, changedFiles.toTypedArray())
Expand Down
15 changes: 10 additions & 5 deletions app/src/main/java/com/nextcloud/client/jobs/FilesSyncWork.kt
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ class FilesSyncWork(
(50 + (index.toDouble() / syncedFolders.size.toDouble()) * 50).toInt(),
changedFiles.isNullOrEmpty()
)
if (syncedFolder.isEnabled && (changedFiles.isNullOrEmpty() || MediaFolderType.CUSTOM != syncedFolder.type)) {
if (syncedFolder.isEnabled && (
changedFiles.isNullOrEmpty() ||
MediaFolderType.CUSTOM != syncedFolder.type
)
) {
syncFolder(
context,
resources,
Expand All @@ -160,12 +164,13 @@ class FilesSyncWork(
return result
}

private fun collectChangedFiles(changedFiles: Array<String>?){
@Suppress("MagicNumber")
private fun collectChangedFiles(changedFiles: Array<String>?) {
if (!changedFiles.isNullOrEmpty()) {
FilesSyncHelper.insertChangedEntries(syncedFolderProvider,changedFiles)
FilesSyncHelper.insertChangedEntries(syncedFolderProvider, changedFiles)
} else {
// Check every file in every synced folder for changes and update filesystemDataProvider database (expensive)
// Potentially needs a long time so use foreground worker
// Check every file in every synced folder for changes and update
// filesystemDataProvider database (potentially needs a long time so use foreground worker)
updateForegroundWorker(5, true)
FilesSyncHelper.insertAllDBEntries(syncedFolderProvider)
updateForegroundWorker(50, true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import androidx.recyclerview.widget.GridLayoutManager
import com.nextcloud.client.core.Clock
import com.nextcloud.client.device.PowerManagementService
import com.nextcloud.client.di.Injectable
import com.nextcloud.client.jobs.BackgroundJobManager
import com.nextcloud.client.jobs.MediaFoldersDetectionWork
import com.nextcloud.client.jobs.NotificationWork
import com.nextcloud.client.jobs.upload.FileUploadWorker
Expand Down

0 comments on commit 3529d0a

Please sign in to comment.