|
|
|
@ -7,7 +7,6 @@ import androidx.core.content.FileProvider |
|
|
|
|
import androidx.documentfile.provider.DocumentFile |
|
|
|
|
import io.legado.app.App |
|
|
|
|
import io.legado.app.BuildConfig |
|
|
|
|
import io.legado.app.R |
|
|
|
|
import io.legado.app.base.BaseViewModel |
|
|
|
|
import io.legado.app.constant.AppPattern |
|
|
|
|
import io.legado.app.data.entities.BookSource |
|
|
|
@ -167,7 +166,7 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun shareSelection(sources: List<BookSource>) { |
|
|
|
|
fun shareSelection(sources: List<BookSource>, success: ((intent: Intent) -> Unit)) { |
|
|
|
|
execute { |
|
|
|
|
val intent = Intent(Intent.ACTION_SEND) |
|
|
|
|
val file = FileUtils.createFileWithReplace("${context.filesDir}/shareBookSource.json") |
|
|
|
@ -183,9 +182,7 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application) |
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) |
|
|
|
|
intent |
|
|
|
|
}.onSuccess { |
|
|
|
|
context.startActivity( |
|
|
|
|
Intent.createChooser(it, context.getString(R.string.share_selected_source)) |
|
|
|
|
) |
|
|
|
|
success.invoke(it) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|