app: reformat
This commit is contained in:
parent
0cfd6ddb67
commit
a24d102a00
3 changed files with 15 additions and 10 deletions
|
@ -25,7 +25,6 @@ import javax.inject.Inject
|
|||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.selects.select
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.coroutines.yield
|
||||
import org.oxycblt.auxio.music.MusicRepository.IndexingWorker
|
||||
|
@ -410,7 +409,8 @@ constructor(
|
|||
}
|
||||
|
||||
// Old cover revisions may be lying around, even during a normal refresh due
|
||||
// to realyl lucky cancellations. Clean those up.
|
||||
// to really lucky cancellations. Clean those up now that it's impossible for
|
||||
// the rest of the app to be using them.
|
||||
RevisionedStoredCovers.cleanup(context, newRevision)
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,9 @@ class MusicSettingsImpl @Inject constructor(@ApplicationContext private val cont
|
|||
|
||||
override var revision: UUID?
|
||||
get() =
|
||||
sharedPreferences.getString(getString(R.string.set_key_library_revision), null)?.let(UUID::fromString)
|
||||
sharedPreferences
|
||||
.getString(getString(R.string.set_key_library_revision), null)
|
||||
?.let(UUID::fromString)
|
||||
set(value) {
|
||||
sharedPreferences.edit {
|
||||
putString(getString(R.string.set_key_library_revision), value.toString())
|
||||
|
|
|
@ -15,19 +15,18 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
package org.oxycblt.auxio.music
|
||||
|
||||
import android.content.Context
|
||||
import java.util.UUID
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.util.UUID
|
||||
import org.oxycblt.auxio.util.unlikelyToBeNull
|
||||
import org.oxycblt.musikr.cover.Cover
|
||||
import org.oxycblt.musikr.cover.CoverFormat
|
||||
import org.oxycblt.musikr.cover.MutableStoredCovers
|
||||
import org.oxycblt.musikr.cover.StoredCovers
|
||||
import java.io.File
|
||||
|
||||
open class RevisionedStoredCovers(private val context: Context, private val revision: UUID?) :
|
||||
StoredCovers {
|
||||
|
@ -53,10 +52,14 @@ open class RevisionedStoredCovers(private val context: Context, private val revi
|
|||
}
|
||||
|
||||
companion object {
|
||||
suspend fun cleanup(context: Context, exclude: UUID) = withContext(Dispatchers.IO) {
|
||||
context.filesDir.listFiles { file -> file.name.startsWith("covers_") && file.name != "covers_$exclude" }
|
||||
?.forEach { it.deleteRecursively() }
|
||||
}
|
||||
suspend fun cleanup(context: Context, exclude: UUID) =
|
||||
withContext(Dispatchers.IO) {
|
||||
context.filesDir
|
||||
.listFiles { file ->
|
||||
file.name.startsWith("covers_") && file.name != "covers_$exclude"
|
||||
}
|
||||
?.forEach { it.deleteRecursively() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue