|
|
@ -3,6 +3,7 @@ package io.legado.app.ui.book.remote |
|
|
|
import android.app.Application |
|
|
|
import android.app.Application |
|
|
|
import io.legado.app.base.BaseViewModel |
|
|
|
import io.legado.app.base.BaseViewModel |
|
|
|
import io.legado.app.constant.AppLog |
|
|
|
import io.legado.app.constant.AppLog |
|
|
|
|
|
|
|
import io.legado.app.constant.BookType |
|
|
|
import io.legado.app.model.localBook.LocalBook |
|
|
|
import io.legado.app.model.localBook.LocalBook |
|
|
|
import io.legado.app.ui.book.remote.manager.RemoteBookWebDav |
|
|
|
import io.legado.app.ui.book.remote.manager.RemoteBookWebDav |
|
|
|
import io.legado.app.utils.toastOnUi |
|
|
|
import io.legado.app.utils.toastOnUi |
|
|
@ -96,7 +97,7 @@ class RemoteBookViewModel(application: Application) : BaseViewModel(application) |
|
|
|
val downloadBookPath = RemoteBookWebDav.getRemoteBook(remoteBook) |
|
|
|
val downloadBookPath = RemoteBookWebDav.getRemoteBook(remoteBook) |
|
|
|
downloadBookPath?.let { |
|
|
|
downloadBookPath?.let { |
|
|
|
val localBook = LocalBook.importFile(it) |
|
|
|
val localBook = LocalBook.importFile(it) |
|
|
|
localBook.origin= "webDav::" + remoteBook.path |
|
|
|
localBook.origin = BookType.webDav + remoteBook.path |
|
|
|
localBook.save() |
|
|
|
localBook.save() |
|
|
|
remoteBook.isOnBookShelf = true |
|
|
|
remoteBook.isOnBookShelf = true |
|
|
|
} |
|
|
|
} |
|
|
|