From 3cdc151f828f5519047fa618c4befefa90ac8d5d Mon Sep 17 00:00:00 2001 From: Anil Kumar Beesetti Date: Tue, 13 Aug 2024 10:11:13 +0530 Subject: [PATCH] run ktlintFormat --- .../nextplayer/core/common/extensions/Context.kt | 2 +- .../core/domain/GetSortedFolderTreeUseCase.kt | 1 - .../core/media/sync/LocalMediaSynchronizer.kt | 13 +++++-------- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/core/common/src/main/java/dev/anilbeesetti/nextplayer/core/common/extensions/Context.kt b/core/common/src/main/java/dev/anilbeesetti/nextplayer/core/common/extensions/Context.kt index c361eb8b7..debac4746 100644 --- a/core/common/src/main/java/dev/anilbeesetti/nextplayer/core/common/extensions/Context.kt +++ b/core/common/src/main/java/dev/anilbeesetti/nextplayer/core/common/extensions/Context.kt @@ -398,5 +398,5 @@ suspend fun ContentResolver.deleteMedia( } } -fun Context.getVolumeDirs() = getExternalFilesDirs(null) +fun Context.getStorageVolumes() = getExternalFilesDirs(null) .map { File(it.path.substringBefore("/Android")) } diff --git a/core/domain/src/main/java/dev/anilbeesetti/nextplayer/core/domain/GetSortedFolderTreeUseCase.kt b/core/domain/src/main/java/dev/anilbeesetti/nextplayer/core/domain/GetSortedFolderTreeUseCase.kt index d0959f52b..1bd3f41ba 100644 --- a/core/domain/src/main/java/dev/anilbeesetti/nextplayer/core/domain/GetSortedFolderTreeUseCase.kt +++ b/core/domain/src/main/java/dev/anilbeesetti/nextplayer/core/domain/GetSortedFolderTreeUseCase.kt @@ -1,6 +1,5 @@ package dev.anilbeesetti.nextplayer.core.domain -import android.os.Environment import dev.anilbeesetti.nextplayer.core.common.Dispatcher import dev.anilbeesetti.nextplayer.core.common.NextDispatchers import dev.anilbeesetti.nextplayer.core.data.repository.MediaRepository diff --git a/core/media/src/main/java/dev/anilbeesetti/nextplayer/core/media/sync/LocalMediaSynchronizer.kt b/core/media/src/main/java/dev/anilbeesetti/nextplayer/core/media/sync/LocalMediaSynchronizer.kt index c75960d6e..f3104fbfa 100644 --- a/core/media/src/main/java/dev/anilbeesetti/nextplayer/core/media/sync/LocalMediaSynchronizer.kt +++ b/core/media/src/main/java/dev/anilbeesetti/nextplayer/core/media/sync/LocalMediaSynchronizer.kt @@ -11,7 +11,7 @@ import dev.anilbeesetti.nextplayer.core.common.Dispatcher import dev.anilbeesetti.nextplayer.core.common.NextDispatchers import dev.anilbeesetti.nextplayer.core.common.di.ApplicationScope import dev.anilbeesetti.nextplayer.core.common.extensions.VIDEO_COLLECTION_URI -import dev.anilbeesetti.nextplayer.core.common.extensions.getVolumeDirs +import dev.anilbeesetti.nextplayer.core.common.extensions.getStorageVolumes import dev.anilbeesetti.nextplayer.core.common.extensions.prettyName import dev.anilbeesetti.nextplayer.core.common.extensions.scanPaths import dev.anilbeesetti.nextplayer.core.common.extensions.scanStorage @@ -50,7 +50,7 @@ class LocalMediaSynchronizer @Inject constructor( override suspend fun refresh(path: String?): Boolean { return path?.let { context.scanPaths(listOf(path)) } - ?: context.getVolumeDirs().all { context.scanStorage(it.path) } + ?: context.getStorageVolumes().all { context.scanStorage(it.path) } } override fun startSync() { @@ -67,12 +67,9 @@ class LocalMediaSynchronizer @Inject constructor( private suspend fun updateDirectories(media: List) = withContext(Dispatchers.Default) { - val directories = context.getVolumeDirs().flatMap { - getDirectoryEntities( - currentFolder = it, - media = media - ) - } + val directories = context.getStorageVolumes().flatMap { + getDirectoryEntities(currentFolder = it, media = media) + } directoryDao.upsertAll(directories) val currentDirectoryPaths = directories.map { it.path }