Refactor objects to classes

This commit is contained in:
Koitharu
2020-12-16 15:28:58 +02:00
parent 6463023736
commit bf2d82723b
12 changed files with 25 additions and 76 deletions

View File

@@ -75,8 +75,8 @@ class LocalListViewModel(
fun importFile(uri: Uri) {
launchLoadingJob {
val contentResolver = context.contentResolver
withContext(Dispatchers.Default) {
val name = MediaStoreCompat.getName(contentResolver, uri)
withContext(Dispatchers.IO) {
val name = MediaStoreCompat(contentResolver).getName(uri)
?: throw IOException("Cannot fetch name from uri: $uri")
if (!LocalMangaRepository.isFileSupported(name)) {
throw UnsupportedFileException("Unsupported file on $uri")