pull/83/head
parent
46e4916bfe
commit
7487b2a4ca
@ -1,17 +1,25 @@ |
|||||||
package io.legado.app.ui.importbook |
package io.legado.app.ui.importbook |
||||||
|
|
||||||
import android.app.Application |
import android.app.Application |
||||||
|
import android.net.Uri |
||||||
|
import androidx.documentfile.provider.DocumentFile |
||||||
import io.legado.app.base.BaseViewModel |
import io.legado.app.base.BaseViewModel |
||||||
|
|
||||||
|
|
||||||
class ImportBookViewModel(application: Application) : BaseViewModel(application) { |
class ImportBookViewModel(application: Application) : BaseViewModel(application) { |
||||||
|
|
||||||
fun addToBookshelf(uriList: HashSet<String>) { |
fun addToBookshelf(uriList: HashSet<String>, finally: () -> Unit) { |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
fun deleteDoc(uriList: HashSet<String>) { |
fun deleteDoc(uriList: HashSet<String>, finally: () -> Unit) { |
||||||
|
execute { |
||||||
|
uriList.forEach { |
||||||
|
DocumentFile.fromSingleUri(context, Uri.parse(it))?.delete() |
||||||
|
} |
||||||
|
}.onFinally { |
||||||
|
finally.invoke() |
||||||
|
} |
||||||
} |
} |
||||||
|
|
||||||
} |
} |
Loading…
Reference in new issue